diff options
author | ko1 <ko1@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2007-06-15 03:20:13 +0000 |
---|---|---|
committer | ko1 <ko1@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2007-06-15 03:20:13 +0000 |
commit | 31ac946975a8e20157e1f47d23546ae237484024 (patch) | |
tree | 8f1e89f4b9634c665102ae5a745f4af38802bc3b /test/ruby/test_fiber.rb | |
parent | f84c8cb19079cbfe2b5433a7b3e1eca4eae3ef22 (diff) | |
download | ruby-31ac946975a8e20157e1f47d23546ae237484024.tar.gz |
* cont.c (rb_cont_call): forbid cross fiber continuation call.
* test/ruby/test_fiber.rb: ditto.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@12542 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/ruby/test_fiber.rb')
-rw-r--r-- | test/ruby/test_fiber.rb | 30 |
1 files changed, 6 insertions, 24 deletions
diff --git a/test/ruby/test_fiber.rb b/test/ruby/test_fiber.rb index 6c67a5815d..d6212cc7ea 100644 --- a/test/ruby/test_fiber.rb +++ b/test/ruby/test_fiber.rb @@ -70,6 +70,12 @@ class TestFiber < Test::Unit::TestCase f.yield f.yield } + assert_raise(RuntimeError){ + f = Fiber.new{ + @c = callcc{|c| @c = c} + }.yield + @c.call # cross fiber callcc + } end def test_loop @@ -102,29 +108,5 @@ class TestFiber < Test::Unit::TestCase end.yield } end - - def test_with_callcc - c = nil - f1 = f2 = nil - f1 = Fiber.new do - callcc do |c2| - c = c2 - f2.yield - end - :ok - end - f2 = Fiber.new do - c.call - end - assert_equal(:ok, f1.yield) - - assert_equal(:ok, - callcc {|c| - Fiber.new { - c.call :ok - }.yield - } - ) - end end |