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

Function TestRemoval4_EachKey_SkipDeeplyNestedObject

dead_code_audit_test.go:313–330  ·  view source on GitHub ↗

Verifies: SYS-REQ-008 [boundary]

(t *testing.T)

Source from the content-addressed store, hash-verified

311
312// Verifies: SYS-REQ-008 [boundary]
313func TestRemoval4_EachKey_SkipDeeplyNestedObject(t *testing.T) {
314 data := []byte(`{"skip":{"a":{"b":{"c":"deep"}}},"want":"found"}`)
315 paths := [][]string{{"want"}}
316
317 var foundValue []byte
318 EachKey(data, func(idx int, value []byte, vt ValueType, err error) {
319 if idx == 0 {
320 foundValue = value
321 }
322 }, paths...)
323
324 if foundValue == nil {
325 t.Fatal("UNSAFE: EachKey failed to find 'want' after deeply nested skip")
326 }
327 if string(foundValue) != "found" {
328 t.Fatalf("expected 'found', got %q", foundValue)
329 }
330}
331
332// Verifies: SYS-REQ-008 [boundary]
333func TestRemoval4_EachKey_SkipNestedArray(t *testing.T) {

Callers

nothing calls this directly

Calls 1

EachKeyFunction · 0.85

Tested by

no test coverage detected