truncateForMsg renders a byte slice for inclusion in an error message, truncating very large inputs (e.g. the 100 KB deep-nesting seed) so test output remains readable.
(b []byte)
| 125 | // truncating very large inputs (e.g. the 100 KB deep-nesting seed) so test |
| 126 | // output remains readable. |
| 127 | func truncateForMsg(b []byte) string { |
| 128 | const max = 200 |
| 129 | if len(b) <= max { |
| 130 | return fmt.Sprintf("%q", b) |
| 131 | } |
| 132 | return fmt.Sprintf("%q...(truncated, %d bytes total)", b[:max], len(b)) |
| 133 | } |
| 134 | |
| 135 | // genDeepNesting returns deeply-nested JSON array bytes. When closed is true |
| 136 | // the structure is complete ([[[...1...]]]); when false it is left unclosed |
no outgoing calls
no test coverage detected