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

Function NotZero

assert/assertions.go:1769–1777  ·  assert/assertions.go::NotZero

NotZero asserts that i is not the zero value for its type.

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

Source from the content-addressed store, hash-verified

1767
1768// NotZero asserts that i is not the zero value for its type.
1769func NotZero(t TestingT, i interface{}, msgAndArgs ...interface{}) bool {
1770 if h, ok := t.(tHelper); ok {
1771 h.Helper()
1772 }
1773 if i == nil || reflect.DeepEqual(i, reflect.Zero(reflect.TypeOf(i)).Interface()) {
1774 return Fail(t, fmt.Sprintf("Should not be zero, but was %v", i), msgAndArgs...)
1775 }
1776 return true
1777}
1778
1779// FileExists checks whether a file exists in the given path. It also fails if
1780// the path points to a directory or there is an error when trying to check the file.

Callers 6

TestSuiteWithStatsFunction · 0.92
NotZeroFunction · 0.92
NotZerofFunction · 0.70
TestNotZeroFunction · 0.70
TestDiffRaceFunction · 0.70
NotZeroMethod · 0.70

Calls 3

FailFunction · 0.70
HelperMethod · 0.65
ZeroMethod · 0.45

Tested by 3

TestSuiteWithStatsFunction · 0.74
TestNotZeroFunction · 0.56
TestDiffRaceFunction · 0.56