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

Method ErrorContainsf

require/require_forward.go:290–295  ·  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

288// actualObj, err := SomeFunction()
289// a.ErrorContainsf(err, expectedErrorSubString, "error message %s", "formatted")
290func (a *Assertions) ErrorContainsf(theError error, contains string, msg string, args ...interface{}) {
291 if h, ok := a.t.(tHelper); ok {
292 h.Helper()
293 }
294 ErrorContainsf(a.t, theError, contains, msg, args...)
295}
296
297// ErrorIs asserts that at least one of the errors in err's chain matches target.
298// 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