add test suite

This commit is contained in:
2026-09-15 13:11:20 +01:00
parent 9fa410e3a1
commit 9562be5e34
16 changed files with 1233 additions and 267 deletions
+2 -2
View File
@@ -56,8 +56,8 @@ func Run() error {
km.MultiSelect.Next = key.NewBinding(key.WithKeys("tab"), key.WithHelp("tab", "next field"))
km.MultiSelect.Prev = key.NewBinding(key.WithKeys("shift+tab"), key.WithHelp("shift+tab", "prev field"))
km.MultiSelect.Up = key.NewBinding(key.WithKeys("up", "k"), key.WithHelp("↑/k", "up"))
km.MultiSelect.Down = key.NewBinding(key.WithKeys("down", "j"), key.WithHelp("↓/j", "down"))
km.MultiSelect.Up = key.NewBinding(key.WithKeys("up"), key.WithHelp("↑", "up"))
km.MultiSelect.Down = key.NewBinding(key.WithKeys("down"), key.WithHelp("↓", "down"))
km.MultiSelect.Toggle = key.NewBinding(key.WithKeys("enter", " "), key.WithHelp("enter/space", "toggle"))
km.MultiSelect.Submit = key.NewBinding(key.WithKeys("tab"), key.WithHelp("tab", "next"))
km.MultiSelect.Filter = key.NewBinding(key.WithKeys("/"), key.WithHelp("/", "filter"))
+27
View File
@@ -0,0 +1,27 @@
package tui
import (
"testing"
)
func TestContainsOption_present(t *testing.T) {
opts := []string{"force", "vertical-slices", "omit-test"}
if !containsOption(opts, "vertical-slices") {
t.Error("containsOption failed to find present option")
}
}
func TestContainsOption_absent(t *testing.T) {
opts := []string{"force", "vertical-slices"}
if containsOption(opts, "omit-test") {
t.Error("containsOption found absent option")
}
}
func TestDefaultOutputDir_stable(t *testing.T) {
out1 := defaultOutputDir()
out2 := defaultOutputDir()
if out1 != out2 {
t.Error("defaultOutputDir should be deterministic for same cwd")
}
}