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

ruby-changes:34201

From: akr <ko1@a...>
Date: Mon, 2 Jun 2014 09:02:10 +0900 (JST)
Subject: [ruby-changes:34201] akr:r46300 (trunk): Use EnvUtil.suppress_warning.

akr	2014-06-02 00:41:42 +0900 (Mon, 02 Jun 2014)

  New Revision: 46300

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

  Log:
    Use EnvUtil.suppress_warning.

  Modified files:
    trunk/test/ruby/test_autoload.rb
Index: test/ruby/test_autoload.rb
===================================================================
--- test/ruby/test_autoload.rb	(revision 46299)
+++ test/ruby/test_autoload.rb	(revision 46300)
@@ -74,46 +74,42 @@ p Foo::Bar https://github.com/ruby/ruby/blob/trunk/test/ruby/test_autoload.rb#L74
 
   def test_threaded_accessing_constant
     # Suppress "warning: loading in progress, circular require considered harmful"
-    old_verbose = $VERBOSE
-    $VERBOSE = false
-    Tempfile.create(['autoload', '.rb']) {|file|
-      file.puts 'sleep 0.5; class AutoloadTest; X = 1; end'
-      file.close
-      add_autoload(file.path)
-      begin
-        assert_nothing_raised do
-          t1 = Thread.new { ::AutoloadTest::X }
-          t2 = Thread.new { ::AutoloadTest::X }
-          [t1, t2].each(&:join)
+    EnvUtil.suppress_warning {
+      Tempfile.create(['autoload', '.rb']) {|file|
+        file.puts 'sleep 0.5; class AutoloadTest; X = 1; end'
+        file.close
+        add_autoload(file.path)
+        begin
+          assert_nothing_raised do
+            t1 = Thread.new { ::AutoloadTest::X }
+            t2 = Thread.new { ::AutoloadTest::X }
+            [t1, t2].each(&:join)
+          end
+        ensure
+          remove_autoload_constant
         end
-      ensure
-        remove_autoload_constant
-      end
+      }
     }
-  ensure
-    $VERBOSE = old_verbose
   end
 
   def test_threaded_accessing_inner_constant
     # Suppress "warning: loading in progress, circular require considered harmful"
-    old_verbose = $VERBOSE
-    $VERBOSE = false
-    Tempfile.create(['autoload', '.rb']) {|file|
-      file.puts 'class AutoloadTest; sleep 0.5; X = 1; end'
-      file.close
-      add_autoload(file.path)
-      begin
-        assert_nothing_raised do
-          t1 = Thread.new { ::AutoloadTest::X }
-          t2 = Thread.new { ::AutoloadTest::X }
-          [t1, t2].each(&:join)
+    EnvUtil.suppress_warning {
+      Tempfile.create(['autoload', '.rb']) {|file|
+        file.puts 'class AutoloadTest; sleep 0.5; X = 1; end'
+        file.close
+        add_autoload(file.path)
+        begin
+          assert_nothing_raised do
+            t1 = Thread.new { ::AutoloadTest::X }
+            t2 = Thread.new { ::AutoloadTest::X }
+            [t1, t2].each(&:join)
+          end
+        ensure
+          remove_autoload_constant
         end
-      ensure
-        remove_autoload_constant
-      end
+      }
     }
-  ensure
-    $VERBOSE = old_verbose
   end
 
   def test_nameerror_when_autoload_did_not_define_the_constant

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

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