TestPromptHistoryCorruptLineSkipped: a malformed line (users may hand-edit the file) must not poison the valid entries around it.
(t *testing.T)
| 90 | // TestPromptHistoryCorruptLineSkipped: a malformed line (users may hand-edit |
| 91 | // the file) must not poison the valid entries around it. |
| 92 | func TestPromptHistoryCorruptLineSkipped(t *testing.T) { |
| 93 | dir := t.TempDir() |
| 94 | path := filepath.Join(dir, historyFileName) |
| 95 | body := "not a quoted line\n" + `"valid"` + "\n" |
| 96 | if err := os.WriteFile(path, []byte(body), 0o644); err != nil { |
| 97 | t.Fatal(err) |
| 98 | } |
| 99 | got := loadPromptHistory(dir) |
| 100 | if len(got) != 1 || got[0].display != "valid" { |
| 101 | t.Errorf("expected 1 valid entry, got %+v", got) |
| 102 | } |
| 103 | } |
| 104 | |
| 105 | // TestPromptHistoryConcurrentAppendsKeepBoth guards the load-then-rewrite race: |
| 106 | // two instances sharing a project dir would each read N entries and overwrite |
nothing calls this directly
no test coverage detected