TUI: Del key deletes closed/lost state files (local+SSH, live refused), sort-column ▼ marker, delete/shellquote/sort-column tests

This commit is contained in:
2026-08-06 15:23:06 +10:00
parent b24f9012d6
commit e22ddb43d4
2 changed files with 184 additions and 26 deletions

View File

@@ -172,3 +172,34 @@ func TestLegacyWindow(t *testing.T) {
}
func strptr(s string) *string { return &s }
// shellQuote must produce a POSIX-safe single-quoted argument.
func TestShellQuote(t *testing.T) {
if got := shellQuote("fix pi mcp subagent.json"); got != "'fix pi mcp subagent.json'" {
t.Fatalf("spaces: %s", got)
}
if got := shellQuote("it's a.json"); got != `'it'\''s a.json'` {
t.Fatalf("quote: %s", got)
}
}
// buildColumns marks the correct header for each sort mode.
func TestSortColumnMarker(t *testing.T) {
cols := buildColumns(sortStarted)
if cols[4].Title == "Started" || cols[4].Title == "" {
t.Fatalf("expected Started column to be marked, got %q", cols[4].Title)
}
if !strings.Contains(cols[4].Title, "▼") {
t.Fatalf("expected ▼ marker, got %q", cols[4].Title)
}
// other columns untouched
if cols[2].Title != "Folder" {
t.Fatalf("Folder column should be unmarked, got %q", cols[2].Title)
}
// activity mode has no column
for _, c := range buildColumns(sortActivity) {
if strings.Contains(c.Title, "▼") {
t.Fatalf("activity mode should not mark any column, got %q", c.Title)
}
}
}