From b1f4222fc55ffa37496645a02dbe2a4f103b5d5b Mon Sep 17 00:00:00 2001 From: Jean Boussier Date: Sat, 10 Aug 2024 11:50:44 +0200 Subject: [PATCH] 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. --- test/ruby/test_parse.rb | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/test/ruby/test_parse.rb b/test/ruby/test_parse.rb index dbd9f5cf09..736bc39d8a 100644 --- a/test/ruby/test_parse.rb +++ b/test/ruby/test_parse.rb @@ -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;