MCPcopy
hub / github.com/expr-lang/expr / EqualError

Function EqualError

internal/testify/require/require.go:171–179  ·  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() assert.EqualError(t, err, expectedErrorString)

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

Source from the content-addressed store, hash-verified

169// actualObj, err := SomeFunction()
170// assert.EqualError(t, err, expectedErrorString)
171func EqualError(t TestingT, theError error, errString string, msgAndArgs ...interface{}) {
172 if h, ok := t.(tHelper); ok {
173 h.Helper()
174 }
175 if assert.EqualError(t, theError, errString, msgAndArgs...) {
176 return
177 }
178 t.FailNow()
179}
180
181// EqualErrorf asserts that a function returned an error (i.e. not `nil`)
182// and that it is equal to the provided error.

Callers 6

TestRun_MethodWithErrorFunction · 0.92
TestRun_OpInvalidFunction · 0.92
EqualErrorMethod · 0.70
TestEqualErrorFunction · 0.70

Calls 3

EqualErrorFunction · 0.92
FailNowMethod · 0.65
HelperMethod · 0.45

Tested by 5

TestRun_MethodWithErrorFunction · 0.74
TestRun_OpInvalidFunction · 0.74
TestEqualErrorFunction · 0.56

Used in the wild real call sites across dependent graphs

searching dependent graphs…