MCPcopy Index your code
hub / github.com/codehamr/codehamr / TestPromptHistorySkipEmpty

Function TestPromptHistorySkipEmpty

internal/tui/history_store_test.go:58–69  ·  view source on GitHub ↗

TestPromptHistorySkipEmpty: empty submits never reach the file, so a stray ↵ can't pollute recall with blanks.

(t *testing.T)

Source from the content-addressed store, hash-verified

56// TestPromptHistorySkipEmpty: empty submits never reach the file, so a stray ↵
57// can't pollute recall with blanks.
58func TestPromptHistorySkipEmpty(t *testing.T) {
59 dir := t.TempDir()
60 if err := appendPromptHistory(dir, ""); err != nil {
61 t.Fatal(err)
62 }
63 if got := loadPromptHistory(dir); len(got) != 0 {
64 t.Errorf("empty prompt should not be saved, got %d", len(got))
65 }
66 if _, err := os.Stat(filepath.Join(dir, historyFileName)); !os.IsNotExist(err) {
67 t.Errorf("history file should not exist after only-empty append, err=%v", err)
68 }
69}
70
71// TestPromptHistoryClear: clearPromptHistory removes the file; a missing file
72// is not an error. Mirrors /clear semantics.

Callers

nothing calls this directly

Calls 2

appendPromptHistoryFunction · 0.85
loadPromptHistoryFunction · 0.85

Tested by

no test coverage detected