Skip to content

Commit 990cdde

Browse files
sampokuokkaneneregon
authored andcommitted
Spec: no verbose warning for inner block params
Add a spec to ensure block-parameter destructuring does not emit unused-name warnings in verbose mode. The test evals a proc with parameters |key, (val1, val2)| and asserts it should_not complain(verbose: true), preventing false-positive warnings for inner destructured names.
1 parent f5dba11 commit 990cdde

1 file changed

Lines changed: 10 additions & 0 deletions

File tree

language/block_spec.rb

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1136,3 +1136,13 @@ def o.it
11361136
proc { it = 5; it }.call(0).should == 5
11371137
end
11381138
end
1139+
1140+
describe "Block-parameter destructuring" do
1141+
it "does not warn about unused inner names in verbose mode" do
1142+
-> {
1143+
eval <<~RUBY, binding, __FILE__, __LINE__ + 1
1144+
proc { |key, (val1, val2)| [key, val2] }
1145+
RUBY
1146+
}.should_not complain(verbose: true)
1147+
end
1148+
end

0 commit comments

Comments
 (0)