ruby-changes:70788
From: Nobuyoshi <ko1@a...>
Date: Sat, 8 Jan 2022 15:50:15 +0900 (JST)
Subject: [ruby-changes:70788] 47a05f7c09 (master): Do not run the same tests twice
https://git.ruby-lang.org/ruby.git/commit/?id=47a05f7c09 From 47a05f7c097aa760d523abbc40e724b4ce2408d1 Mon Sep 17 00:00:00 2001 From: Nobuyoshi Nakada <nobu@r...> Date: Sat, 8 Jan 2022 00:36:36 +0900 Subject: Do not run the same tests twice --- test/ruby/test_string.rb | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/test/ruby/test_string.rb b/test/ruby/test_string.rb index 31f9a646a33..95fbf637025 100644 --- a/test/ruby/test_string.rb +++ b/test/ruby/test_string.rb @@ -97,6 +97,8 @@ class TestString < Test::Unit::TestCase https://github.com/ruby/ruby/blob/trunk/test/ruby/test_string.rb#L97 end def test_initialize_memory_leak + return unless @cls == String + assert_no_memory_leak([], <<-PREP, <<-CODE, rss: true) code = proc {('x'*100000).__send__(:initialize, '')} 1_000.times(&code) @@ -107,6 +109,8 @@ CODE https://github.com/ruby/ruby/blob/trunk/test/ruby/test_string.rb#L109 # Bug #18154 def test_initialize_nofree_memory_leak + return unless @cls == String + assert_no_memory_leak([], <<-PREP, <<-CODE, rss: true) code = proc {0.to_s.__send__(:initialize, capacity: 10000)} 1_000.times(&code) @@ -1764,6 +1768,8 @@ CODE https://github.com/ruby/ruby/blob/trunk/test/ruby/test_string.rb#L1768 end def test_fs + return unless @cls == String + assert_raise_with_message(TypeError, /\$;/) { $; = [] } @@ -2419,6 +2425,8 @@ CODE https://github.com/ruby/ruby/blob/trunk/test/ruby/test_string.rb#L2425 class S2 < String end def test_str_new4 + return unless @cls == String + s = (0..54).to_a.join # length = 100 s2 = S2.new(s[10,90]) s3 = s2[10,80] @@ -2621,10 +2629,13 @@ CODE https://github.com/ruby/ruby/blob/trunk/test/ruby/test_string.rb#L2629 assert_equal([S("abcdb"), S("c"), S("e")], S("abcdbce").rpartition(/b\Kc/)) end - def test_setter + def test_fs_setter + return unless @cls == String + assert_raise(TypeError) { $/ = 1 } name = "\u{5206 884c}" - assert_separately([], <<-"end;") # do + assert_separately([], "#{<<~"do;"}\n#{<<~"end;"}") + do; alias $#{name} $/ assert_raise_with_message(TypeError, /\\$#{name}/) { $#{name} = 1 } end; @@ -3127,6 +3138,8 @@ CODE https://github.com/ruby/ruby/blob/trunk/test/ruby/test_string.rb#L3138 end def test_eq_tilde_can_be_overridden + return unless @cls == String + assert_separately([], <<-RUBY) class String undef =~ @@ -3154,6 +3167,7 @@ CODE https://github.com/ruby/ruby/blob/trunk/test/ruby/test_string.rb#L3167 def test_LSHIFT_neary_long_max return unless @cls == String + assert_ruby_status([], <<-'end;', '[ruby-core:61886] [Bug #9709]', timeout: 20) begin a = "a" * 0x4000_0000 @@ -3188,6 +3202,8 @@ CODE https://github.com/ruby/ruby/blob/trunk/test/ruby/test_string.rb#L3202 end def test_uminus_frozen + return unless @cls == String + # embedded str1 = ("foobar" * 3).freeze str2 = ("foobar" * 3).freeze -- cgit v1.2.1 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/