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

Function truncatingFormat

assert/assertions.go:586–593  ·  view source on GitHub ↗

truncatingFormat formats the data and truncates it if it's too long. This helps keep formatted error messages lines from exceeding the bufio.MaxScanTokenSize max line length that the go testing framework imposes.

(data interface{})

Source from the content-addressed store, hash-verified

584// This helps keep formatted error messages lines from exceeding the
585// bufio.MaxScanTokenSize max line length that the go testing framework imposes.
586func truncatingFormat(data interface{}) string {
587 value := fmt.Sprintf("%#v", data)
588 max := bufio.MaxScanTokenSize - 100 // Give us some space the type info too if needed.
589 if len(value) > max {
590 value = value[0:max] + "<... truncated>"
591 }
592 return value
593}
594
595// EqualValues asserts that two objects are equal or convertible to the larger
596// type and equal.

Callers 2

Test_truncatingFormatFunction · 0.85
formatUnequalValuesFunction · 0.85

Calls

no outgoing calls

Tested by 1

Test_truncatingFormatFunction · 0.68