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

Function TestUnescapeLoneHighSurrogate

escape_test.go:234–242  ·  view source on GitHub ↗

Verifies: SYS-REQ-014 [boundary] — lone high surrogate → U+FFFD, no following bytes consumed.

(t *testing.T)

Source from the content-addressed store, hash-verified

232// Verifies: SYS-REQ-014 [boundary] — lone high surrogate → U+FFFD, no
233// following bytes consumed.
234func TestUnescapeLoneHighSurrogate(t *testing.T) {
235 out, err := Unescape([]byte(`\uDB29`), nil)
236 if err != nil {
237 t.Fatalf("Unescape(`\\uDB29`) returned error %v; expected U+FFFD substitution", err)
238 }
239 if got := string(out); got != replacementChar {
240 t.Errorf("Unescape(`\\uDB29`) = %q; expected %q (U+FFFD)", got, replacementChar)
241 }
242}
243
244// Verifies: SYS-REQ-014 [boundary] — the bug: high surrogate followed by
245// non-escape bytes was synthesizing U+DC271; must be U+FFFD + literal "A7FA".

Callers

nothing calls this directly

Calls 1

UnescapeFunction · 0.85

Tested by

no test coverage detected