Skip to content

Commit

Permalink
suppress a warning
Browse files Browse the repository at this point in the history
  • Loading branch information
nurse committed Dec 25, 2023
1 parent f730a5a commit 7e96d9f
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion test/ruby/test_syntax.rb
Expand Up @@ -1810,7 +1810,9 @@ def test_it
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'))
Expand Down

0 comments on commit 7e96d9f

Please sign in to comment.