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

Function applySequenceStep

path_fuzz_test.go:489–511  ·  view source on GitHub ↗

============================================================================= SEQUENCE fuzzer (closes Dimension 2: interaction / sequence coverage) ============================================================================= Every existing fuzzer runs ONE operation per input. Real bugs live in SEQ

(t *testing.T, state []byte, op string, path []string, val []byte)

Source from the content-addressed store, hash-verified

487// returns the new state. Returns (newState, ok). ok=false means the op
488// errored and the sequence should restart from a prior valid state.
489func applySequenceStep(t *testing.T, state []byte, op string, path []string, val []byte) ([]byte, bool) {
490 t.Helper()
491 defer func() {
492 if r := recover(); r != nil {
493 t.Errorf("PANIC in sequence step %s (NO-PANIC violation): %v\n%s\nstate=%q path=%v",
494 op, r, debug.Stack(), state, path)
495 }
496 }()
497 clone := make([]byte, len(state))
498 copy(clone, state)
499 switch op {
500 case "set":
501 out, err := Set(clone, val, path...)
502 if err != nil {
503 return state, false
504 }
505 return out, true
506 case "delete":
507 out := Delete(clone, path...)
508 return out, true
509 }
510 return state, false
511}
512
513// assertAfterStep runs the post-step invariants: no panic (caught above),
514// json.Valid (when input was valid + shape matches), and the per-step

Callers 1

FuzzSequenceFunction · 0.85

Calls 2

SetFunction · 0.85
DeleteFunction · 0.85

Tested by

no test coverage detected