diff options
| author | Nery Campusano <nery.campusano@shopify.com> | 2026-02-12 16:35:26 -0500 |
|---|---|---|
| committer | Koichi Sasada <ko1@atdot.net> | 2026-02-13 11:01:50 +0900 |
| commit | be8f647bdab59d16554900c16c101e453863918d (patch) | |
| tree | affef95cc885f1224247a27154e1887548a09a93 /test/ruby | |
| parent | 2233822f3fb6583df4740dd88feaa337f49f05a6 (diff) | |
[Bug #21551] changing the exception to be isolationerror rather than argument error
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) |
