cat / 012
clone

a spreadsheet for the terminal: lotus 1-2-3 looks, google sheets keys and formulas, one go binary

Notebooks: typing's pauses on a clock tests give, so no unit test waits on a debounce

Dami committed 61b082d
The hover's and the language's 80 ms pauses are timed by View.After,
tea.Tick's when nil. nbview's tests end pauses when they settle; ui's
keep them in pauses until a test ends them with endPauses.
go test -count=1 ./internal/ui: 15.3 s before, 6.9 s after (9.2 s before
the hover came); ./internal/ui/nbview 2.8 s to 1.7 s.
commit
61b082d30b9ea3e8d71ca6e991f5e51f08ccb096
parent
6c03099a895951ce3844d7178f97887bf1693d6b
author
Dami <dami.etoile@gmail.com>
kind
refactor risk score 1.3 of 3, Jev's estimate
11 files changed, +84 -7
Mdocs/contributing/testing.md6++++-
Minternal/ui/model_test.go4+++
Minternal/ui/monochrome_test.go1+
Minternal/ui/nblang_test.go6+++++
Minternal/ui/nbview/edit.go10++++++++-
Minternal/ui/nbview/hover.go4+---
Minternal/ui/nbview/hover_test.go6++++-
Minternal/ui/nbview/view.go4+++
Minternal/ui/nbview/view_test.go6+++++
Minternal/ui/notebook.go8++++++-
Ainternal/ui/pauses_test.go36++++++++++++++++++++++++++++++
M docs/contributing/testing.md +5 -1
M internal/ui/model_test.go +4 -0
M internal/ui/monochrome_test.go +1 -0
M internal/ui/nblang_test.go +6 -0
@@ -65,6 +65,7 @@ func TestNotebookAsksNuAsTrusted(t *testing.T) {
6565 m.nb.still = true6666 run(m, m.runCommand("nb.open"))6767 press(t, m, "b", "<enter>", "l")68+ endPauses(m)6869 if got := nu.asked(); !slices.Contains(got, "--ide-ast") || !slices.Contains(got, "--ide-check") {6970 t.Fatalf("a notebook made here: asked %v", got)7071 }
@@ -85,6 +86,7 @@ func TestNotebookAsksNuAsTrusted(t *testing.T) {
8586 m2.nb.still = true8687 run(m2, m2.runCommand("nb.open"))8788 press(t, m2, "<enter>", "s")89+ endPauses(m2)8890 if got := nu.asked(); len(got) != 0 {8991 t.Errorf("a file from elsewhere, not trusted: asked %v", got)9092 }
@@ -92,12 +94,14 @@ func TestNotebookAsksNuAsTrusted(t *testing.T) {
9294 run(m2, m2.runCommand("nb.run_all"))9395 press(t, m2, "<enter>") // Run this file's notebook cells? Run9496 press(t, m2, "<enter>", "s")97+ endPauses(m2)9598 if got := nu.asked(); !slices.Contains(got, "--ide-ast") {9699 t.Errorf("trusted: asked %v", got)97100 }98101 press(t, m2, "<esc>")99102 m2.nb.served = true100103 press(t, m2, "<enter>", "s")104+ endPauses(m2)101105 if got := nu.asked(); len(got) != 0 {102106 t.Errorf("served without serve-shell: asked %v", got)103107 }
@@ -147,11 +151,13 @@ func TestNotebookWordHelp(t *testing.T) {
147151 m.Update(tea.WindowSizeMsg{Width: 120, Height: 30})148152 run(m, m.runCommand("nb.open"))149153 press(t, m, "b", "<enter>", "ls | sort-by name -r", "<home>", "<right>", "<right>", "<right>", "<right>", "<right>", "<right>")154+ endPauses(m)150155 if got := line(m, contextLine); !strings.Contains(got, "sort-by <...comparator: cell-path|closure> --reverse") ||151156 !strings.Contains(got, "Sort by the given cell path or closure.") || !strings.Contains(got, "F1") {152157 t.Fatalf("context line %q", got)153158 }154159 press(t, m, "<end>")160+ endPauses(m)155161 if got := line(m, contextLine); !strings.Contains(got, "sort-by --reverse, -r") || !strings.Contains(got, "Sort in reverse order.") {156162 t.Errorf("on the flag: %q", got)157163 }
M internal/ui/nbview/edit.go +9 -1
M internal/ui/nbview/hover.go +1 -3
M internal/ui/nbview/hover_test.go +5 -1
M internal/ui/nbview/view.go +4 -0
M internal/ui/nbview/view_test.go +6 -0
M internal/ui/notebook.go +7 -1
A internal/ui/pauses_test.go +36 -0