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

Function TestMCDC_SYS_REQ_010_Row3_PathProvided

coverage_closure_test.go:123–139  ·  view source on GitHub ↗

Verifies: SYS-REQ-010 [boundary] 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

121// Verifies: SYS-REQ-010 [boundary]
122// MCDC SYS-REQ-010: delete_path_is_provided=T, delete_returns_empty_document_without_path=F => TRUE
123func TestMCDC_SYS_REQ_010_Row3_PathProvided(t *testing.T) {
124 // Witness row 3: path IS provided, but delete_returns_empty_document
125 // is FALSE (irrelevant when path is provided). The formula evaluates
126 // to TRUE because the first disjunct (delete_path_is_provided) is TRUE.
127 //
128 // Drive this by calling Delete with a valid path on well-formed JSON.
129 data := []byte(`{"a":1,"b":2}`)
130 result := Delete(data, "a")
131 if len(result) == 0 {
132 t.Fatal("Delete with valid path returned empty, want non-empty")
133 }
134 // Verify "a" was actually removed
135 _, _, _, err := Get(result, "a")
136 if err != KeyPathNotFoundError {
137 t.Fatalf("expected key 'a' to be deleted, got err = %v", err)
138 }
139}

Callers

nothing calls this directly

Calls 2

DeleteFunction · 0.85
GetFunction · 0.85

Tested by

no test coverage detected