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

Method ErrorContains

internal/testify/assert/assertion_forward.go:261–266  ·  view source on GitHub ↗

ErrorContains asserts that a function returned an error (i.e. not `nil`) and that the error contains the specified substring. actualObj, err := SomeFunction() a.ErrorContains(err, expectedErrorSubString)

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

Source from the content-addressed store, hash-verified

259// actualObj, err := SomeFunction()
260// a.ErrorContains(err, expectedErrorSubString)
261func (a *Assertions) ErrorContains(theError error, contains string, msgAndArgs ...interface{}) bool {
262 if h, ok := a.t.(tHelper); ok {
263 h.Helper()
264 }
265 return ErrorContains(a.t, theError, contains, msgAndArgs...)
266}
267
268// ErrorContainsf asserts that a function returned an error (i.e. not `nil`)
269// and that the error contains the specified substring.

Callers 1

TestErrorContainsWrapperFunction · 0.45

Calls 2

ErrorContainsFunction · 0.70
HelperMethod · 0.45

Tested by 1

TestErrorContainsWrapperFunction · 0.36