Verifies: SYS-REQ-008 [boundary]
(t *testing.T)
| 311 | |
| 312 | // Verifies: SYS-REQ-008 [boundary] |
| 313 | func 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] |
| 333 | func TestRemoval4_EachKey_SkipNestedArray(t *testing.T) { |