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

Function TestRemoval6_ArrayEach_WhitespaceOnlyInput

dead_code_audit_test.go:516–529  ·  view source on GitHub ↗

Verifies: SYS-REQ-006 [boundary]

(t *testing.T)

Source from the content-addressed store, hash-verified

514
515// Verifies: SYS-REQ-006 [boundary]
516func TestRemoval6_ArrayEach_WhitespaceOnlyInput(t *testing.T) {
517 // Can Get return (nil, NotExist, 0, nil)?
518 // Get(" ") → nextToken returns 0 pointing to first space... no.
519 // nextToken skips spaces. " " → returns -1 → MalformedJsonError.
520 // So Get returns (nil, NotExist, 0, MalformedJsonError). offset=0, err!=nil.
521 // In ArrayEach: if o==0, returns offset, e — correct.
522 _, err := ArrayEach([]byte(`[ `), func(value []byte, dataType ValueType, offset int, err error) {
523 // should not be called
524 })
525 if err == nil {
526 t.Fatal("expected error for whitespace-only array content")
527 }
528 t.Logf("Correctly got error: %v", err)
529}
530
531// =============================================================================
532// REMOVAL 7: `ln > 0` guard removed in findKeyStart

Callers

nothing calls this directly

Calls 1

ArrayEachFunction · 0.85

Tested by

no test coverage detected