TestPromptHistoryClear: clearPromptHistory removes the file; a missing file is not an error. Mirrors /clear semantics.
(t *testing.T)
| 71 | // TestPromptHistoryClear: clearPromptHistory removes the file; a missing file |
| 72 | // is not an error. Mirrors /clear semantics. |
| 73 | func TestPromptHistoryClear(t *testing.T) { |
| 74 | dir := t.TempDir() |
| 75 | if err := appendPromptHistory(dir, "x"); err != nil { |
| 76 | t.Fatal(err) |
| 77 | } |
| 78 | if err := clearPromptHistory(dir); err != nil { |
| 79 | t.Fatal(err) |
| 80 | } |
| 81 | if _, err := os.Stat(filepath.Join(dir, historyFileName)); !os.IsNotExist(err) { |
| 82 | t.Fatalf("history file should be gone, err=%v", err) |
| 83 | } |
| 84 | // Idempotent: clearing an already-clean dir is a no-op. |
| 85 | if err := clearPromptHistory(dir); err != nil { |
| 86 | t.Errorf("second clear must be no-op, got %v", err) |
| 87 | } |
| 88 | } |
| 89 | |
| 90 | // TestPromptHistoryCorruptLineSkipped: a malformed line (users may hand-edit |
| 91 | // the file) must not poison the valid entries around it. |
nothing calls this directly
no test coverage detected