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

Function truncatingFormat

assert/assertions.go:621–628  ·  assert/assertions.go::truncatingFormat

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

619// This helps keep formatted error messages lines from exceeding the
620// bufio.MaxScanTokenSize max line length that the go testing framework imposes.
621func truncatingFormat(data interface{}) string {
622 value := fmt.Sprintf("%#v", data)
623 max := bufio.MaxScanTokenSize - 100 // Give us some space the type info too if needed.
624 if len(value) > max {
625 value = value[0:max] + "<... truncated>"
626 }
627 return value
628}
629
630// EqualValues asserts that two objects are equal or convertible to the larger
631// type and equal.

Callers 2

Test_truncatingFormatFunction · 0.85
formatUnequalValuesFunction · 0.85

Calls

no outgoing calls

Tested by 1

Test_truncatingFormatFunction · 0.68