ruby-changes:64501
From: Nobuyoshi <ko1@a...>
Date: Wed, 23 Dec 2020 13:51:03 +0900 (JST)
Subject: [ruby-changes:64501] d1c7db9d00 (master): Added assertions
https://git.ruby-lang.org/ruby.git/commit/?id=d1c7db9d00 From d1c7db9d003fe2f989e1cd2f55698a900291b48a Mon Sep 17 00:00:00 2001 From: Nobuyoshi Nakada <nobu@r...> Date: Mon, 21 Dec 2020 15:08:22 +0900 Subject: Added assertions diff --git a/test/ruby/test_parse.rb b/test/ruby/test_parse.rb index e957dab..c39818e 100644 --- a/test/ruby/test_parse.rb +++ b/test/ruby/test_parse.rb @@ -1222,7 +1222,8 @@ x = __ENCODING__ https://github.com/ruby/ruby/blob/trunk/test/ruby/test_parse.rb#L1222 # 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__ https://github.com/ruby/ruby/blob/trunk/test/ruby/test_parse.rb#L1238 # 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 -- cgit v0.10.2 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/