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

Function EqualErrorf

require/require.go:203–211  ·  view source on GitHub ↗

EqualErrorf asserts that a function returned an error (i.e. not `nil`) and that it is equal to the provided error. actualObj, err := SomeFunction() require.EqualErrorf(t, err, expectedErrorString, "error message %s", "formatted")

(t TestingT, theError error, errString string, msg string, args ...interface{})

Source from the content-addressed store, hash-verified

201// actualObj, err := SomeFunction()
202// require.EqualErrorf(t, err, expectedErrorString, "error message %s", "formatted")
203func EqualErrorf(t TestingT, theError error, errString string, msg string, args ...interface{}) {
204 if h, ok := t.(tHelper); ok {
205 h.Helper()
206 }
207 if assert.EqualErrorf(t, theError, errString, msg, args...) {
208 return
209 }
210 t.FailNow()
211}
212
213// EqualExportedValues asserts that the types of two objects are equal and their public
214// fields are also equal. This is useful for comparing structs that have private fields

Callers 1

EqualErrorfMethod · 0.70

Calls 3

EqualErrorfFunction · 0.92
HelperMethod · 0.65
FailNowMethod · 0.65

Tested by

no test coverage detected