summaryrefslogtreecommitdiff
path: root/test/ruby/test_regexp.rb
diff options
context:
space:
mode:
authorHiroya Fujinami <[email protected]>2024-02-13 09:53:03 +0900
committerGitHub <[email protected]>2024-02-13 09:53:03 +0900
commit4a6384ed9358e8fb8464f6e37efb5477182f01db (patch)
tree94dc5e5c12d5c6dd8f297ac8055c6942011ec5ea /test/ruby/test_regexp.rb
parent8a345860d3d16b3bca74caf8ee1b405287873eed (diff)
Fix [Bug #20246]: Don't set next_head_exact if a capture is called (#9897)
Diffstat (limited to 'test/ruby/test_regexp.rb')
-rw-r--r--test/ruby/test_regexp.rb5
1 files changed, 5 insertions, 0 deletions
diff --git a/test/ruby/test_regexp.rb b/test/ruby/test_regexp.rb
index e6eee24b2e..9eab99d677 100644
--- a/test/ruby/test_regexp.rb
+++ b/test/ruby/test_regexp.rb
@@ -2045,6 +2045,11 @@ class TestRegexp < Test::Unit::TestCase
100.times.each { assert(regex.match?(string)) }
end
+ def test_bug_20246 # [Bug #20246]
+ assert_equal '1.2.3', '1.2.3'[/(\d+)(\.\g<1>){2}/]
+ assert_equal '1.2.3', '1.2.3'[/((?:\d|foo|bar)+)(\.\g<1>){2}/]
+ end
+
def test_linear_time_p
assert_send [Regexp, :linear_time?, /a/]
assert_send [Regexp, :linear_time?, 'a']