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

Function TestNegativeArrayIndex

deep_spec_test.go:185–191  ·  view source on GitHub ↗

============================================================================= Negative array index (SYS-REQ-047) ============================================================================= Verifies: SYS-REQ-047 [boundary] Negative array indices are not supported. Get shall return not-found.

(t *testing.T)

Source from the content-addressed store, hash-verified

183// Verifies: SYS-REQ-047 [boundary]
184// Negative array indices are not supported. Get shall return not-found.
185func TestNegativeArrayIndex(t *testing.T) {
186 data := []byte(`{"arr":[10,20,30]}`)
187 _, _, _, err := Get(data, "arr", "[-1]")
188 if err == nil {
189 t.Fatal("Get with negative array index should return error")
190 }
191}
192
193// =============================================================================
194// Delete truncation tests (SYS-REQ-048, SYS-REQ-049, SYS-REQ-050, SYS-REQ-056)

Callers

nothing calls this directly

Calls 1

GetFunction · 0.85

Tested by

no test coverage detected