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

Function TestArrayEachErrorPropagation

deep_spec_test.go:394–400  ·  view source on GitHub ↗

============================================================================= ArrayEach error propagation and truncation (SYS-REQ-052, SYS-REQ-053, SYS-REQ-055) ============================================================================= Verifies: SYS-REQ-052 [malformed] ArrayEach shall propagate e

(t *testing.T)

Source from the content-addressed store, hash-verified

392// Verifies: SYS-REQ-052 [malformed]
393// ArrayEach shall propagate element-level Get errors to the caller.
394func TestArrayEachErrorPropagation(t *testing.T) {
395 // Array with a truncated element
396 _, err := ArrayEach([]byte(`[1, {"a":}`), func(value []byte, dataType ValueType, offset int, err error) {})
397 if err == nil {
398 t.Fatal("ArrayEach on array with malformed element should return error")
399 }
400}
401
402// Verifies: SYS-REQ-053 [malformed]
403// ArrayEach on truncated mid-element shall return error, not panic.

Callers

nothing calls this directly

Calls 1

ArrayEachFunction · 0.85

Tested by

no test coverage detected