aboutsummaryrefslogtreecommitdiffstats
path: root/test/ruby
diff options
context:
space:
mode:
authorNobuyoshi Nakada <nobu@ruby-lang.org>2020-12-19 20:42:58 +0900
committerNobuyoshi Nakada <nobu@ruby-lang.org>2020-12-23 13:50:42 +0900
commit7a094146e6ef38453a7e475450d90a9c83ea2277 (patch)
treedae133999b6504425ff1c9082974d813b7404b54 /test/ruby
parentf14aaa2b1282d6dea9fad3d050e65828f1e269e1 (diff)
downloadruby-7a094146e6ef38453a7e475450d90a9c83ea2277.tar.gz
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`.
Diffstat (limited to 'test/ruby')
-rw-r--r--test/ruby/test_parse.rb12
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