ruby-changes:64502
From: Nobuyoshi <ko1@a...>
Date: Wed, 23 Dec 2020 13:51:04 +0900 (JST)
Subject: [ruby-changes:64502] b2aa21b868 (master): Split the test
https://git.ruby-lang.org/ruby.git/commit/?id=b2aa21b868 From b2aa21b868419c2d87e2812b6b3584a8a1479c23 Mon Sep 17 00:00:00 2001 From: Nobuyoshi Nakada <nobu@r...> Date: Mon, 21 Dec 2020 15:15:35 +0900 Subject: Split the test diff --git a/test/ruby/test_parse.rb b/test/ruby/test_parse.rb index c39818e..8d12538 100644 --- a/test/ruby/test_parse.rb +++ b/test/ruby/test_parse.rb @@ -1192,13 +1192,19 @@ x = __ENCODING__ https://github.com/ruby/ruby/blob/trunk/test/ruby/test_parse.rb#L1192 assert !Ractor.shareable?(obj), ->{"Expected #{mu_pp(obj)} not to be ractor shareable"} end - def test_shareable_constant_value + def test_shareable_constant_value_invalid assert_warning(/invalid value/) do assert_valid_syntax("# shareable_constant_value: invalid-option", verbose: true) end + end + + def test_shareable_constant_value_ignored assert_warning(/ignored/) do assert_valid_syntax("nil # shareable_constant_value: true", verbose: true) end + end + + def test_shareable_constant_value_simple a, b, c = eval_separately("#{<<~"begin;"}\n#{<<~'end;'}") begin; # shareable_constant_value: experimental_everything @@ -1216,7 +1222,9 @@ x = __ENCODING__ https://github.com/ruby/ruby/blob/trunk/test/ruby/test_parse.rb#L1222 assert_ractor_shareable(c) assert_equal([1], a[0]) assert_ractor_shareable(a[0]) + end + def test_shareable_constant_value_nested a, b = eval_separately("#{<<~"begin;"}\n#{<<~'end;'}") begin; # shareable_constant_value: none @@ -1232,13 +1240,17 @@ x = __ENCODING__ https://github.com/ruby/ruby/blob/trunk/test/ruby/test_parse.rb#L1240 assert_not_ractor_shareable(b) assert_equal([1], a[0]) assert_ractor_shareable(a[0]) + end + def test_shareable_constant_value_unshareable_literal assert_ractor_error(/unshareable/, "#{<<~"begin;"}\n#{<<~'end;'}") begin; # shareable_constant_value: literal C = ["Not " + "shareable"] end; + end + def test_shareable_constant_value_nonliteral c, d = eval_separately("#{<<~"begin;"}\n#{<<~'end;'}") begin; # shareable_constant_value: literal @@ -1249,7 +1261,9 @@ x = __ENCODING__ https://github.com/ruby/ruby/blob/trunk/test/ruby/test_parse.rb#L1261 end; assert_not_ractor_shareable(c) assert_not_ractor_shareable(d) + end + def test_shareable_constant_value_unfrozen assert_ractor_error(/does not freeze object correctly/, "#{<<~"begin;"}\n#{<<~'end;'}") begin; # shareable_constant_value: experimental_everything -- cgit v0.10.2 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/