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

Method EqualError

assert/assertion_forward.go:154–159  ·  view source on GitHub ↗

EqualError asserts that a function returned an error (i.e. not `nil`) and that it is equal to the provided error. actualObj, err := SomeFunction() a.EqualError(err, expectedErrorString)

(theError error, errString string, msgAndArgs ...interface{})

Source from the content-addressed store, hash-verified

152// actualObj, err := SomeFunction()
153// a.EqualError(err, expectedErrorString)
154func (a *Assertions) EqualError(theError error, errString string, msgAndArgs ...interface{}) bool {
155 if h, ok := a.t.(tHelper); ok {
156 h.Helper()
157 }
158 return EqualError(a.t, theError, errString, msgAndArgs...)
159}
160
161// EqualErrorf asserts that a function returned an error (i.e. not `nil`)
162// and that it is equal to the provided error.

Callers 1

TestEqualErrorWrapperFunction · 0.45

Calls 2

EqualErrorFunction · 0.70
HelperMethod · 0.65

Tested by 1

TestEqualErrorWrapperFunction · 0.36