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

Function Errorf

assert/assertion_format.go:131–136  ·  view source on GitHub ↗

Errorf asserts that a function returned an error (i.e. not `nil`). actualObj, err := SomeFunction() assert.Errorf(t, err, "error message %s", "formatted")

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

Source from the content-addressed store, hash-verified

129// actualObj, err := SomeFunction()
130// assert.Errorf(t, err, "error message %s", "formatted")
131func Errorf(t TestingT, err error, msg string, args ...interface{}) bool {
132 if h, ok := t.(tHelper); ok {
133 h.Helper()
134 }
135 return Error(t, err, append([]interface{}{msg}, args...)...)
136}
137
138// ErrorAsf asserts that at least one of the errors in err's chain matches target, and if so, sets target to that error value.
139// This is a wrapper for errors.As.

Callers 3

ErrorfFunction · 0.92
TestErrorFunction · 0.70
ErrorfMethod · 0.70

Calls 2

ErrorFunction · 0.70
HelperMethod · 0.65

Tested by 1

TestErrorFunction · 0.56