From eaf74a2060dd53de038f9a665f5f5e77c1f65363 Mon Sep 17 00:00:00 2001 From: ko1 Date: Fri, 15 Jun 2007 03:20:13 +0000 Subject: * cont.c (rb_cont_call): forbid cross fiber continuation call. * test/ruby/test_fiber.rb: ditto. git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@12542 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- test/ruby/test_fiber.rb | 30 ++++++------------------------ 1 file changed, 6 insertions(+), 24 deletions(-) (limited to 'test') diff --git a/test/ruby/test_fiber.rb b/test/ruby/test_fiber.rb index 6c67a5815..d6212cc7e 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 -- cgit