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)
| 121 | // Verifies: SYS-REQ-010 [boundary] |
| 122 | // MCDC SYS-REQ-010: delete_path_is_provided=T, delete_returns_empty_document_without_path=F => TRUE |
| 123 | func 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 | } |