Throw error if match isn't found but test.result has >0 elements
This commit is contained in:
@@ -790,6 +790,13 @@ func TestFindSubmatch(t *testing.T) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
match, err := regComp.FindSubmatch(test.str)
|
match, err := regComp.FindSubmatch(test.str)
|
||||||
|
if err != nil {
|
||||||
|
if len(test.result) != 0 {
|
||||||
|
t.Errorf("Wanted %v got no match\n", test.result[0])
|
||||||
|
}
|
||||||
|
} else if len(test.result) == 0 {
|
||||||
|
t.Errorf("Wanted no match got %v\n", match)
|
||||||
|
}
|
||||||
for i := range match {
|
for i := range match {
|
||||||
if match[i].IsValid() {
|
if match[i].IsValid() {
|
||||||
if test.result[0][i] != match[i] {
|
if test.result[0][i] != match[i] {
|
||||||
|
Reference in New Issue
Block a user