[ruby/ostruct] Add Ractor test

This commit is contained in:
Marc-Andre Lafortune 2020-12-19 12:19:06 -05:00 committed by Marc-André Lafortune
parent 67e062b523
commit 6343a81129
Notes: git 2020-12-20 07:13:34 +09:00

View File

@ -300,19 +300,18 @@ class TC_OpenStruct < Test::Unit::TestCase
assert_equal 42, o.foo assert_equal 42, o.foo
end end
=begin
# now Ractor should not use in test-all process
def test_ractor def test_ractor
obj1 = OpenStruct.new(a: 42, b: 42) assert_ractor(<<~RUBY, require: 'ostruct')
obj1.c = 42 obj1 = OpenStruct.new(a: 42, b: 42)
obj1.freeze obj1.c = 42
obj1.freeze
obj2 = Ractor.new obj1 do |obj| obj2 = Ractor.new obj1 do |obj|
obj obj
end.take end.take
assert obj1.object_id == obj2.object_id assert obj1.object_id == obj2.object_id
end if defined?(Ractor) RUBY
=end end
def test_legacy_yaml def test_legacy_yaml
s = "--- !ruby/object:OpenStruct\ntable:\n :foo: 42\n" s = "--- !ruby/object:OpenStruct\ntable:\n :foo: 42\n"