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

Function TestUnescapeLoneLowSurrogate

escape_test.go:257–265  ·  view source on GitHub ↗

Verifies: SYS-REQ-014 [boundary] — lone low surrogate → U+FFFD.

(t *testing.T)

Source from the content-addressed store, hash-verified

255
256// Verifies: SYS-REQ-014 [boundary] — lone low surrogate → U+FFFD.
257func TestUnescapeLoneLowSurrogate(t *testing.T) {
258 out, err := Unescape([]byte(`\uDC00`), nil)
259 if err != nil {
260 t.Fatalf("Unescape(`\\uDC00`) returned error %v; expected U+FFFD substitution", err)
261 }
262 if got := string(out); got != replacementChar {
263 t.Errorf("Unescape(`\\uDC00`) = %q; expected %q (U+FFFD)", got, replacementChar)
264 }
265}
266
267// Verifies: SYS-REQ-014 [boundary] — high surrogate followed by a "\u" escape
268// that is NOT a low surrogate (here a BMP codepoint U+0041 'A') → U+FFFD + 'A'.

Callers

nothing calls this directly

Calls 1

UnescapeFunction · 0.85

Tested by

no test coverage detected