From e6c607319cd1bc383dffecb73616bcd19b808cd1 Mon Sep 17 00:00:00 2001 From: Aadhavan Srinivasan Date: Wed, 30 Oct 2024 09:32:32 -0400 Subject: [PATCH] Added more tests --- re_test.go | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/re_test.go b/re_test.go index ee71038..f60d778 100644 --- a/re_test.go +++ b/re_test.go @@ -50,7 +50,7 @@ var reTests = []struct { {"g[ab]c", "gc", []matchIndex{}}, {"g[ab]c", "gfc", []matchIndex{}}, {"[ab]*", "aabbbabaababab", []matchIndex{{0, 14}}}, - {"[ab]+", "aabbbabaababab", []matchIndex{{0, 14}}}, + {"[ab]+", "aabbbablaababab", []matchIndex{{0, 7}, {8, 15}}}, {"[Ff]r[Uu]it", "fruit", []matchIndex{{0, 5}}}, {"[Ff]r[Uu]it", "FrUit", []matchIndex{{0, 5}}}, {"[Ff]r[Uu|]it", "Fr|it", []matchIndex{{0, 5}}}, @@ -72,6 +72,12 @@ var reTests = []struct { {`\s`, "a b c d", []matchIndex{{1, 2}, {3, 4}, {5, 6}, {6, 7}}}, {`\<`, "", []matchIndex{{0, 1}, {6, 7}}}, {`\(.+\)`, "Not (paranthesized), (so) is (this) not", []matchIndex{{4, 35}}}, + + {"[^abc]+", "qarbtopsaplpclkpasdmb prejip0r,p", []matchIndex{{0, 1}, {2, 3}, {4, 8}, {9, 12}, {13, 16}, {17, 20}, {21, 32}}}, + {"[^a]+", "qqqaq", []matchIndex{{0, 3}, {4, 5}}}, + {"[^0-9]+", "a1b2c3dd", []matchIndex{{0, 1}, {2, 3}, {4, 5}, {6, 8}}}, + {"[^abc]+", "ababababbababaccacacacaca", []matchIndex{}}, + {`\([^)]+\)`, "Not (paranthesized), (so) is (this) not", []matchIndex{{4, 19}, {21, 25}, {29, 35}}}, } func TestFindAllMatches(t *testing.T) {