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

Function TestCodeMCDC_UnescapeLoopEntry

mcdc_supplement_test.go:694–712  ·  view source on GitHub ↗

Verifies: SYS-REQ-014 [boundary] Code MC/DC gap: escape.go:149 Unescape for len(in) > 0 Drive the loop body. A string with an escape sequence enters the loop.

(t *testing.T)

Source from the content-addressed store, hash-verified

692// Code MC/DC gap: escape.go:149 Unescape for len(in) > 0
693// Drive the loop body. A string with an escape sequence enters the loop.
694func TestCodeMCDC_UnescapeLoopEntry(t *testing.T) {
695 // A string with a backslash-n escape forces the Unescape loop
696 result, err := Unescape([]byte(`hello\nworld`), make([]byte, 32))
697 if err != nil {
698 t.Fatalf("Unescape error: %v", err)
699 }
700 if string(result) != "hello\nworld" {
701 t.Fatalf("Unescape = %q, want %q", string(result), "hello\nworld")
702 }
703
704 // Also test with multiple escapes to exercise loop re-entry
705 result2, err2 := Unescape([]byte(`a\tb\nc`), make([]byte, 32))
706 if err2 != nil {
707 t.Fatalf("Unescape multiple escapes error: %v", err2)
708 }
709 if string(result2) != "a\tb\nc" {
710 t.Fatalf("Unescape multiple = %q, want %q", string(result2), "a\tb\nc")
711 }
712}
713
714// Verifies: SYS-REQ-007 [boundary]
715// Code MC/DC gap: parser.go:1138 ObjectEach offset < len(data)

Callers

nothing calls this directly

Calls 1

UnescapeFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…