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

Function Zero

assert/assertions.go:1758–1766  ·  view source on GitHub ↗

Zero asserts that i is the zero value for its type.

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

Source from the content-addressed store, hash-verified

1756
1757// Zero asserts that i is the zero value for its type.
1758func Zero(t TestingT, i interface{}, msgAndArgs ...interface{}) bool {
1759 if h, ok := t.(tHelper); ok {
1760 h.Helper()
1761 }
1762 if i != nil && !reflect.DeepEqual(i, reflect.Zero(reflect.TypeOf(i)).Interface()) {
1763 return Fail(t, fmt.Sprintf("Should be zero, but was %v", i), msgAndArgs...)
1764 }
1765 return true
1766}
1767
1768// NotZero asserts that i is not the zero value for its type.
1769func NotZero(t TestingT, i interface{}, msgAndArgs ...interface{}) bool {

Callers 4

ZeroFunction · 0.92
ZerofFunction · 0.70
TestZeroFunction · 0.70
ZeroMethod · 0.70

Calls 3

FailFunction · 0.70
HelperMethod · 0.65
ZeroMethod · 0.45

Tested by 1

TestZeroFunction · 0.56