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

Function NotNil

assert/assertions.go:707–715  ·  view source on GitHub ↗

NotNil asserts that the specified object is not nil. assert.NotNil(t, err)

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

Source from the content-addressed store, hash-verified

705//
706// assert.NotNil(t, err)
707func NotNil(t TestingT, object interface{}, msgAndArgs ...interface{}) bool {
708 if !isNil(object) {
709 return true
710 }
711 if h, ok := t.(tHelper); ok {
712 h.Helper()
713 }
714 return Fail(t, "Expected value not to be nil.", msgAndArgs...)
715}
716
717// isNil checks if a specified object is nil or not, without Failing.
718func isNil(object interface{}) bool {

Callers 13

TestSuiteGettersFunction · 0.92
TestLoggingFailMethod · 0.92
Test_Mock_TestDataFunction · 0.92
Test_Mock_Return_RunFunction · 0.92
TestUnsafePointersFunction · 0.92
NotNilFunction · 0.92
NotNilfFunction · 0.70
TestNotNilFunction · 0.70
BenchmarkNotNilFunction · 0.70

Calls 3

isNilFunction · 0.85
FailFunction · 0.70
HelperMethod · 0.65

Tested by 10

TestSuiteGettersFunction · 0.74
TestLoggingFailMethod · 0.74
Test_Mock_TestDataFunction · 0.74
Test_Mock_Return_RunFunction · 0.74
TestUnsafePointersFunction · 0.74
TestNotNilFunction · 0.56
BenchmarkNotNilFunction · 0.56