Project

General

Profile

Feature #4326 » fiber.patch

tenderlovemaking (Aaron Patterson), 01/26/2011 04:08 PM

View differences:

cont.c
rb_define_singleton_method(rb_cFiber, "yield", rb_fiber_s_yield, -1);
rb_define_method(rb_cFiber, "initialize", rb_fiber_init, 0);
rb_define_method(rb_cFiber, "resume", rb_fiber_m_resume, -1);
rb_define_method(rb_cFiber, "call", rb_fiber_m_resume, -1);
rb_define_method(rb_cFiber, "[]", rb_fiber_m_resume, -1);
}
#if defined __GNUC__ && __GNUC__ >= 4
test/ruby/test_fiber.rb
require_relative './envutil'
class TestFiber < Test::Unit::TestCase
def test_call
Fiber.new { |e| assert_equal(:ok1, e) }.call(:ok1)
end
def test_brackets
Fiber.new { |e| assert_equal(:ok1, e) }[:ok1]
end
def test_normal
f = Fiber.current
assert_equal(:ok2,
(1-1/2)