MCPcopy
hub / github.com/buger/jsonparser / TestParseStringAndEscapeSupplementalCoverage

Function TestParseStringAndEscapeSupplementalCoverage

mcdc_supplement_test.go:367–382  ·  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

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

Callers

nothing calls this directly

Calls 2

unescapeToUTF8Function · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…