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

Function ErrorContainsf

require/require.go:356–364  ·  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() require.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

354// actualObj, err := SomeFunction()
355// require.ErrorContainsf(t, err, expectedErrorSubString, "error message %s", "formatted")
356func ErrorContainsf(t TestingT, theError error, contains string, msg string, args ...interface{}) {
357 if h, ok := t.(tHelper); ok {
358 h.Helper()
359 }
360 if assert.ErrorContainsf(t, theError, contains, msg, args...) {
361 return
362 }
363 t.FailNow()
364}
365
366// ErrorIs asserts that at least one of the errors in err's chain matches target.
367// This is a wrapper for errors.Is.

Callers 1

ErrorContainsfMethod · 0.70

Calls 3

ErrorContainsfFunction · 0.92
HelperMethod · 0.65
FailNowMethod · 0.65

Tested by

no test coverage detected