============================================================================= 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)
| 954 | // Verifies: SYS-REQ-016 [boundary] |
| 955 | // Not-found key returns NotExist, offset -1, KeyPathNotFoundError. |
| 956 | func 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. |