[前][次][番号順一覧][スレッド一覧]

ruby-changes:36459

From: nobu <ko1@a...>
Date: Sun, 23 Nov 2014 08:47:39 +0900 (JST)
Subject: [ruby-changes:36459] nobu:r48540 (trunk): test_variable.rb: suppress warnings

nobu	2014-11-23 08:47:22 +0900 (Sun, 23 Nov 2014)

  New Revision: 48540

  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=48540

  Log:
    test_variable.rb: suppress warnings
    
    * test/ruby/test_variable.rb (ruler4): suppress warning.
      (test_global_variable_poped, test_constant_poped): ditto.

  Modified files:
    trunk/test/ruby/test_variable.rb
Index: test/ruby/test_variable.rb
===================================================================
--- test/ruby/test_variable.rb	(revision 48539)
+++ test/ruby/test_variable.rb	(revision 48540)
@@ -28,7 +28,9 @@ class TestVariable < Test::Unit::TestCas https://github.com/ruby/ruby/blob/trunk/test/ruby/test_variable.rb#L28
     @@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::TestCas https://github.com/ruby/ruby/blob/trunk/test/ruby/test_variable.rb#L66
   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::TestCas https://github.com/ruby/ruby/blob/trunk/test/ruby/test_variable.rb#L74
     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::TestCas https://github.com/ruby/ruby/blob/trunk/test/ruby/test_variable.rb#L84
         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::TestCas https://github.com/ruby/ruby/blob/trunk/test/ruby/test_variable.rb#L104
   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

--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]