Cherry-pick test for [Bug #20668]

The bug didn't impact master because this was largely refactored,
but it's still valuable to add the test for it to prevent future
regressions.
This commit is contained in:
Jean Boussier 2024-08-10 11:50:44 +02:00
parent ad23bbe574
commit b1f4222fc5
Notes: git 2024-08-10 10:41:54 +00:00

View File

@ -1575,6 +1575,21 @@ x = __ENCODING__
assert_equal(2, b[1], bug_20341)
end
def test_shareable_constant_value_literal_const_refs
a = eval_separately("#{<<~"begin;"}\n#{<<~'end;'}")
begin;
# shareable_constant_value: literal
# [Bug #20668]
SOME_CONST = {
'Object' => Object,
'String' => String,
'Array' => Array,
}
SOME_CONST
end;
assert_ractor_shareable(a)
end
def test_shareable_constant_value_nested
a, b = eval_separately("#{<<~"begin;"}\n#{<<~'end;'}")
begin;