Skip to content
Myr

chore: update example tests, test on ci (#735)

Before adoption: this commit came in with the history the project adopted, so no landing records it.

* chore: update example tests, test on ci Signed-off-by: Carlos Alexandro Becker <caarlos0@users.noreply.github.com> * fix: mark *.golden as binary Signed-off-by: Carlos Alexandro Becker <caarlos0@users.noreply.github.com> ---------

authored by Carlos Alexandro Becker · committed by GitHub · parent f3e1b67 · Browse files · 4 files+16 added−5 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Trailers

  • Signed-off-by: Carlos Alexandro Becker <caarlos0@users.noreply.github.com>

Diff stats

4 files+16 added−5 removed

  • other:+16 added−5 removed

4 files+16 added−5 removed

modified:.github/workflows/build.yml+4 added
modified:examples/simple/testdata/TestApp.golden+2 added-2 removed
1[?25lHi. This program will exit in 10 seconds. To quit sooner press any key2Hi. This program will exit in 9 seconds. To quit sooner press any key.1[?25lHi. This program will exit in 10 seconds. To quit sooner press any key2Hi. This program will exit in 9 seconds. To quit sooner press any key.3[?25h[?1002l[?1003l
modified:examples/simple/main_test.go+9 added-3 removed
6 unmodified lines
7 "testing"8 "time"910 tea "github.com/charmbracelet/bubbletea"11 "github.com/charmbracelet/lipgloss"12 "github.com/charmbracelet/x/exp/teatest"13 "github.com/muesli/termenv"14)1516func init() {17 lipgloss.SetColorProfile(termenv.Ascii)18}1920func TestApp(t *testing.T) {21 m := model(10)22 tm := teatest.NewTestModel(23 t, m,
15 unmodified lines
39 if err := tm.Quit(); err != nil {40 t.Fatal(err)41 }4237 out := readBts(t, tm.FinalOutput())43 out := readBts(t, tm.FinalOutput(t))44 if !regexp.MustCompile(`This program will exit in \d+ seconds`).Match(out) {45 t.Fatalf("output does not match the given regular expression: %s", string(out))46 }47 teatest.RequireEqualOutput(t, out)4843 if tm.FinalModel().(model) != 9 {49 if tm.FinalModel(t).(model) != 9 {50 t.Errorf("expected model to be 10, was %d", m)51 }52}53
22 unmodified lines
76 if err := tm.Quit(); err != nil {77 t.Fatal(err)78 }7974 if tm.FinalModel().(model) != 7 {80 if tm.FinalModel(t).(model) != 7 {81 t.Errorf("expected model to be 7, was %d", m)82 }83}84
8 unmodified lines
added:.gitattributes+1 added
1*.golden -text