MCPcopy
hub / github.com/stretchr/testify / NotRegexp

Function NotRegexp

assert/assertions.go:1744–1755  ·  view source on GitHub ↗

NotRegexp asserts that a specified regexp does not match a string. assert.NotRegexp(t, regexp.MustCompile("starts"), "it's starting") assert.NotRegexp(t, "^start", "it's not starting")

(t TestingT, rx interface{}, str interface{}, msgAndArgs ...interface{})

Source from the content-addressed store, hash-verified

1742// assert.NotRegexp(t, regexp.MustCompile("starts"), "it's starting")
1743// assert.NotRegexp(t, "^start", "it's not starting")
1744func NotRegexp(t TestingT, rx interface{}, str interface{}, msgAndArgs ...interface{}) bool {
1745 if h, ok := t.(tHelper); ok {
1746 h.Helper()
1747 }
1748 match := matchRegexp(rx, str)
1749
1750 if match {
1751 Fail(t, fmt.Sprintf("Expect \"%v\" to NOT match \"%v\"", str, rx), msgAndArgs...)
1752 }
1753
1754 return !match
1755}
1756
1757// Zero asserts that i is the zero value for its type.
1758func Zero(t TestingT, i interface{}, msgAndArgs ...interface{}) bool {

Callers 4

NotRegexpFunction · 0.92
NotRegexpfFunction · 0.70
TestRegexpFunction · 0.70
NotRegexpMethod · 0.70

Calls 3

matchRegexpFunction · 0.85
FailFunction · 0.70
HelperMethod · 0.65

Tested by 1

TestRegexpFunction · 0.56