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

Function TestRemoval4_EachKey_SkipMultipleNestedObjects

dead_code_audit_test.go:353–370  ·  view source on GitHub ↗

Verifies: SYS-REQ-008 [boundary]

(t *testing.T)

Source from the content-addressed store, hash-verified

351
352// Verifies: SYS-REQ-008 [boundary]
353func TestRemoval4_EachKey_SkipMultipleNestedObjects(t *testing.T) {
354 data := []byte(`{"a":{"x":1},"b":{"y":2},"want":"found"}`)
355 paths := [][]string{{"want"}}
356
357 var foundValue []byte
358 EachKey(data, func(idx int, value []byte, vt ValueType, err error) {
359 if idx == 0 {
360 foundValue = value
361 }
362 }, paths...)
363
364 if foundValue == nil {
365 t.Fatal("UNSAFE: EachKey failed to find 'want' after multiple nested objects")
366 }
367 if string(foundValue) != "found" {
368 t.Fatalf("expected 'found', got %q", foundValue)
369 }
370}
371
372// Verifies: SYS-REQ-008 [boundary]
373func TestRemoval4_EachKey_NestedObjectWithString(t *testing.T) {

Callers

nothing calls this directly

Calls 1

EachKeyFunction · 0.85

Tested by

no test coverage detected