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

Function Fail

assert/assertions.go:366–390  ·  assert/assertions.go::Fail

Fail reports a failure through

(t TestingT, failureMessage string, msgAndArgs ...interface{})

Source from the content-addressed store, hash-verified

364
365// Fail reports a failure through
366func Fail(t TestingT, failureMessage string, msgAndArgs ...interface{}) bool {
367 if h, ok := t.(tHelper); ok {
368 h.Helper()
369 }
370 content := []labeledContent{
371 {"Error Trace", strings.Join(CallerInfo(), "\n\t\t\t")},
372 {"Error", failureMessage},
373 }
374
375 // Add test name if the Go version supports it
376 if n, ok := t.(interface {
377 Name() string
378 }); ok {
379 content = append(content, labeledContent{"Test", n.Name()})
380 }
381
382 message := messageFromMsgAndArgs(msgAndArgs...)
383 if len(message) > 0 {
384 content = append(content, labeledContent{"Messages", message})
385 }
386
387 t.Errorf("\n%s", ""+labeledOutput(content...))
388
389 return false
390}
391
392type labeledContent struct {
393 label string

Callers 15

AssertCalledMethod · 0.92
AssertNotCalledMethod · 0.92
FailFunction · 0.92
FailfFunction · 0.70
isOrderedFunction · 0.70
compareTwoValuesFunction · 0.70
HTTPSuccessFunction · 0.70
HTTPRedirectFunction · 0.70
HTTPErrorFunction · 0.70
HTTPStatusCodeFunction · 0.70
HTTPBodyContainsFunction · 0.70
HTTPBodyNotContainsFunction · 0.70

Calls 6

CallerInfoFunction · 0.85
messageFromMsgAndArgsFunction · 0.85
labeledOutputFunction · 0.85
HelperMethod · 0.65
NameMethod · 0.65
ErrorfMethod · 0.65