MCPcopy
hub / github.com/expr-lang/expr / Fail

Function Fail

internal/testify/assert/assertions.go:346–370  ·  view source on GitHub ↗

Fail reports a failure through

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

Source from the content-addressed store, hash-verified

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

Callers 15

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
TestEventuallyWithTFalseFunction · 0.70

Calls 6

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

Used in the wild real call sites across dependent graphs

searching dependent graphs…