From a5819b5b2510556de0719317662d96096ce4089a Mon Sep 17 00:00:00 2001 From: TSUYUSATO Kitsune Date: Mon, 22 May 2023 11:27:34 +0900 Subject: Allow the match cache optimization for atomic groups (#7804) --- test/ruby/test_regexp.rb | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'test') diff --git a/test/ruby/test_regexp.rb b/test/ruby/test_regexp.rb index d04b9cf766..0a72caba45 100644 --- a/test/ruby/test_regexp.rb +++ b/test/ruby/test_regexp.rb @@ -1760,6 +1760,16 @@ class TestRegexp < Test::Unit::TestCase end; end + def test_match_cache_atomic + assert_separately([], "#{<<-"begin;"}\n#{<<-'end;'}") + timeout = #{ EnvUtil.apply_timeout_scale(10).inspect } + begin; + Regexp.timeout = timeout + + assert_nil(/^(?>a?a?)(a|a)*$/ =~ "a" * 1000000 + "x") + end; + end + def test_cache_opcodes_initialize str = 'test1-test2-test3-test4-test_5' re = '^([0-9a-zA-Z\-/]*){1,256}$' -- cgit v1.2.3