diff options
Diffstat (limited to 'test/ruby/test_string.rb')
-rw-r--r-- | test/ruby/test_string.rb | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/test/ruby/test_string.rb b/test/ruby/test_string.rb index fdf23ad90b..2ccabcbe80 100644 --- a/test/ruby/test_string.rb +++ b/test/ruby/test_string.rb @@ -1249,6 +1249,10 @@ CODE assert_raise(ArgumentError) { S("foo").gsub } end + def test_gsub_gc_compact_stress + EnvUtil.under_gc_compact_stress { assert_equal(S("h<e>ll<o>"), S("hello").gsub(/([aeiou])/, S('<\1>'))) } + end + def test_gsub_encoding a = S("hello world") a.force_encoding Encoding::UTF_8 @@ -1292,6 +1296,14 @@ CODE assert_nil(a.sub!(S('X'), S('Y'))) end + def test_gsub_bang_gc_compact_stress + EnvUtil.under_gc_compact_stress do + a = S("hello") + a.gsub!(/([aeiou])/, S('<\1>')) + assert_equal(S("h<e>ll<o>"), a) + end + end + def test_sub_hash assert_equal('azc', S('abc').sub(/b/, "b" => "z")) assert_equal('ac', S('abc').sub(/b/, {})) |