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

Function NotContains

assert/assertions.go:982–996  ·  view source on GitHub ↗

NotContains asserts that the specified string, list(array, slice...) or map does NOT contain the specified substring or element. assert.NotContains(t, "Hello World", "Earth") assert.NotContains(t, ["Hello", "World"], "Earth") assert.NotContains(t, {"Hello": "World"}, "Earth")

(t TestingT, s, contains interface{}, msgAndArgs ...interface{})

Source from the content-addressed store, hash-verified

980// assert.NotContains(t, ["Hello", "World"], "Earth")
981// assert.NotContains(t, {"Hello": "World"}, "Earth")
982func NotContains(t TestingT, s, contains interface{}, msgAndArgs ...interface{}) bool {
983 if h, ok := t.(tHelper); ok {
984 h.Helper()
985 }
986
987 ok, found := containsElement(s, contains)
988 if !ok {
989 return Fail(t, fmt.Sprintf("%#v could not be applied builtin len()", s), msgAndArgs...)
990 }
991 if found {
992 return Fail(t, fmt.Sprintf("%#v should not contain %#v", s, contains), msgAndArgs...)
993 }
994
995 return true
996}
997
998// Subset asserts that the list (array, slice, or map) contains all elements
999// given in the subset (array, slice, or map).

Callers 6

TestSuiteLoggingFunction · 0.92
NotContainsFunction · 0.92
NotContainsfFunction · 0.70
TestContainsNotContainsFunction · 0.70
NotContainsMethod · 0.70

Calls 3

containsElementFunction · 0.85
FailFunction · 0.70
HelperMethod · 0.65

Tested by 3

TestSuiteLoggingFunction · 0.74
TestContainsNotContainsFunction · 0.56