diff options
author | Nobuyoshi Nakada <[email protected]> | 2022-07-08 11:20:02 +0900 |
---|---|---|
committer | Nobuyoshi Nakada <[email protected]> | 2022-07-08 11:31:51 +0900 |
commit | 4a2662ae8b9f64346af82551fdd6756e7497e2f1 (patch) | |
tree | d97c93b3c97b7a0004c401b84575b855aa36e7d9 /test/ruby/test_pattern_matching.rb | |
parent | f1c15f3e941192b2230035ce2aab29c3d6970fca (diff) |
[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.
Diffstat (limited to 'test/ruby/test_pattern_matching.rb')
-rw-r--r-- | test/ruby/test_pattern_matching.rb | 19 |
1 files changed, 13 insertions, 6 deletions
diff --git a/test/ruby/test_pattern_matching.rb b/test/ruby/test_pattern_matching.rb index b8c445c806..36731e14f9 100644 --- a/test/ruby/test_pattern_matching.rb +++ b/test/ruby/test_pattern_matching.rb @@ -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{ |