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

Function TestDecodeUnicodeEscape

escape_test.go:93–108  ·  view source on GitHub ↗

Verifies: SYS-REQ-014 [malformed] MCDC SYS-REQ-014: N/A

(t *testing.T)

Source from the content-addressed store, hash-verified

91// Verifies: SYS-REQ-014 [malformed]
92// MCDC SYS-REQ-014: N/A
93func TestDecodeUnicodeEscape(t *testing.T) {
94 for _, test := range multiUnicodeEscapeTests {
95 r, len := decodeUnicodeEscape([]byte(test.in))
96 isErr := (len == -1)
97
98 if isErr != test.isErr {
99 t.Errorf("decodeUnicodeEscape(%s) returned isErr mismatch: expected %t, obtained %t", test.in, test.isErr, isErr)
100 } else if isErr {
101 continue
102 } else if len != test.len {
103 t.Errorf("decodeUnicodeEscape(%s) returned length mismatch: expected %d, obtained %d", test.in, test.len, len)
104 } else if r != test.out {
105 t.Errorf("decodeUnicodeEscape(%s) returned rune mismatch: expected %x (%c), obtained %x (%c)", test.in, test.out, test.out, r, r)
106 }
107 }
108}
109
110type unescapeTest struct {
111 in string // escaped string

Callers

nothing calls this directly

Calls 1

decodeUnicodeEscapeFunction · 0.85

Tested by

no test coverage detected