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

Function ErrorContainsf

assert/assertion_format.go:152–157  ·  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() assert.ErrorContainsf(t, err, expectedErrorSubString, "error message %s", "formatted")

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

Source from the content-addressed store, hash-verified

150// actualObj, err := SomeFunction()
151// assert.ErrorContainsf(t, err, expectedErrorSubString, "error message %s", "formatted")
152func ErrorContainsf(t TestingT, theError error, contains string, msg string, args ...interface{}) bool {
153 if h, ok := t.(tHelper); ok {
154 h.Helper()
155 }
156 return ErrorContains(t, theError, contains, append([]interface{}{msg}, args...)...)
157}
158
159// ErrorIsf asserts that at least one of the errors in err's chain matches target.
160// This is a wrapper for errors.Is.

Callers 2

ErrorContainsfFunction · 0.92
ErrorContainsfMethod · 0.70

Calls 2

ErrorContainsFunction · 0.70
HelperMethod · 0.65

Tested by

no test coverage detected