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

Function EqualError

require/require.go:188–196  ·  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() require.EqualError(t, err, expectedErrorString)

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

Source from the content-addressed store, hash-verified

186// actualObj, err := SomeFunction()
187// require.EqualError(t, err, expectedErrorString)
188func EqualError(t TestingT, theError error, errString string, msgAndArgs ...interface{}) {
189 if h, ok := t.(tHelper); ok {
190 h.Helper()
191 }
192 if assert.EqualError(t, theError, errString, msgAndArgs...) {
193 return
194 }
195 t.FailNow()
196}
197
198// EqualErrorf asserts that a function returned an error (i.e. not `nil`)
199// and that it is equal to the provided error.

Callers 2

EqualErrorMethod · 0.70
TestEqualErrorFunction · 0.70

Calls 3

EqualErrorFunction · 0.92
HelperMethod · 0.65
FailNowMethod · 0.65

Tested by 1

TestEqualErrorFunction · 0.56