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

Function TestRemoval6_ArrayEach_EmptyStringElement

dead_code_audit_test.go:492–513  ·  view source on GitHub ↗

Verifies: SYS-REQ-006 [boundary]

(t *testing.T)

Source from the content-addressed store, hash-verified

490
491// Verifies: SYS-REQ-006 [boundary]
492func TestRemoval6_ArrayEach_EmptyStringElement(t *testing.T) {
493 // Can Get return ([], String, 0, nil) for an empty string ""?
494 // Get("\"\"") → internalGet → searchKeys skipped → nextToken → offset 0
495 // → getType(data, 0) → data[0]='"' → stringEnd(data[1:])
496 // stringEnd on `"` → finds quote at position 0 → returns (1, false)
497 // So endOffset = 0 + 1 + 1 = 2. NOT 0.
498 // Get returns offset=2 (the endOffset from internalGet's 4th return).
499 // Wait — Get returns internalGet's 4th value as `offset`.
500 // Let me re-check: Get returns (a, b, d, e) where d = endOffset from internalGet.
501 // For "" at position 0: endOffset from getType = 2, so Get returns offset=2.
502
503 count := 0
504 _, err := ArrayEach([]byte(`["","b"]`), func(value []byte, dataType ValueType, offset int, err error) {
505 count++
506 })
507 if err != nil {
508 t.Fatalf("unexpected error: %v", err)
509 }
510 if count != 2 {
511 t.Fatalf("expected 2 callbacks, got %d", count)
512 }
513}
514
515// Verifies: SYS-REQ-006 [boundary]
516func TestRemoval6_ArrayEach_WhitespaceOnlyInput(t *testing.T) {

Callers

nothing calls this directly

Calls 1

ArrayEachFunction · 0.85

Tested by

no test coverage detected