diff options
Diffstat (limited to 'test/ruby')
| -rw-r--r-- | test/ruby/test_iseq.rb | 2 | ||||
| -rw-r--r-- | test/ruby/test_ractor.rb | 18 |
2 files changed, 19 insertions, 1 deletions
diff --git a/test/ruby/test_iseq.rb b/test/ruby/test_iseq.rb index fa716787fe..6846f7958b 100644 --- a/test/ruby/test_iseq.rb +++ b/test/ruby/test_iseq.rb @@ -157,7 +157,7 @@ class TestISeq < Test::Unit::TestCase def test_ractor_unshareable_outer_variable name = "\u{2603 26a1}" - assert_raise_with_message(ArgumentError, /\(#{name}\)/) do + assert_raise_with_message(Ractor::IsolationError, /\(#{name}\)/) do eval("#{name} = nil; Ractor.shareable_proc{#{name} = nil}") end diff --git a/test/ruby/test_ractor.rb b/test/ruby/test_ractor.rb index 6ae511217a..36467a3591 100644 --- a/test/ruby/test_ractor.rb +++ b/test/ruby/test_ractor.rb @@ -213,6 +213,24 @@ class TestRactor < Test::Unit::TestCase assert_unshareable(pr, /not supported yet/, exception: RuntimeError) end + def test_ractor_new_raises_isolation_error_if_outer_variables_are_accessed + assert_raise(Ractor::IsolationError) do + channel = Ractor::Port.new + Ractor.new(channel) do + inbound_work = Ractor::Port.new + channel << inbound_work + end + end + end + + def test_ractor_new_raises_isolation_error_if_proc_uses_yield + assert_raise(Ractor::IsolationError) do + Ractor.new do + yield + end + end + end + def assert_make_shareable(obj) refute Ractor.shareable?(obj), "object was already shareable" Ractor.make_shareable(obj) |
