(t *testing.T)
| 43 | } |
| 44 | |
| 45 | func TestRegressionClearOnFinish(t *testing.T) { |
| 46 | buf := strings.Builder{} |
| 47 | |
| 48 | bar := progressbar.NewOptions(-1, |
| 49 | progressbar.OptionSetWriter(&buf), |
| 50 | progressbar.OptionSetDescription("Syncing resources..."), |
| 51 | progressbar.OptionSetItsString("resources"), |
| 52 | progressbar.OptionShowIts(), |
| 53 | progressbar.OptionSetElapsedTime(true), |
| 54 | progressbar.OptionShowCount(), |
| 55 | progressbar.OptionClearOnFinish(), |
| 56 | ) |
| 57 | bar.Reset() |
| 58 | time.Sleep(1 * time.Second) |
| 59 | expectBuffer(t, &buf, "") |
| 60 | _ = bar.Add(5) |
| 61 | expectBuffer(t, &buf, "- Syncing resources... (5/-, 5 resources/s) [1s]") |
| 62 | time.Sleep(1 * time.Second) |
| 63 | _ = bar.Add(5) |
| 64 | expectBuffer(t, &buf, "- Syncing resources... (5/-, 5 resources/s) [1s] \r \r\r| Syncing resources... (10/-, 5 resources/s) [2s]") |
| 65 | time.Sleep(1 * time.Second) |
| 66 | _ = bar.Finish() |
| 67 | expectBuffer(t, &buf, "- Syncing resources... (5/-, 5 resources/s) [1s] \r \r\r| Syncing resources... (10/-, 5 resources/s) [2s]") |
| 68 | } |
nothing calls this directly
no test coverage detected