(t *testing.T)
| 56 | } |
| 57 | |
| 58 | func 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 | |
| 78 | func TestSpinnerPrinter_UpdateTextRawOutput(t *testing.T) { |
| 79 | pterm.DisableStyling() |
nothing calls this directly
no test coverage detected
searching dependent graphs…