MCPcopy Create free account
hub / github.com/stretchr/testify / Empty

Function Empty

assert/assertions.go:749–760  ·  view source on GitHub ↗

Empty asserts that the specified object is empty. I.e. nil, "", false, 0 or either a slice or a channel with len == 0. assert.Empty(t, obj)

(t TestingT, object interface{}, msgAndArgs ...interface{})

Source from the content-addressed store, hash-verified

747//
748// assert.Empty(t, obj)
749func Empty(t TestingT, object interface{}, msgAndArgs ...interface{}) bool {
750 pass := isEmpty(object)
751 if !pass {
752 if h, ok := t.(tHelper); ok {
753 h.Helper()
754 }
755 Fail(t, fmt.Sprintf("Should be empty, but was %v", object), msgAndArgs...)
756 }
757
758 return pass
759
760}
761
762// NotEmpty asserts that the specified object is NOT empty. I.e. not nil, "", false, 0 or either
763// a slice or a channel with len == 0.

Callers 5

EmptyFunction · 0.92
EmptyfFunction · 0.70
TestEmptyFunction · 0.70
EmptyMethod · 0.70

Calls 3

isEmptyFunction · 0.85
FailFunction · 0.70
HelperMethod · 0.65

Tested by 2

TestEmptyFunction · 0.56