Verifies: SYS-REQ-035 [boundary] MCDC SYS-REQ-035: delete_path_is_provided=T, delete_input_is_unusable_for_requested_path=T, delete_returns_original_input_on_unusable_input=T, delete_completes_without_panic=T => TRUE
(t *testing.T)
| 312 | // Verifies: SYS-REQ-035 [boundary] |
| 313 | // MCDC SYS-REQ-035: delete_path_is_provided=T, delete_input_is_unusable_for_requested_path=T, delete_returns_original_input_on_unusable_input=T, delete_completes_without_panic=T => TRUE |
| 314 | func TestDeleteSupplementalEdgeCases(t *testing.T) { |
| 315 | cases := []struct { |
| 316 | name string |
| 317 | data string |
| 318 | keys []string |
| 319 | want string |
| 320 | }{ |
| 321 | {name: "delete last object field", data: `{"a":1,"b":2}`, keys: []string{"b"}, want: `{"a":1}`}, |
| 322 | {name: "delete first object field with space comma", data: `{"a":1 ,"b":2}`, keys: []string{"a"}, want: `{"b":2}`}, |
| 323 | {name: "delete first array element", data: `[1,2]`, keys: []string{"[0]"}, want: `[2]`}, |
| 324 | {name: "delete last array element", data: `[1,2]`, keys: []string{"[1]"}, want: `[1]`}, |
| 325 | {name: "malformed input is returned unchanged", data: `{"a":`, keys: []string{"a"}, want: `{"a":`}, |
| 326 | } |
| 327 | |
| 328 | for _, tc := range cases { |
| 329 | t.Run(tc.name, func(t *testing.T) { |
| 330 | if got := string(Delete([]byte(tc.data), tc.keys...)); got != tc.want { |
| 331 | t.Fatalf("Delete(%q, %v) = %q, want %q", tc.data, tc.keys, got, tc.want) |
| 332 | } |
| 333 | }) |
| 334 | } |
| 335 | } |
| 336 | |
| 337 | // Verifies: SYS-REQ-009 [boundary] |
| 338 | // MCDC SYS-REQ-009: N/A |
nothing calls this directly
no test coverage detected
searching dependent graphs…