From 64ffdb44402f365198ba45c84fa15e449f3411e6 Mon Sep 17 00:00:00 2001 From: ko1 Date: Tue, 5 Jun 2007 17:55:07 +0000 Subject: * cont.c (rb_fiber_start): clear th->tag and check error to fix [ruby-dev:30888] and [ruby-dev:30889]. * eval_intern.h: fix rb_fiber_start() prototype. * test/ruby/test_fiber.rb: add tests for above. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@12443 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- test/ruby/test_fiber.rb | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'test/ruby/test_fiber.rb') diff --git a/test/ruby/test_fiber.rb b/test/ruby/test_fiber.rb index 999bfd267a..97ec09c36b 100644 --- a/test/ruby/test_fiber.rb +++ b/test/ruby/test_fiber.rb @@ -69,5 +69,21 @@ class TestFiber < Test::Unit::TestCase assert_equal(:ok, f1.yield) assert_equal([:baz, :bar], ary) end + + def test_return + assert_raise(LocalJumpError){ + Fiber.new do + return + end.yield + } + end + + def test_throw + assert_raise(RuntimeError){ + Fiber.new do + throw :a + end.yield + } + end end -- cgit v1.2.3