MCPcopy Create free account
hub / github.com/buger/jsonparser / truncateForName

Function truncateForName

encoding_json_fuzz_test.go:767–774  ·  view source on GitHub ↗

truncateForName renders a byte slice for use as a subtest name, capping the length so deeply-nested seeds (100 KB) don't produce gigantic test IDs.

(b []byte)

Source from the content-addressed store, hash-verified

765// truncateForName renders a byte slice for use as a subtest name, capping the
766// length so deeply-nested seeds (100 KB) don't produce gigantic test IDs.
767func truncateForName(b []byte) string {
768 const max = 40
769 s := fmt.Sprintf("%q", b)
770 if len(s) <= max {
771 return s
772 }
773 return s[:max] + "..."
774}

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected