MCPcopy
hub / github.com/buger/jsonparser / TestMissingSurrogateLow

Function TestMissingSurrogateLow

deep_spec_test.go:619–631  ·  view source on GitHub ↗

Verifies: SYS-REQ-061 [malformed] High surrogate without low surrogate shall return MalformedValueError.

(t *testing.T)

Source from the content-addressed store, hash-verified

617// Verifies: SYS-REQ-061 [malformed]
618// High surrogate without low surrogate shall return MalformedValueError.
619func TestMissingSurrogateLow(t *testing.T) {
620 // \uD800 alone (high surrogate, no low)
621 _, err := ParseString([]byte(`\uD800`))
622 if !errors.Is(err, MalformedValueError) {
623 t.Fatalf("ParseString(high surrogate only) error = %v, want %v", err, MalformedValueError)
624 }
625
626 // High surrogate followed by non-escape text
627 _, err = ParseString([]byte(`\uD800abc`))
628 if !errors.Is(err, MalformedValueError) {
629 t.Fatalf("ParseString(high surrogate + text) error = %v, want %v", err, MalformedValueError)
630 }
631}
632
633// Verifies: SYS-REQ-062 [malformed]
634// High surrogate followed by invalid low surrogate shall return MalformedValueError.

Callers

nothing calls this directly

Calls 1

ParseStringFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…