summaryrefslogtreecommitdiff
path: root/test/fiber
diff options
context:
space:
mode:
authorDelton Ding <dsh0416@gmail.com>2020-12-22 15:30:59 +0900
committerKoichi Sasada <ko1@atdot.net>2020-12-23 03:27:14 +0900
commitc6d7e02b90f96d9bcd04edd48b7374f31c510b2a (patch)
tree294b80840d1c00a9f9117f1608cc8abd7599f6ba /test/fiber
parent487355873ad0de9ab70611d63d97f3fbbfebe79d (diff)
Enable `Fiber.current` and `Fiber#alive?` call inside ractor
Notes
Notes: Merged: https://github.com/ruby/ruby/pull/3971
Diffstat (limited to 'test/fiber')
-rw-r--r--test/fiber/test_ractor.rb22
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