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

Function TestCodeMCDC_DeleteSpaceBeforeComma

mcdc_supplement_test.go:740–753  ·  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

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