Replace Python launcher with native Go UI

This commit is contained in:
Storm Dragon
2026-09-03 11:43:21 -04:00
parent 0d4daeb45a
commit afd4148e9a
14 changed files with 2428 additions and 961 deletions
+51
View File
@@ -0,0 +1,51 @@
package main
import (
"reflect"
"testing"
)
func TestWrapLinesPreservesParagraphsAndBoundsWidth(t *testing.T) {
got := wrap_lines("one two three\n\nfour", 7)
want := []string{"one two", "three", "", "four"}
if !reflect.DeepEqual(got, want) {
t.Fatalf("wrap_lines = %#v; want %#v", got, want)
}
}
func TestWrapLinesMakesProgressWhenRuneIsWiderThanScreen(t *testing.T) {
got := wrap_lines("界a", 1)
want := []string{"界", "a"}
if !reflect.DeepEqual(got, want) {
t.Fatalf("wrap_lines = %#v; want %#v", got, want)
}
}
func TestVisibleInputMasksPasswords(t *testing.T) {
got, cursor := visible_input([]rune("secret"), 6, true, 20)
if string(got) != "******" || cursor != 6 {
t.Fatalf("visible_input = %q at %d; want masked text at 6", string(got), cursor)
}
}
func TestVisibleInputKeepsEditingCursorOnScreen(t *testing.T) {
got, cursor := visible_input([]rune("abcdefghij"), 5, false, 4)
if string(got) != "cdef" || cursor != 3 {
t.Fatalf("visible_input = %q at %d; want cdef at 3", string(got), cursor)
}
}
func TestVisibleInputUsesTerminalColumnWidths(t *testing.T) {
got, cursor := visible_input([]rune("a界b"), 2, false, 3)
if string(got) != "界b" || cursor != 2 {
t.Fatalf("visible_input = %q at %d; want 界b at 2", string(got), cursor)
}
}
func TestChoiceLabelDoesNotChangeWithSelection(t *testing.T) {
selected := choice_label("Connect", true)
unselected := choice_label("Connect", false)
if selected != "Connect" || unselected != "Connect" {
t.Fatalf("choice labels = %q and %q; selection must be represented only by the cursor", selected, unselected)
}
}