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

Function TestGetUnsafeStringTruncatedValue

deep_spec_test.go:821–832  ·  view source on GitHub ↗

Verifies: SYS-REQ-082 [malformed] GetUnsafeString on truncated-at-value-boundary input shall return error.

(t *testing.T)

Source from the content-addressed store, hash-verified

819// Verifies: SYS-REQ-082 [malformed]
820// GetUnsafeString on truncated-at-value-boundary input shall return error.
821func TestGetUnsafeStringTruncatedValue(t *testing.T) {
822 func() {
823 defer func() {
824 if r := recover(); r != nil {
825 t.Fatalf("GetUnsafeString on truncated input panicked: %v", r)
826 }
827 }()
828 _, err := GetUnsafeString([]byte(`{"a":1`), "a")
829 // Accept error or best-effort result, as long as no panic
830 _ = err
831 }()
832}
833
834// =============================================================================
835// ArrayEach truncated at value boundary (SYS-REQ-083)

Callers

nothing calls this directly

Calls 1

GetUnsafeStringFunction · 0.85

Tested by

no test coverage detected