diff options
author | Jeremy Evans <code@jeremyevans.net> | 2022-03-24 11:05:12 -0700 |
---|---|---|
committer | Jeremy Evans <code@jeremyevans.net> | 2022-03-29 15:29:15 -0700 |
commit | 6d3f447aecfb56f7d3edbdf9cc68e748e150d7d8 (patch) | |
tree | 3e62c844920025bce49f68931980abf3e5cabcdb /test | |
parent | 173a6b6a802d80b8cf200308fd3653832b700b1c (diff) |
Fix multiplex backreferencs near end of string in regexp match
Idea from Jirka Marsik.
Fixes [Bug #18631]
Notes
Notes:
Merged: https://github.com/ruby/ruby/pull/5710
Diffstat (limited to 'test')
-rw-r--r-- | test/ruby/test_regexp.rb | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/test/ruby/test_regexp.rb b/test/ruby/test_regexp.rb index 4761d1dc39..94098a850d 100644 --- a/test/ruby/test_regexp.rb +++ b/test/ruby/test_regexp.rb @@ -1422,6 +1422,12 @@ class TestRegexp < Test::Unit::TestCase end end + def test_bug18631 + assert_kind_of MatchData, /(?<x>a)(?<x>aa)\k<x>/.match("aaaaa") + assert_kind_of MatchData, /(?<x>a)(?<x>aa)\k<x>/.match("aaaa") + assert_kind_of MatchData, /(?<x>a)(?<x>aa)\k<x>/.match("aaaab") + end + # This assertion is for porting x2() tests in testpy.py of Onigmo. def assert_match_at(re, str, positions, msg = nil) re = Regexp.new(re) unless re.is_a?(Regexp) |