diff options
author | Koichi Sasada <ko1@atdot.net> | 2020-12-21 01:13:39 +0900 |
---|---|---|
committer | Koichi Sasada <ko1@atdot.net> | 2020-12-21 01:13:39 +0900 |
commit | 730f314171e67d981887c061d5dabf927ff5efd5 (patch) | |
tree | 8c6c8f3b416b385874b532552f8f753d9ec71cf5 /bootstraptest/test_ractor.rb | |
parent | 8680ae9cbd6e7e7e08f6d21fa8d35abdc82342da (diff) |
fix Ractor.make_shareable() with Class/Module
To check shareable-ness, rb_ractor_shareable_p() is needed
for Class/Module objects isntead of checking flags.
Diffstat (limited to 'bootstraptest/test_ractor.rb')
-rw-r--r-- | bootstraptest/test_ractor.rb | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/bootstraptest/test_ractor.rb b/bootstraptest/test_ractor.rb index c587c2c1eb..797ad0a3ee 100644 --- a/bootstraptest/test_ractor.rb +++ b/bootstraptest/test_ractor.rb @@ -1149,6 +1149,14 @@ assert_equal '[:ok, false, false]', %q{ [(Ractor.make_shareable(x) rescue :ok), Ractor.shareable?(x), Ractor.shareable?(y)] } +# Ractor.make_shareable with Class/Module +assert_equal '[C, M]', %q{ + class C; end + module M; end + + Ractor.make_shareable(ary = [C, M]) +} + # define_method() can invoke different Ractor's proc if the proc is shareable. assert_equal '1', %q{ class C @@ -1191,7 +1199,6 @@ assert_equal '[false, false, true, true]', %q{ r } - # Ractor deep copies frozen objects (ary) assert_equal '[true, false]', %q{ Ractor.new([[]].freeze) { |ary| |