From 8b6d35c106d0ee73f160f4354312729ebc462fe7 Mon Sep 17 00:00:00 2001 From: Aadhavan Srinivasan Date: Wed, 29 Jan 2025 10:27:03 -0500 Subject: [PATCH] Finished adding tests from Python's test suite; removed a non-greedy operator from one of the old tests --- re_test.go | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) diff --git a/re_test.go b/re_test.go index eeb038b..bdddb15 100644 --- a/re_test.go +++ b/re_test.go @@ -465,6 +465,19 @@ var reTests = []struct { {`[\t][\n][\v][\r][\f][\b]`, nil, "\t\n\v\r\f\b", []Group{{0, 6}}}, {`.*d`, nil, "abc\nabd", []Group{{4, 7}}}, {`(`, nil, "-", nil}, + {`[\41]`, nil, `!`, []Group{{0, 1}}}, + {`(?]*b`, nil, `a>b`, []Group{}}, + {`^a*$`, nil, `foo`, []Group{}}, + + {`*?`, nil, `-`, nil}, + {`a*?`, nil, `-`, nil}, // non-greedy operators are not supported // Todo - add numeric range tests } @@ -604,7 +617,7 @@ var groupTests = []struct { {`a(?:b|c|d)(.)`, nil, `ace`, []Match{[]Group{{0, 3}, {2, 3}}}}, {`a(?:b|c|d)*(.)`, nil, `ace`, []Match{[]Group{{0, 3}, {2, 3}}}}, {`a(?:b|c|d)+(.)`, nil, `ace`, []Match{[]Group{{0, 3}, {2, 3}}}}, - {`a(?:b|(c|e){1,2}?|d)+?(.)`, nil, `ace`, []Match{[]Group{{0, 3}, {1, 2}, {2, 3}}}}, + {`a(?:b|(c|e){1,2}?|d)+(.)`, nil, `ace`, []Match{[]Group{{0, 3}, {1, 2}, {2, 3}}}}, {`(?