MCPcopy Index your code
hub / github.com/buger/jsonparser / TestFuzzDeleteHarnessCoverage

Function TestFuzzDeleteHarnessCoverage

coverage_closure_test.go:51–70  ·  view source on GitHub ↗

Verifies: SYS-REQ-010 [fuzz] MCDC SYS-REQ-010: delete_path_is_provided=T, delete_returns_empty_document_without_path=F => TRUE

(t *testing.T)

Source from the content-addressed store, hash-verified

49// Verifies: SYS-REQ-010 [fuzz]
50// MCDC SYS-REQ-010: delete_path_is_provided=T, delete_returns_empty_document_without_path=F => TRUE
51func TestFuzzDeleteHarnessCoverage(t *testing.T) {
52 // FuzzDelete calls Delete(data, "test") and always returns 1.
53 // Exercise it with data that contains and does not contain the key.
54
55 // Case 1: data contains the "test" key -- Delete removes it
56 data := []byte(`{"test":"value","other":"keep"}`)
57 if got := FuzzDelete(data); got != 1 {
58 t.Fatalf("FuzzDelete with existing key = %d, want 1", got)
59 }
60
61 // Case 2: data does not contain the "test" key -- Delete returns data unchanged
62 if got := FuzzDelete([]byte(`{"other":"value"}`)); got != 1 {
63 t.Fatalf("FuzzDelete with missing key = %d, want 1", got)
64 }
65
66 // Case 3: empty JSON object
67 if got := FuzzDelete([]byte(`{}`)); got != 1 {
68 t.Fatalf("FuzzDelete with empty object = %d, want 1", got)
69 }
70}
71
72// Verifies: SYS-REQ-007 [fuzz]
73// MCDC SYS-REQ-007: N/A

Callers

nothing calls this directly

Calls 1

FuzzDeleteFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…