diff options
author | Nobuyoshi Nakada <nobu@ruby-lang.org> | 2020-12-19 20:42:58 +0900 |
---|---|---|
committer | Nobuyoshi Nakada <nobu@ruby-lang.org> | 2020-12-23 13:50:42 +0900 |
commit | 7a094146e6ef38453a7e475450d90a9c83ea2277 (patch) | |
tree | dae133999b6504425ff1c9082974d813b7404b54 /test | |
parent | f14aaa2b1282d6dea9fad3d050e65828f1e269e1 (diff) |
Changed shareable literal semantics [Feature #17397]
When `literal`, check if the literal about to be assigned to a
constant is ractor-shareable, otherwise raise `Ractor::Error` at
runtime instead of `SyntaxError`.
Notes
Notes:
Merged: https://github.com/ruby/ruby/pull/3950
Diffstat (limited to 'test')
-rw-r--r-- | test/ruby/test_parse.rb | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/test/ruby/test_parse.rb b/test/ruby/test_parse.rb index ecacdebc70..0a1e3edc66 100644 --- a/test/ruby/test_parse.rb +++ b/test/ruby/test_parse.rb @@ -1213,11 +1213,13 @@ x = __ENCODING__ assert_equal([1], a[0]) assert_send([Ractor, :shareable?, a[0]]) - assert_syntax_error("#{<<~"begin;"}\n#{<<~'end;'}", /unshareable expression/) - begin; - # shareable_constant_value: literal - C = ["Not " + "shareable"] - end; + assert_raise_with_message(Ractor::Error, /unshareable/) do + Class.new.class_eval("#{<<~"begin;"}\n#{<<~'end;'}") + begin; + # shareable_constant_value: literal + C = ["Not " + "shareable"] + end; + end end =begin |