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

Function Test_truncatingFormat

assert/assertions_test.go:3599–3613  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

3597}
3598
3599func Test_truncatingFormat(t *testing.T) {
3600 t.Parallel()
3601
3602 original := strings.Repeat("a", bufio.MaxScanTokenSize-102)
3603 result := truncatingFormat(original)
3604 Equal(t, fmt.Sprintf("%#v", original), result, "string should not be truncated")
3605
3606 original = original + "x"
3607 result = truncatingFormat(original)
3608 NotEqual(t, fmt.Sprintf("%#v", original), result, "string should have been truncated.")
3609
3610 if !strings.HasSuffix(result, "<... truncated>") {
3611 t.Error("truncated string should have <... truncated> suffix")
3612 }
3613}
3614
3615// parseLabeledOutput does the inverse of labeledOutput - it takes a formatted
3616// output string and turns it back into a slice of labeledContent.

Callers

nothing calls this directly

Calls 4

truncatingFormatFunction · 0.85
EqualFunction · 0.70
NotEqualFunction · 0.70
ErrorMethod · 0.45

Tested by

no test coverage detected