From c5d7d78daeb44b4c5ad7a9b624638ffd1be96135 Mon Sep 17 00:00:00 2001 From: ko1 Date: Fri, 13 Feb 2009 06:04:25 +0000 Subject: * cont.c (rb_fiber_alive_p): fix to return true instead of 1. [ruby-dev:37991] * test/ruby/test_fiber.rb: add a test for Fiber#alive? git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@22274 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- test/ruby/test_fiber.rb | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'test/ruby') diff --git a/test/ruby/test_fiber.rb b/test/ruby/test_fiber.rb index bf56b2b6d2..536d358dd0 100644 --- a/test/ruby/test_fiber.rb +++ b/test/ruby/test_fiber.rb @@ -164,5 +164,14 @@ class TestFiber < Test::Unit::TestCase assert_equal(nil, Thread.current[:v]); fb.resume assert_equal(nil, Thread.current[:v]); end + + def test_alive + fib = Fiber.new{Fiber.yield} + assert_equal(true, fib.alive?) + fib.resume + assert_equal(true, fib.alive?) + fib.resume + assert_equal(false, fib.alive?) + end end -- cgit v1.2.3