summaryrefslogtreecommitdiff
path: root/test/ruby/test_syntax.rb
diff options
context:
space:
mode:
authorNARUSE, Yui <[email protected]>2023-12-25 22:10:57 +0900
committerNARUSE, Yui <[email protected]>2023-12-25 22:10:57 +0900
commit7e96d9f96ea639491190248753b661f91ed820aa (patch)
tree075cca1663d729154cf080b634fb13199e8dd190 /test/ruby/test_syntax.rb
parentf730a5a31d7d072f752e9bf41e8b285305933328 (diff)
suppress a warning
Diffstat (limited to 'test/ruby/test_syntax.rb')
-rw-r--r--test/ruby/test_syntax.rb4
1 files changed, 3 insertions, 1 deletions
diff --git a/test/ruby/test_syntax.rb b/test/ruby/test_syntax.rb
index 5d8d40605e..286a820b02 100644
--- a/test/ruby/test_syntax.rb
+++ b/test/ruby/test_syntax.rb
@@ -1810,7 +1810,9 @@ eom
assert_valid_syntax('-> {-> {it}; _2}')
assert_equal([1, nil], eval('proc {that=it; it=nil; [that, it]}.call(1)'))
assert_equal(1, eval('proc {it = 1}.call'))
- assert_equal(2, eval('a=Object.new; def a.foo; it = 2; end; a.foo'))
+ assert_warning(/1: warning: assigned but unused variable - it/) {
+ assert_equal(2, eval('a=Object.new; def a.foo; it = 2; end; a.foo'))
+ }
assert_equal(3, eval('proc {|it| it}.call(3)'))
assert_equal(4, eval('a=Object.new; def a.foo(it); it; end; a.foo(4)'))
assert_equal(5, eval('a=Object.new; def a.it; 5; end; a.it'))