diff options
author | akr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2014-06-01 15:41:42 +0000 |
---|---|---|
committer | akr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2014-06-01 15:41:42 +0000 |
commit | 20e6b3a3b865f3c0ff0bd777e81c725e8ebf2fc4 (patch) | |
tree | 8fa100a35fd1d91dfafa05623fa584c5710501c6 /test/ruby/test_autoload.rb | |
parent | 9b0ea861ab56ec498ee3bc83d2dd5c187f99b06b (diff) |
Use EnvUtil.suppress_warning.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@46300 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/ruby/test_autoload.rb')
-rw-r--r-- | test/ruby/test_autoload.rb | 60 |
1 files changed, 28 insertions, 32 deletions
diff --git a/test/ruby/test_autoload.rb b/test/ruby/test_autoload.rb index 9e86b0722c..867aa066dd 100644 --- a/test/ruby/test_autoload.rb +++ b/test/ruby/test_autoload.rb @@ -74,46 +74,42 @@ p Foo::Bar 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 |