From 237162a3b163e011b15162c7aa2b82458484957b Mon Sep 17 00:00:00 2001 From: nobu Date: Sat, 22 Nov 2014 23:47:22 +0000 Subject: test_variable.rb: suppress warnings * test/ruby/test_variable.rb (ruler4): suppress warning. (test_global_variable_poped, test_constant_poped): ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48540 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- test/ruby/test_variable.rb | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) (limited to 'test') diff --git a/test/ruby/test_variable.rb b/test/ruby/test_variable.rb index 8dc5c2fe55..8f5329bb1c 100644 --- a/test/ruby/test_variable.rb +++ b/test/ruby/test_variable.rb @@ -28,7 +28,9 @@ class TestVariable < Test::Unit::TestCase @@rule = "Cronus" # modifies @@rule in Gods include Olympians def ruler4 - @@rule + EnvUtil.suppress_warning { + @@rule + } end end @@ -64,6 +66,7 @@ class TestVariable < Test::Unit::TestCase def test_local_variables lvar = 1 assert_instance_of(Symbol, local_variables[0], "[ruby-dev:34008]") + lvar end def test_local_variables2 @@ -71,6 +74,7 @@ class TestVariable < Test::Unit::TestCase proc do |y| assert_equal([:x, :y], local_variables.sort) end.call + x end def test_local_variables3 @@ -80,6 +84,7 @@ class TestVariable < Test::Unit::TestCase assert_equal([:x, :y, :z], local_variables.sort) end end.call + x end def test_shadowing_local_variables @@ -99,10 +104,18 @@ class TestVariable < Test::Unit::TestCase end def test_global_variable_poped - assert_nothing_raised { eval("$foo; 1") } + assert_nothing_raised { + EnvUtil.suppress_warning { + eval("$foo; 1") + } + } end def test_constant_poped - assert_nothing_raised { eval("TestVariable::Gods; 1") } + assert_nothing_raised { + EnvUtil.suppress_warning { + eval("TestVariable::Gods; 1") + } + } end end -- cgit v1.2.3