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

Function TestGetNotFoundResult

deep_spec_test.go:956–971  ·  view source on GitHub ↗

============================================================================= Additional Get path tests for SYS-REQ-016 through SYS-REQ-027 ============================================================================= Verifies: SYS-REQ-016 [boundary] Not-found key returns NotExist, offset -1, KeyPat

(t *testing.T)

Source from the content-addressed store, hash-verified

954// Verifies: SYS-REQ-016 [boundary]
955// Not-found key returns NotExist, offset -1, KeyPathNotFoundError.
956func TestGetNotFoundResult(t *testing.T) {
957 data := []byte(`{"a":1,"b":2}`)
958 val, dt, off, err := Get(data, "missing")
959 if !errors.Is(err, KeyPathNotFoundError) {
960 t.Fatalf("Get not-found error = %v, want %v", err, KeyPathNotFoundError)
961 }
962 if dt != NotExist {
963 t.Fatalf("Get not-found type = %v, want NotExist", dt)
964 }
965 if off != -1 {
966 t.Fatalf("Get not-found offset = %d, want -1", off)
967 }
968 if val != nil {
969 t.Fatalf("Get not-found value = %v, want nil", val)
970 }
971}
972
973// Verifies: SYS-REQ-017 [malformed]
974// Incomplete/truncated input returns parse error.

Callers

nothing calls this directly

Calls 1

GetFunction · 0.85

Tested by

no test coverage detected