summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorMarc-Andre Lafortune <github@marc-andre.ca>2020-09-25 21:17:06 -0400
committerMarc-André Lafortune <github@marc-andre.ca>2020-09-30 18:11:24 -0400
commit0977040133c53be92713e9054b491a0b3649e148 (patch)
treefdf72b3ab46bd7c5b240f51670057c6f30b41402 /test
parent083fa6e5d22ea7eb9026a4e33e31a1d8abbce7f8 (diff)
[ruby/ostruct] Add test that frozen OpenStructs are Ractor-shareable
Notes
Notes: Merged: https://github.com/ruby/ruby/pull/3593
Diffstat (limited to 'test')
-rw-r--r--test/ostruct/test_ostruct.rb11
1 files changed, 11 insertions, 0 deletions
diff --git a/test/ostruct/test_ostruct.rb b/test/ostruct/test_ostruct.rb
index 6105f37c42..5de6f278d0 100644
--- a/test/ostruct/test_ostruct.rb
+++ b/test/ostruct/test_ostruct.rb
@@ -298,4 +298,15 @@ class TC_OpenStruct < Test::Unit::TestCase
o.foo = 42
assert_equal 42, o.foo
end
+
+ def test_ractor
+ obj1 = OpenStruct.new(a: 42, b: 42)
+ obj1.c = 42
+ obj1.freeze
+
+ obj2 = Ractor.new obj1 do |obj|
+ obj
+ end.take
+ assert obj1.object_id == obj2.object_id
+ end if defined?(Ractor)
end