summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorNobuyoshi Nakada <nobu@ruby-lang.org>2020-12-21 15:08:22 +0900
committerNobuyoshi Nakada <nobu@ruby-lang.org>2020-12-23 13:50:42 +0900
commitd1c7db9d003fe2f989e1cd2f55698a900291b48a (patch)
tree4f1adbcf17802647efbb29bf0f7c57e5986fb050 /test
parent0c450b86476322ea4c407d0de4d7d1c5d8523126 (diff)
Added assertions
Notes
Notes: Merged: https://github.com/ruby/ruby/pull/3950
Diffstat (limited to 'test')
-rw-r--r--test/ruby/test_parse.rb22
1 files changed, 21 insertions, 1 deletions
diff --git a/test/ruby/test_parse.rb b/test/ruby/test_parse.rb
index e957dab06a..c39818ebf3 100644
--- a/test/ruby/test_parse.rb
+++ b/test/ruby/test_parse.rb
@@ -1222,7 +1222,8 @@ x = __ENCODING__
# shareable_constant_value: none
class X
# shareable_constant_value: experimental_everything
- A = [[1]]
+ var = [[1]]
+ A = var
end
B = []
[X::A, B]
@@ -1237,6 +1238,25 @@ x = __ENCODING__
# shareable_constant_value: literal
C = ["Not " + "shareable"]
end;
+
+ c, d = eval_separately("#{<<~"begin;"}\n#{<<~'end;'}")
+ begin;
+ # shareable_constant_value: literal
+ var = [:not_frozen]
+ C = var
+ D = begin [] end
+ [C, D]
+ end;
+ assert_not_ractor_shareable(c)
+ assert_not_ractor_shareable(d)
+
+ assert_ractor_error(/does not freeze object correctly/, "#{<<~"begin;"}\n#{<<~'end;'}")
+ begin;
+ # shareable_constant_value: experimental_everything
+ o = Object.new
+ def o.freeze; self; end
+ C = [o]
+ end;
end
=begin