diff options
author | eregon <eregon@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2017-12-12 18:44:49 +0000 |
---|---|---|
committer | eregon <eregon@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2017-12-12 18:44:49 +0000 |
commit | 15689ed7780b06ddc14cde4f427de834177283a5 (patch) | |
tree | bed64f4fdaf3e1a140642bdd0354384ae286759c /test/ruby/test_fiber.rb | |
parent | 967eab83e333430600926366621aa3a978701c6a (diff) | |
download | ruby-15689ed7780b06ddc14cde4f427de834177283a5.tar.gz |
Fix test-all tests to avoid creating report_on_exception warnings
* The warnings are shown by Thread.report_on_exception defaulting to
true. [Feature #14143] [ruby-core:83979]
* Improves tests by narrowing down the scope where an exception
is expected.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61188 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/ruby/test_fiber.rb')
-rw-r--r-- | test/ruby/test_fiber.rb | 19 |
1 files changed, 10 insertions, 9 deletions
diff --git a/test/ruby/test_fiber.rb b/test/ruby/test_fiber.rb index 92c9961259..7b513a11fa 100644 --- a/test/ruby/test_fiber.rb +++ b/test/ruby/test_fiber.rb @@ -70,10 +70,12 @@ class TestFiber < Test::Unit::TestCase assert_raise(ArgumentError){ Fiber.new # Fiber without block } - assert_raise(FiberError){ - f = Fiber.new{} - Thread.new{f.resume}.join # Fiber yielding across thread - } + f = Fiber.new{} + Thread.new{ + assert_raise(FiberError){ # Fiber yielding across thread + f.resume + } + }.join assert_raise(FiberError){ f = Fiber.new{} f.resume @@ -199,11 +201,11 @@ class TestFiber < Test::Unit::TestCase end def test_resume_root_fiber - assert_raise(FiberError) do - Thread.new do + Thread.new do + assert_raise(FiberError) do Fiber.current.resume - end.join - end + end + end.join end def test_gc_root_fiber @@ -377,4 +379,3 @@ class TestFiber < Test::Unit::TestCase assert_match(/resumed/, Fiber.current.to_s) end end - |