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

Function TestCodeMCDC_DeleteSpaceBeforeComma

mcdc_supplement_test.go:736–749  ·  view source on GitHub ↗

Verifies: SYS-REQ-035 [boundary] Code MC/DC gap: parser.go:778 Delete space-comma handling Drive the case where data[endOffset+tokEnd] == ' ' and len(data) > endOffset+tokEnd+1 but data[endOffset+tokEnd+1] != ',' (the third condition is FALSE).

(t *testing.T)

Source from the content-addressed store, hash-verified

734// len(data) > endOffset+tokEnd+1 but data[endOffset+tokEnd+1] != ','
735// (the third condition is FALSE).
736func TestCodeMCDC_DeleteSpaceBeforeComma(t *testing.T) {
737 // Delete "a" from {"a":1 ,"b":2} where there's a space before the comma.
738 got := string(Delete([]byte(`{"a":1 ,"b":2}`), "a"))
739 if got != `{"b":2}` {
740 t.Fatalf("Delete space-comma = %q, want %q", got, `{"b":2}`)
741 }
742
743 // Delete "a" from {"a":1 } where space is followed by '}' not ','
744 // This makes data[endOffset+tokEnd+1] == '}' != ','
745 got2 := string(Delete([]byte(`{"a":1 }`), "a"))
746 // With only one key and space before closing brace, the space-comma
747 // branch is entered but the comma check is FALSE, so it falls through.
748 _ = got2 // Accept whatever the parser produces as long as no panic
749}
750
751// Verifies: SYS-REQ-008 [boundary]
752// Code MC/DC gap: parser.go:497 EachKey i < ln

Callers

nothing calls this directly

Calls 1

DeleteFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…