MCPcopy Create free account
hub / github.com/stretchr/testify / Fail

Function Fail

assert/assertions.go:348–372  ·  view source on GitHub ↗

Fail reports a failure through

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

Source from the content-addressed store, hash-verified

346
347// Fail reports a failure through
348func Fail(t TestingT, failureMessage string, msgAndArgs ...interface{}) bool {
349 if h, ok := t.(tHelper); ok {
350 h.Helper()
351 }
352 content := []labeledContent{
353 {"Error Trace", strings.Join(CallerInfo(), "\n\t\t\t")},
354 {"Error", failureMessage},
355 }
356
357 // Add test name if the Go version supports it
358 if n, ok := t.(interface {
359 Name() string
360 }); ok {
361 content = append(content, labeledContent{"Test", n.Name()})
362 }
363
364 message := messageFromMsgAndArgs(msgAndArgs...)
365 if len(message) > 0 {
366 content = append(content, labeledContent{"Messages", message})
367 }
368
369 t.Errorf("\n%s", ""+labeledOutput(content...))
370
371 return false
372}
373
374type labeledContent struct {
375 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