MCPcopy Index your code
hub / github.com/buger/jsonparser / TestDecodeUnicodeEscape

Function TestDecodeUnicodeEscape

escape_test.go:88–103  ·  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

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

Callers

nothing calls this directly

Calls 1

decodeUnicodeEscapeFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…