Added test cases

master
Aadhavan Srinivasan 2 months ago
parent 45d348e7f4
commit d8299294ed

@ -61,8 +61,17 @@ var reTests = []struct {
{".+", "Hello, how is it going?", []matchIndex{{0, 23}}},
{"a.", "a ", []matchIndex{{0, 2}}},
{"a.b", "a/b", []matchIndex{{0, 3}}},
{".", "a ", []matchIndex{{0, 2}}},
{".", "a ", []matchIndex{{0, 1}, {1, 2}}},
{"a.", "a ", []matchIndex{{0, 2}}},
{".+b", "abc", []matchIndex{{0, 2}}},
{`\d`, "1a0a3s'''34343s", []matchIndex{{0, 1}, {2, 3}, {4, 5}, {9, 10}, {10, 11}, {11, 12}, {12, 13}, {13, 14}}},
{`\\`, `a\b\c\qwe\`, []matchIndex{{1, 2}, {3, 4}, {5, 6}, {9, 10}}},
{`\W`, `"Hello", he said. How are you doing?`, []matchIndex{{0, 1}, {6, 7}, {7, 8}, {8, 9}, {11, 12}, {16, 17}, {17, 18}, {21, 22}, {25, 26}, {29, 30}, {35, 36}}},
{`\w`, ";';';';';'qwe12", []matchIndex{{10, 11}, {11, 12}, {12, 13}, {13, 14}, {14, 15}}},
{`\s`, "a b c d", []matchIndex{{1, 2}, {3, 4}, {5, 6}, {6, 7}}},
{`\<`, "<HTML><body>", []matchIndex{{0, 1}, {6, 7}}},
{`\(.+\)`, "Not (paranthesized), (so) is (this) not", []matchIndex{{4, 18}, {21, 24}, {29, 34}}},
}
func TestFindAllMatches(t *testing.T) {

Loading…
Cancel
Save