summaryrefslogtreecommitdiff
path: root/test/ruby/test_variable.rb
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2014-11-22 23:47:22 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2014-11-22 23:47:22 +0000
commit237162a3b163e011b15162c7aa2b82458484957b (patch)
tree1672d63b8471d4283ac525756b53490b8bfda694 /test/ruby/test_variable.rb
parent7fed49d221f94ce7aa62f9bce3659257a5d4fa3a (diff)
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
Diffstat (limited to 'test/ruby/test_variable.rb')
-rw-r--r--test/ruby/test_variable.rb19
1 files changed, 16 insertions, 3 deletions
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