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

Function TestGetArrayIndexOutOfBounds

deep_spec_test.go:1059–1065  ·  view source on GitHub ↗

Verifies: SYS-REQ-023 [boundary] Out-of-bounds array index returns not-found.

(t *testing.T)

Source from the content-addressed store, hash-verified

1057// Verifies: SYS-REQ-023 [boundary]
1058// Out-of-bounds array index returns not-found.
1059func TestGetArrayIndexOutOfBounds(t *testing.T) {
1060 data := []byte(`{"arr":[1,2,3]}`)
1061 _, _, _, err := Get(data, "arr", "[5]")
1062 if !errors.Is(err, KeyPathNotFoundError) {
1063 t.Fatalf("Get OOB array index error = %v, want %v", err, KeyPathNotFoundError)
1064 }
1065}
1066
1067// Verifies: SYS-REQ-024 [boundary]
1068// Escaped key in payload matches decoded path segment.

Callers

nothing calls this directly

Calls 1

GetFunction · 0.85

Tested by

no test coverage detected