summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/test_timeout.rb20
1 files changed, 20 insertions, 0 deletions
diff --git a/test/test_timeout.rb b/test/test_timeout.rb
index e367df757c..233f54eb82 100644
--- a/test/test_timeout.rb
+++ b/test/test_timeout.rb
@@ -280,4 +280,24 @@ class TestTimeout < Test::Unit::TestCase
}.join
end;
end
+
+ def test_ractor
+ assert_separately(%w[-rtimeout -W0], <<-'end;')
+ r = Ractor.new do
+ Timeout.timeout(1) { 42 }
+ end.value
+
+ assert_equal 42, r
+
+ r = Ractor.new do
+ begin
+ Timeout.timeout(0.1) { sleep }
+ rescue Timeout::Error
+ :ok
+ end
+ end.value
+
+ assert_equal :ok, r
+ end;
+ end if Timeout.const_defined?(:RACTOR_SUPPORT)
end