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

Function TestRemoval4_EachKey_SkipNestedArray

dead_code_audit_test.go:333–350  ·  view source on GitHub ↗

Verifies: SYS-REQ-008 [boundary]

(t *testing.T)

Source from the content-addressed store, hash-verified

331
332// Verifies: SYS-REQ-008 [boundary]
333func TestRemoval4_EachKey_SkipNestedArray(t *testing.T) {
334 data := []byte(`{"skip":[1,2,3],"want":"found"}`)
335 paths := [][]string{{"want"}}
336
337 var foundValue []byte
338 EachKey(data, func(idx int, value []byte, vt ValueType, err error) {
339 if idx == 0 {
340 foundValue = value
341 }
342 }, paths...)
343
344 if foundValue == nil {
345 t.Fatal("UNSAFE: EachKey failed to find 'want' after array skip")
346 }
347 if string(foundValue) != "found" {
348 t.Fatalf("expected 'found', got %q", foundValue)
349 }
350}
351
352// Verifies: SYS-REQ-008 [boundary]
353func TestRemoval4_EachKey_SkipMultipleNestedObjects(t *testing.T) {

Callers

nothing calls this directly

Calls 1

EachKeyFunction · 0.85

Tested by

no test coverage detected