MCPcopy
hub / github.com/pterm/pterm / TestSpinnerPrinter_UpdateText

Function TestSpinnerPrinter_UpdateText

spinner_printer_test.go:58–76  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

56}
57
58func TestSpinnerPrinter_UpdateText(t *testing.T) {
59 t.Run("Simple", func(t *testing.T) {
60 p := pterm.DefaultSpinner
61 p.Start()
62 p.UpdateText("test")
63
64 testza.AssertEqual(t, "test", p.Text)
65 })
66
67 t.Run("Override", func(t *testing.T) {
68 out := captureStdout(func(w io.Writer) {
69 // Set a really long delay to make sure text doesn't get updated before function returns.
70 p := pterm.DefaultSpinner.WithDelay(1 * time.Hour).WithWriter(w)
71 p.Start("An initial long message")
72 p.UpdateText("A short message")
73 })
74 testza.AssertContains(t, out, "A short message")
75 })
76}
77
78func TestSpinnerPrinter_UpdateTextRawOutput(t *testing.T) {
79 pterm.DisableStyling()

Callers

nothing calls this directly

Calls 5

captureStdoutFunction · 0.85
UpdateTextMethod · 0.80
WithDelayMethod · 0.80
StartMethod · 0.45
WithWriterMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…