Added more test cases
This commit is contained in:
14
re_test.go
14
re_test.go
@@ -85,6 +85,7 @@ var reTests = []struct {
|
||||
{"b$", "ba", []matchIndex{}},
|
||||
{"(boy|girl)$", "girlf", []matchIndex{}},
|
||||
{`\bint\b`, "print int integer", []matchIndex{{6, 9}}},
|
||||
{`int\b`, "ints", []matchIndex{}},
|
||||
{`int(\b|a)`, "inta", []matchIndex{{0, 4}}},
|
||||
{`\b\d+\b`, "511 a3 43", []matchIndex{{0, 3}, {7, 9}}},
|
||||
{`\Bint\B`, "prints int integer print", []matchIndex{{2, 5}}},
|
||||
@@ -94,6 +95,19 @@ var reTests = []struct {
|
||||
{`^int$`, "print int integer", []matchIndex{}},
|
||||
{`^int$`, "int", []matchIndex{{0, 3}}},
|
||||
{`b*`, "aaaaaaaaaaqweqwe", []matchIndex{{0, 0}, {1, 1}, {2, 2}, {3, 3}, {4, 4}, {5, 5}, {6, 6}, {7, 7}, {8, 8}, {9, 9}, {10, 10}, {11, 11}, {12, 12}, {13, 13}, {14, 14}, {15, 15}, {16, 16}}},
|
||||
|
||||
{"a{4}", "aabaaa", []matchIndex{}},
|
||||
{"ab{5}", "abbbbbab", []matchIndex{{0, 6}}},
|
||||
{"(a|b){3,4}", "aba", []matchIndex{{0, 3}}},
|
||||
{"(a|b){3,4}", "ababaa", []matchIndex{{0, 4}}},
|
||||
{"(bc){5,}", "bcbcbcbcbcbcbcbc", []matchIndex{{0, 16}}},
|
||||
{`\d{3,4}`, "1209", []matchIndex{{0, 4}}},
|
||||
{`\d{3,4}`, "109", []matchIndex{{0, 3}}},
|
||||
{`\d{3,4}`, "5", []matchIndex{}},
|
||||
{`\d{3,4}`, "89a-0", []matchIndex{}},
|
||||
{`\d{3,4}`, "ababab555", []matchIndex{{6, 9}}},
|
||||
{`\bpaint\b`, "paints", []matchIndex{}},
|
||||
{`\b\w{5}\b`, "paint", []matchIndex{{0, 5}}},
|
||||
}
|
||||
|
||||
func TestFindAllMatches(t *testing.T) {
|
||||
|
Reference in New Issue
Block a user