Verifies: SYS-REQ-008 [boundary]
(t *testing.T)
| 331 | |
| 332 | // Verifies: SYS-REQ-008 [boundary] |
| 333 | func 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] |
| 353 | func TestRemoval4_EachKey_SkipMultipleNestedObjects(t *testing.T) { |