Skip to content

Commit b3a87c3

Browse files
committed
Add DoesNotMatch comparator
Signed-off-by: apostasie <[email protected]>
1 parent a7f4976 commit b3a87c3

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

mod/tigron/expect/comparators.go

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,14 @@ func Match(reg *regexp.Regexp) test.Comparator {
9191
}
9292
}
9393

94+
// DoesNotMatch returns a comparator verifying the output does not match the provided regexp.
95+
func DoesNotMatch(reg *regexp.Regexp) test.Comparator {
96+
return func(stdout string, t tig.T) {
97+
t.Helper()
98+
assertive.DoesNotMatch(assertive.WithFailLater(t), stdout, reg, "Inspecting output (!match)")
99+
}
100+
}
101+
94102
// JSON allows to verify that the output can be marshalled into T, and optionally can be further verified by a provided
95103
// method.
96104
func JSON[T any](obj T, verifier func(T, tig.T)) test.Comparator {

0 commit comments

Comments
 (0)