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

Function Test_truncatingFormat

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

Source from the content-addressed store, hash-verified

3123}
3124
3125func Test_truncatingFormat(t *testing.T) {
3126
3127 original := strings.Repeat("a", bufio.MaxScanTokenSize-102)
3128 result := truncatingFormat(original)
3129 Equal(t, fmt.Sprintf("%#v", original), result, "string should not be truncated")
3130
3131 original = original + "x"
3132 result = truncatingFormat(original)
3133 NotEqual(t, fmt.Sprintf("%#v", original), result, "string should have been truncated.")
3134
3135 if !strings.HasSuffix(result, "<... truncated>") {
3136 t.Error("truncated string should have <... truncated> suffix")
3137 }
3138}
3139
3140// parseLabeledOutput does the inverse of labeledOutput - it takes a formatted
3141// 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