diff options
author | ko1 <ko1@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2017-08-10 02:58:36 +0000 |
---|---|---|
committer | ko1 <ko1@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2017-08-10 02:58:36 +0000 |
commit | 43384ae9788be243746849ee54d9f5c8f7e0412b (patch) | |
tree | e696a34c00d2d333a01e85e91e964e2f8a40e707 /test/ruby/test_fiber.rb | |
parent | 57199f2125ce8e2043420af6ccc3354e1d411c0f (diff) |
Fiber#to_s (#inspect) return richer information.
* cont.c (fiber_to_s): return with block and status information.
* proc.c (proc_to_s_): removed and introduce rb_block_to_s() function
to return block information string.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59558 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/ruby/test_fiber.rb')
-rw-r--r-- | test/ruby/test_fiber.rb | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/test/ruby/test_fiber.rb b/test/ruby/test_fiber.rb index ffcb02ce51..8fe2cf5be8 100644 --- a/test/ruby/test_fiber.rb +++ b/test/ruby/test_fiber.rb @@ -352,5 +352,17 @@ class TestFiber < Test::Unit::TestCase exit("1" == Fiber.new(&:to_s).resume(1)) end; end + + def test_to_s + f = Fiber.new do + assert_match(/resumed/, f.to_s) + Fiber.yield + end + assert_match(/created/, f.to_s) + f.resume + assert_match(/suspended/, f.to_s) + f.resume + assert_match(/terminated/, f.to_s) + end end |