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

Function TestRemoval_ObjectEach_MalformedNoClosingBrace

dead_code_audit_test.go:592–603  ·  view source on GitHub ↗

Verifies: SYS-REQ-007 [boundary]

(t *testing.T)

Source from the content-addressed store, hash-verified

590
591// Verifies: SYS-REQ-007 [boundary]
592func TestRemoval_ObjectEach_MalformedNoClosingBrace(t *testing.T) {
593 // `{"a":1` — no closing brace. After parsing "a":1,
594 // nextToken on remaining data. Get consumes "1", offset moves past it.
595 // nextToken(data[offset:]) on empty/near-empty → returns -1 → error.
596 err := ObjectEach([]byte(`{"a":1`), func(key []byte, value []byte, dataType ValueType, offset int) error {
597 return nil
598 })
599 if err == nil {
600 t.Fatal("expected error for missing closing brace")
601 }
602 t.Logf("Correctly got error: %v", err)
603}
604
605// =============================================================================
606// STRESS: Ensure no infinite loops or panics on pathological inputs

Callers

nothing calls this directly

Calls 1

ObjectEachFunction · 0.85

Tested by

no test coverage detected