Verifies: SYS-REQ-112 (container length accessor). reqproof:proptest:skip targeted witness/regression test; not a property-test subject
(t *testing.T)
| 277 | // Verifies: SYS-REQ-112 (container length accessor). |
| 278 | // reqproof:proptest:skip targeted witness/regression test; not a property-test subject |
| 279 | func TestGetObjectLenRoundTrip(t *testing.T) { |
| 280 | data := []byte(`{"value":{"one":1,"two":"a,b","three":{"nested":true},"four":[1,2]}}`) |
| 281 | |
| 282 | got, err := GetObjectLen(data, "value") |
| 283 | if err != nil { |
| 284 | t.Fatalf("GetObjectLen() unexpected error: %v", err) |
| 285 | } |
| 286 | |
| 287 | callbacks := 0 |
| 288 | err = ObjectEach(data, func(_ []byte, _ []byte, _ ValueType, _ int) error { |
| 289 | callbacks++ |
| 290 | return nil |
| 291 | }, "value") |
| 292 | if err != nil { |
| 293 | t.Fatalf("ObjectEach() unexpected error: %v", err) |
| 294 | } |
| 295 | if got != callbacks { |
| 296 | t.Fatalf("GetObjectLen() = %d, ObjectEach callbacks = %d", got, callbacks) |
| 297 | } |
| 298 | } |
nothing calls this directly
no test coverage detected