Skip to content
Snippets Groups Projects
Commit e4f0f470 authored by wwwil's avatar wwwil
Browse files

Add regex op to test

parent e64f61fa
No related merge requests found
...@@ -185,6 +185,11 @@ func (t *testItem) execute(s string) *testOutput { ...@@ -185,6 +185,11 @@ func (t *testItem) execute(s string) *testOutput {
case "nothave": case "nothave":
expectedResultPattern = " '%s' not have '%s'" expectedResultPattern = " '%s' not have '%s'"
result.testResult = !strings.Contains(flagVal, t.Compare.Value) result.testResult = !strings.Contains(flagVal, t.Compare.Value)
case "regex":
expectedResultPattern = " '%s' matched by '%s'"
opRe := regexp.MustCompile(t.Compare.Value)
result.testResult = opRe.MatchString(flagVal)
} }
result.ExpectedResult = fmt.Sprintf(expectedResultPattern, t.Flag, t.Compare.Value) result.ExpectedResult = fmt.Sprintf(expectedResultPattern, t.Flag, t.Compare.Value)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment