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

Function encodingJSONNoPanic

encoding_json_fuzz_test.go:113–122  ·  view source on GitHub ↗

============================================================================= Shared helpers ============================================================================= encodingJSONNoPanic runs fn and fails the test on panic (Gate A). The panic value and stack are included so a real stdlib bug car

(t *testing.T, label string, data []byte, fn func())

Source from the content-addressed store, hash-verified

111// panic value and stack are included so a real stdlib bug carries full
112// diagnostic context for the minimizing reproducer.
113func encodingJSONNoPanic(t *testing.T, label string, data []byte, fn func()) {
114 t.Helper()
115 defer func() {
116 if r := recover(); r != nil {
117 t.Errorf("encoding/json PANIC in %s (Gate A / NO-PANIC violation): %v\n%s\ndata=%s",
118 label, r, debug.Stack(), truncateForMsg(data))
119 }
120 }()
121 fn()
122}
123
124// truncateForMsg renders a byte slice for inclusion in an error message,
125// truncating very large inputs (e.g. the 100 KB deep-nesting seed) so test

Callers 6

runValidConsistencyGateFunction · 0.85
runDeepNestingDepthsFunction · 0.85
runTransformGateFunction · 0.85
runDifferentialGateFunction · 0.85

Calls 1

truncateForMsgFunction · 0.85

Tested by

no test coverage detected