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

Function TestParseStringAndEscapeSupplementalCoverage

mcdc_supplement_test.go:368–383  ·  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

366// Verifies: SYS-REQ-014 [malformed]
367// MCDC SYS-REQ-014: N/A
368func TestParseStringAndEscapeSupplementalCoverage(t *testing.T) {
369 t.Run("decodeSingleUnicodeEscape rejects bad hex in each leading position", func(t *testing.T) {
370 inputs := []string{`\ux234`, `\u1x34`, `\u12x4`}
371 for _, in := range inputs {
372 if _, ok := decodeSingleUnicodeEscape([]byte(in)); ok {
373 t.Fatalf("decodeSingleUnicodeEscape(%q) unexpectedly succeeded", in)
374 }
375 }
376 })
377
378 t.Run("unescapeToUTF8 rejects non backslash prefix", func(t *testing.T) {
379 if inLen, outLen := unescapeToUTF8([]byte("x1"), make([]byte, 8)); inLen != -1 || outLen != -1 {
380 t.Fatalf("unescapeToUTF8(non-escape) = (%d, %d), want (-1, -1)", inLen, outLen)
381 }
382 })
383}
384
385// Verifies: SYS-REQ-014 [fuzz]
386// MCDC SYS-REQ-014: N/A

Callers

nothing calls this directly

Calls 2

unescapeToUTF8Function · 0.85

Tested by

no test coverage detected