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

Function NoError

assert/assertions.go:1581–1590  ·  view source on GitHub ↗

* Errors */ NoError asserts that a function returned no error (i.e. `nil`). actualObj, err := SomeFunction() if assert.NoError(t, err) { assert.Equal(t, expectedObj, actualObj) }

(t TestingT, err error, msgAndArgs ...interface{})

Source from the content-addressed store, hash-verified

1579// assert.Equal(t, expectedObj, actualObj)
1580// }
1581func NoError(t TestingT, err error, msgAndArgs ...interface{}) bool {
1582 if err != nil {
1583 if h, ok := t.(tHelper); ok {
1584 h.Helper()
1585 }
1586 return Fail(t, fmt.Sprintf("Received unexpected error:\n%+v", err), msgAndArgs...)
1587 }
1588
1589 return true
1590}
1591
1592// Error asserts that a function returned an error (i.e. not `nil`).
1593//

Callers 4

NoErrorFunction · 0.92
NoErrorfFunction · 0.70
TestNoErrorFunction · 0.70
NoErrorMethod · 0.70

Calls 2

FailFunction · 0.70
HelperMethod · 0.65

Tested by 1

TestNoErrorFunction · 0.56