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

Function Empty

assert/assertions.go:790–800  ·  view source on GitHub ↗

Empty asserts that the given value is "empty". [Zero values] are "empty". Arrays are "empty" if every element is the zero value of the type (stricter than "empty"). Slices, maps and channels with zero length are "empty". Pointer values are "empty" if the pointer is nil or if the pointed value is

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

Source from the content-addressed store, hash-verified

788//
789// [Zero values]: https://go.dev/ref/spec#The_zero_value
790func Empty(t TestingT, object interface{}, msgAndArgs ...interface{}) bool {
791 pass := isEmpty(object)
792 if !pass {
793 if h, ok := t.(tHelper); ok {
794 h.Helper()
795 }
796 Fail(t, fmt.Sprintf("Should be empty, but was %v", object), msgAndArgs...)
797 }
798
799 return pass
800}
801
802// NotEmpty asserts that the specified object is NOT [Empty].
803//

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