diff options
author | rm155 <86454369+rm155@users.noreply.github.com> | 2021-08-20 08:12:28 -0400 |
---|---|---|
committer | Hiroshi SHIBATA <hsbt@ruby-lang.org> | 2021-09-28 17:30:06 +0900 |
commit | cefa02957312620187cfd81219650304032ae787 (patch) | |
tree | e1dfdb34a3dbc9e59de32b2a3a8a7500c1d726e0 /test | |
parent | 83662f1d9968204a43adf4a94d6872967b65f712 (diff) |
[ruby/ostruct] Allow properties to be accessed even when the object is moved to another Ractor (https://github.com/ruby/ostruct/pull/29)
https://github.com/ruby/ostruct/commit/d85639f2f5
Diffstat (limited to 'test')
-rw-r--r-- | test/ostruct/test_ostruct.rb | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/test/ostruct/test_ostruct.rb b/test/ostruct/test_ostruct.rb index 1fd7d87811..4ec4d43084 100644 --- a/test/ostruct/test_ostruct.rb +++ b/test/ostruct/test_ostruct.rb @@ -368,6 +368,18 @@ class TC_OpenStruct < Test::Unit::TestCase RUBY end if defined?(Ractor) + def test_access_methods_from_different_ractor + assert_ractor(<<~RUBY, require: 'ostruct') + os = OpenStruct.new + os.value = 100 + r = Ractor.new(os) do |x| + v = x.value + Ractor.yield v + end + assert 100 == r.take + RUBY + end if defined?(Ractor) + def test_legacy_yaml s = "--- !ruby/object:OpenStruct\ntable:\n :foo: 42\n" o = YAML.safe_load(s, permitted_classes: [Symbol, OpenStruct]) |