From 33a026fedd43fa5472937e77834397742fed6180 Mon Sep 17 00:00:00 2001 From: Benoit Daloze Date: Sat, 1 Nov 2025 11:38:16 +0100 Subject: Fix the description and logic for the Ractor.make_shareable(Proc) test --- bootstraptest/test_ractor.rb | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/bootstraptest/test_ractor.rb b/bootstraptest/test_ractor.rb index fef55ffd68..a437faeac1 100644 --- a/bootstraptest/test_ractor.rb +++ b/bootstraptest/test_ractor.rb @@ -1187,16 +1187,19 @@ assert_equal 'true', %q{ [a.frozen?, a[0].frozen?] == [true, false] } -# Ractor.make_shareable(a_proc) is not supported now. -assert_equal 'true', %q{ - pr = Proc.new{} +# Ractor.make_shareable(a_proc) requires a shareable receiver +assert_equal '[:ok, :error]', %q{ + pr1 = nil.instance_exec { Proc.new{} } + pr2 = Proc.new{} - begin - Ractor.make_shareable(pr) - rescue Ractor::Error - true - else - false + [pr1, pr2].map do |pr| + begin + Ractor.make_shareable(pr) + rescue Ractor::Error + :error + else + :ok + end end } -- cgit v1.2.3