Verifies: SYS-REQ-008 [boundary]
(t *testing.T)
| 351 | |
| 352 | // Verifies: SYS-REQ-008 [boundary] |
| 353 | func 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] |
| 373 | func TestRemoval4_EachKey_NestedObjectWithString(t *testing.T) { |