Verifies: SYS-REQ-101 MCDC SYS-REQ-101: mutation_input_is_nil=T, mutation_returns_safe_result_for_nil=T => TRUE
(t *testing.T)
| 396 | // Verifies: SYS-REQ-101 |
| 397 | // MCDC SYS-REQ-101: mutation_input_is_nil=T, mutation_returns_safe_result_for_nil=T => TRUE |
| 398 | func TestMutationNilSafety(t *testing.T) { |
| 399 | t.Run("Set_nil", func(t *testing.T) { |
| 400 | defer func() { |
| 401 | if r := recover(); r != nil { |
| 402 | t.Fatalf("Set(nil) panicked: %v", r) |
| 403 | } |
| 404 | }() |
| 405 | |
| 406 | _, err := Set(nil, []byte(`"value"`), "key") |
| 407 | // Set on nil should return an error or handle gracefully |
| 408 | _ = err |
| 409 | }) |
| 410 | |
| 411 | t.Run("Delete_nil", func(t *testing.T) { |
| 412 | defer func() { |
| 413 | if r := recover(); r != nil { |
| 414 | t.Fatalf("Delete(nil) panicked: %v", r) |
| 415 | } |
| 416 | }() |
| 417 | |
| 418 | result := Delete(nil, "key") |
| 419 | // Delete on nil should return nil or empty without panic |
| 420 | _ = result |
| 421 | }) |
| 422 | } |
| 423 | |
| 424 | // Verifies: SYS-REQ-104 |
| 425 | // MCDC SYS-REQ-104: getunsafestring_input_is_nil=T, getunsafestring_returns_safe_result_for_nil=T => TRUE |