summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/ruby/test_fiber.rb16
1 files changed, 16 insertions, 0 deletions
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