summaryrefslogtreecommitdiff
path: root/test/ruby
diff options
context:
space:
mode:
authorPeter Zhu <peter@peterzhu.ca>2023-11-27 14:45:47 -0500
committerPeter Zhu <peter@peterzhu.ca>2023-11-27 16:49:52 -0500
commit94015e0dce38d238d428b60b46dcb9f3caef445f (patch)
treee3075cd2f0fcd8d77cf03686ae84b5ceeec04387 /test/ruby
parent1acea5010023deb0b4747e6c7309c4d69bdaf47d (diff)
Guard match from GC when scanning string
We need to guard match from GC because otherwise it could end up being reclaimed or moved in compaction.
Diffstat (limited to 'test/ruby')
-rw-r--r--test/ruby/test_string.rb4
1 files changed, 4 insertions, 0 deletions
diff --git a/test/ruby/test_string.rb b/test/ruby/test_string.rb
index 22bec09855..fdf23ad90b 100644
--- a/test/ruby/test_string.rb
+++ b/test/ruby/test_string.rb
@@ -1622,6 +1622,10 @@ CODE
assert_equal(%w[1 2 3], S("a1 a2 a3").scan(/a\K./))
end
+ def test_scan_gc_compact_stress
+ EnvUtil.under_gc_compact_stress { assert_equal([["1a"], ["2b"], ["3c"]], S("1a2b3c").scan(/(\d.)/)) }
+ end
+
def test_scan_segv
bug19159 = '[Bug #19159]'
assert_nothing_raised(Exception, bug19159) do