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

Method ErrorContainsf

assert/assertion_forward.go:289–294  ·  view source on GitHub ↗

ErrorContainsf asserts that a function returned an error (i.e. not `nil`) and that the error contains the specified substring. actualObj, err := SomeFunction() a.ErrorContainsf(err, expectedErrorSubString, "error message %s", "formatted")

(theError error, contains string, msg string, args ...interface{})

Source from the content-addressed store, hash-verified

287// actualObj, err := SomeFunction()
288// a.ErrorContainsf(err, expectedErrorSubString, "error message %s", "formatted")
289func (a *Assertions) ErrorContainsf(theError error, contains string, msg string, args ...interface{}) bool {
290 if h, ok := a.t.(tHelper); ok {
291 h.Helper()
292 }
293 return ErrorContainsf(a.t, theError, contains, msg, args...)
294}
295
296// ErrorIs asserts that at least one of the errors in err's chain matches target.
297// This is a wrapper for errors.Is.

Callers

nothing calls this directly

Calls 2

ErrorContainsfFunction · 0.70
HelperMethod · 0.65

Tested by

no test coverage detected