diff options
author | Delton Ding <[email protected]> | 2020-12-22 15:30:59 +0900 |
---|---|---|
committer | Koichi Sasada <[email protected]> | 2020-12-23 03:27:14 +0900 |
commit | c6d7e02b90f96d9bcd04edd48b7374f31c510b2a (patch) | |
tree | 294b80840d1c00a9f9117f1608cc8abd7599f6ba /test | |
parent | 487355873ad0de9ab70611d63d97f3fbbfebe79d (diff) |
Enable `Fiber.current` and `Fiber#alive?` call inside ractor
Notes
Notes:
Merged: https://github.com/ruby/ruby/pull/3971
Diffstat (limited to 'test')
-rw-r--r-- | test/fiber/test_ractor.rb | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/test/fiber/test_ractor.rb b/test/fiber/test_ractor.rb new file mode 100644 index 0000000000..6d53b617d9 --- /dev/null +++ b/test/fiber/test_ractor.rb @@ -0,0 +1,22 @@ +# frozen_string_literal: true +require "test/unit" +require "fiber" + +class TestFiberCurrentRactor < Test::Unit::TestCase + def setup + skip unless defined? Ractor + end + + def test_ractor_shareable + assert_separately([], "#{<<~"begin;"}\n#{<<~'end;'}") + begin; + require "fiber" + r = Ractor.new do + Fiber.new do + Fiber.current.class + end.resume + end + assert_equal(Fiber, r.take) + end; + end +end |