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

Function Test_truncatingFormat

internal/testify/assert/assertions_test.go:2911–2924  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

2909}
2910
2911func Test_truncatingFormat(t *testing.T) {
2912
2913 original := strings.Repeat("a", bufio.MaxScanTokenSize-102)
2914 result := truncatingFormat(original)
2915 Equal(t, fmt.Sprintf("%#v", original), result, "string should not be truncated")
2916
2917 original = original + "x"
2918 result = truncatingFormat(original)
2919 NotEqual(t, fmt.Sprintf("%#v", original), result, "string should have been truncated.")
2920
2921 if !strings.HasSuffix(result, "<... truncated>") {
2922 t.Error("truncated string should have <... truncated> suffix")
2923 }
2924}
2925
2926// parseLabeledOutput does the inverse of labeledOutput - it takes a formatted
2927// output string and turns it back into a slice of labeledContent.

Callers

nothing calls this directly

Calls 5

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

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…