summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorNARUSE, Yui <nurse@users.noreply.github.com>2024-03-20 20:00:47 +0900
committerGitHub <noreply@github.com>2024-03-20 11:00:47 +0000
commit7ae8abc23961bf4fa143a7a2cc0bc38167d468ae (patch)
treea6b394c23f85b719d125f0cdf8364b79ca5542a1 /test
parentbd42c1725a3bba0f97831aa3dbaa6924f506a5f3 (diff)
merge revision(s) bb59696614083660241ef272f222628cbfa95844: [Backport #20098] (#10298)
Fix [Bug #20098]: set counter value for {n,m} repetition correctly (#9391)
Diffstat (limited to 'test')
-rw-r--r--test/ruby/test_regexp.rb8
1 files changed, 8 insertions, 0 deletions
diff --git a/test/ruby/test_regexp.rb b/test/ruby/test_regexp.rb
index 91a9f0a96c..0d6ab4682d 100644
--- a/test/ruby/test_regexp.rb
+++ b/test/ruby/test_regexp.rb
@@ -2008,6 +2008,14 @@ class TestRegexp < Test::Unit::TestCase
end
end
+ def test_bug_20098 # [Bug #20098]
+ assert /a((.|.)|bc){,4}z/.match? 'abcbcbcbcz'
+ assert /a(b+?c*){4,5}z/.match? 'abbbccbbbccbcbcz'
+ assert /a(b+?(.|.)){2,3}z/.match? 'abbbcbbbcbbbcz'
+ assert /a(b*?(.|.)[bc]){2,5}z/.match? 'abcbbbcbcccbcz'
+ assert /^(?:.+){2,4}?b|b/.match? "aaaabaa"
+ end
+
def test_linear_time_p
assert_send [Regexp, :linear_time?, /a/]
assert_send [Regexp, :linear_time?, 'a']