diff options
author | Nobuyoshi Nakada <nobu@ruby-lang.org> | 2020-11-02 19:48:17 +0900 |
---|---|---|
committer | Nobuyoshi Nakada <nobu@ruby-lang.org> | 2020-12-14 19:19:16 +0900 |
commit | 7060aeedbd69c0888379cbf91f0bb2208bc59308 (patch) | |
tree | f3153ca57eec7182f4d1b931b0cc40cc39332901 /test/ruby | |
parent | 25cf1aca927946595b1325e4fde7f642bba2a706 (diff) |
shareable_constant_value: is effective only in comment-only line
Notes
Notes:
Merged: https://github.com/ruby/ruby/pull/3681
Diffstat (limited to 'test/ruby')
-rw-r--r-- | test/ruby/test_parse.rb | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/test/ruby/test_parse.rb b/test/ruby/test_parse.rb index 4b6f4222bc..8a644ad6a8 100644 --- a/test/ruby/test_parse.rb +++ b/test/ruby/test_parse.rb @@ -1178,26 +1178,27 @@ x = __ENCODING__ assert_warning(/invalid value/) do assert_valid_syntax("# shareable_constant_value: invalid-option", verbose: true) end + assert_warning(/ignored/) do + assert_valid_syntax("nil # shareable_constant_value: true", verbose: true) + end a, b, c = Class.new.class_eval("#{<<~"begin;"}\n#{<<~'end;'}") begin; # shareable_constant_value: true A = [[1]] # shareable_constant_value: false B = [[2]] - C = # shareable_constant_value: true - [[3]] - [A, B, C] + [A, B] 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;'}") begin; # shareable_constant_value: false - class X # shareable_constant_value: true + class X + # shareable_constant_value: true A = [[1]] end B = [] |