diff options
author | Nobuyoshi Nakada <nobu@ruby-lang.org> | 2020-11-26 18:10:42 +0900 |
---|---|---|
committer | Nobuyoshi Nakada <nobu@ruby-lang.org> | 2020-12-14 19:19:16 +0900 |
commit | 332317472779554f991ffa5bad74c1255828cc21 (patch) | |
tree | a917cb5ec6dfb0e37d64b331b26be10c33303f7f /test | |
parent | 89e489d51d164cf22bce3a7580e5695da22fb347 (diff) |
Support shareable_constant_value: literal
Notes
Notes:
Merged: https://github.com/ruby/ruby/pull/3681
Diffstat (limited to 'test')
-rw-r--r-- | test/ruby/test_parse.rb | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/test/ruby/test_parse.rb b/test/ruby/test_parse.rb index 61551a2c96..80debd7699 100644 --- a/test/ruby/test_parse.rb +++ b/test/ruby/test_parse.rb @@ -1187,11 +1187,14 @@ x = __ENCODING__ A = [[1]] # shareable_constant_value: none B = [[2]] + # shareable_constant_value: literal + C = [["shareable", "constant#{nil}"]] - [A, B] + [A, B, C] end; assert_send([Ractor, :shareable?, a]) assert_not_send([Ractor, :shareable?, b]) + assert_send([Ractor, :shareable?, c]) assert_equal([1], a[0]) assert_send([Ractor, :shareable?, a[0]]) a, b = Class.new.class_eval("#{<<~"begin;"}\n#{<<~'end;'}") @@ -1208,6 +1211,12 @@ x = __ENCODING__ assert_not_send([Ractor, :shareable?, b]) 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; end =begin |