mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* 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
This commit is contained in:
parent
5f05c269e9
commit
64ffdb4440
4 changed files with 32 additions and 2 deletions
|
@ -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
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue