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

Function TestGetBestEffortMalformed

deep_spec_test.go:1098–1108  ·  view source on GitHub ↗

Verifies: SYS-REQ-026 [malformed] Malformed input outside addressed path allows best-effort result.

(t *testing.T)

Source from the content-addressed store, hash-verified

1096// Verifies: SYS-REQ-026 [malformed]
1097// Malformed input outside addressed path allows best-effort result.
1098func TestGetBestEffortMalformed(t *testing.T) {
1099 // Malformed after the value we're looking for
1100 data := []byte(`{"a":1,"b":INVALID}`)
1101 val, _, _, err := Get(data, "a")
1102 if err != nil {
1103 t.Fatalf("Get best-effort error: %v (should succeed for key before malformed section)", err)
1104 }
1105 if string(val) != "1" {
1106 t.Fatalf("Get best-effort = %q, want %q", string(val), "1")
1107 }
1108}
1109
1110// Verifies: SYS-REQ-027 [malformed]
1111// Unclassifiable token returns value-type error.

Callers

nothing calls this directly

Calls 1

GetFunction · 0.85

Tested by

no test coverage detected