MCPcopy Create free account
hub / github.com/codehamr/codehamr / TestPromptHistoryClear

Function TestPromptHistoryClear

internal/tui/history_store_test.go:73–88  ·  view source on GitHub ↗

TestPromptHistoryClear: clearPromptHistory removes the file; a missing file is not an error. Mirrors /clear semantics.

(t *testing.T)

Source from the content-addressed store, hash-verified

71// TestPromptHistoryClear: clearPromptHistory removes the file; a missing file
72// is not an error. Mirrors /clear semantics.
73func 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.

Callers

nothing calls this directly

Calls 2

appendPromptHistoryFunction · 0.85
clearPromptHistoryFunction · 0.85

Tested by

no test coverage detected