From 43384ae9788be243746849ee54d9f5c8f7e0412b Mon Sep 17 00:00:00 2001 From: ko1 Date: Thu, 10 Aug 2017 02:58:36 +0000 Subject: 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 --- test/ruby/test_fiber.rb | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'test/ruby') 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 -- cgit v1.2.3