From e18c4742223d2124c052c74b40c48f8edff6c0e1 Mon Sep 17 00:00:00 2001 From: John Maddock Date: Sat, 23 Feb 2002 12:58:45 +0000 Subject: [PATCH] Updated regression tests with more non-marking parenthesis examples [SVN r12912] --- test/regress/tests.cpp | 14 ++++++++++++++ test/regress/tests.txt | 4 ++++ 2 files changed, 18 insertions(+) diff --git a/test/regress/tests.cpp b/test/regress/tests.cpp index eebe543d..b41f3190 100644 --- a/test/regress/tests.cpp +++ b/test/regress/tests.cpp @@ -453,6 +453,7 @@ __cdecl hl_grep_test_proc(const RegEx& e) { int start, end; + start = e.Position(0); end = start + e.Length(); if((matches[hl_match_id] != start) || (matches[hl_match_id + 1] != end)) @@ -460,6 +461,19 @@ hl_grep_test_proc(const RegEx& e) begin_error(); cout << "class RegEx grep match error: found [" << start << "," << end << "] expected [" << matches[hl_match_id] << "," << matches[hl_match_id+1] << "]" << endl; } + if(0 == (flags[4] & REG_GREP)) + { + for(unsigned int sub = 1; sub < e.Marks(); ++sub) + { + start = e.Position(sub); + end = start + e.Length(sub); + if((matches[2*sub] != start) || (matches[2*sub + 1] != end)) + { + begin_error(); + cout << "class RegEx grep match error: found in sub " << sub << " [" << start << "," << end << "] expected [" << matches[2*sub] << "," << matches[2*sub+1] << "]" << endl; + } + } + } // // check $`: diff --git a/test/regress/tests.txt b/test/regress/tests.txt index e93f8a67..f488472c 100644 --- a/test/regress/tests.txt +++ b/test/regress/tests.txt @@ -861,6 +861,9 @@ abc|\w+? abcd 0 3 (?:(a+)b+) xaaabbba 1 7 1 4 (?:a+(b+)) xaaabbba 1 7 4 7 a+(?#b+)b+ xaaabbba 1 7 +(a)(?:b|$) ab 0 2 0 1 +(a)(?:b|$) a 0 1 0 1 + ; ; try some partial matches: @@ -900,3 +903,4 @@ a+(?#b+)b+ xaaabbba 1 7 ^(?=.*\d)(?=.*[a-z])(?=.*[A-Z]).{4,8}$ ABCD3 -1 -1 +