summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNobuyoshi Nakada <nobu@ruby-lang.org>2020-12-21 15:15:35 +0900
committerNobuyoshi Nakada <nobu@ruby-lang.org>2020-12-23 13:50:42 +0900
commitb2aa21b868419c2d87e2812b6b3584a8a1479c23 (patch)
tree632b5ad0c89cb06630c73a946026843fd24919b7
parentd1c7db9d003fe2f989e1cd2f55698a900291b48a (diff)
Split the test
Notes
Notes: Merged: https://github.com/ruby/ruby/pull/3950
-rw-r--r--test/ruby/test_parse.rb16
1 files changed, 15 insertions, 1 deletions
diff --git a/test/ruby/test_parse.rb b/test/ruby/test_parse.rb
index c39818ebf3..8d12538fa3 100644
--- a/test/ruby/test_parse.rb
+++ b/test/ruby/test_parse.rb
@@ -1192,13 +1192,19 @@ x = __ENCODING__
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__
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__
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__
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