mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
[Bug #18890] Suppress warnings and fix the message
``` test/ruby/test_parse.rb:1384: warning: assigned but unused variable - obj test/ruby/test_pattern_matching.rb:1162: warning: unused literal ignored test/ruby/test_pattern_matching.rb:1165: warning: unused literal ignored test/ruby/test_pattern_matching.rb:1161: warning: assigned but unused variable - a test/ruby/test_pattern_matching.rb:1164: warning: assigned but unused variable - b ``` And a newline should be significant here.
This commit is contained in:
parent
f1c15f3e94
commit
4a2662ae8b
2 changed files with 15 additions and 6 deletions
|
@ -1394,6 +1394,7 @@ x = __ENCODING__
|
|||
1
|
||||
end;
|
||||
assert_equal(expected, eval(code))
|
||||
assert_equal(expected, obj.arg)
|
||||
|
||||
assert_valid_syntax(code = "#{<<~"do;"}\n#{<<~'end;'}")
|
||||
do;
|
||||
|
@ -1401,6 +1402,7 @@ x = __ENCODING__
|
|||
1
|
||||
end;
|
||||
assert_equal(expected, eval(code))
|
||||
assert_equal(expected, obj.arg)
|
||||
end
|
||||
|
||||
=begin
|
||||
|
|
|
@ -1155,19 +1155,26 @@ END
|
|||
end
|
||||
end
|
||||
|
||||
[{a: 42}, {b: 42}].each do |i|
|
||||
assert_block('newline should be insignificant after pattern label') do
|
||||
bug18890 = assert_warning(/(?:.*:[47]: warning: unused literal ignored\n){2}/) do
|
||||
eval("#{<<~';;;'}")
|
||||
proc do |i|
|
||||
case i
|
||||
in a:
|
||||
0
|
||||
true
|
||||
0 # line 4
|
||||
a
|
||||
in "b":
|
||||
0
|
||||
true
|
||||
0 # line 7
|
||||
b
|
||||
else
|
||||
false
|
||||
end
|
||||
end
|
||||
;;;
|
||||
end
|
||||
[{a: 42}, {b: 42}].each do |i|
|
||||
assert_block('newline should be significant after pattern label') do
|
||||
bug18890.call(i)
|
||||
end
|
||||
end
|
||||
|
||||
assert_syntax_error(%q{
|
||||
|
|
Loading…
Reference in a new issue