From 7e96d9f96ea639491190248753b661f91ed820aa Mon Sep 17 00:00:00 2001 From: "NARUSE, Yui" Date: Mon, 25 Dec 2023 22:10:57 +0900 Subject: [PATCH] suppress a warning --- test/ruby/test_syntax.rb | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/test/ruby/test_syntax.rb b/test/ruby/test_syntax.rb index 5d8d40605e3c86..286a820b02eecb 100644 --- a/test/ruby/test_syntax.rb +++ b/test/ruby/test_syntax.rb @@ -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'))