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

Function NoError

assert/assertions.go:1633–1642  ·  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

1631// assert.Equal(t, expectedObj, actualObj)
1632// }
1633func NoError(t TestingT, err error, msgAndArgs ...interface{}) bool {
1634 if err != nil {
1635 if h, ok := t.(tHelper); ok {
1636 h.Helper()
1637 }
1638 return Fail(t, fmt.Sprintf("Received unexpected error:\n%+v", err), msgAndArgs...)
1639 }
1640
1641 return true
1642}
1643
1644// Error asserts that a function returned an error (i.e. not `nil`).
1645//

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