(t *testing.T)
| 19 | } |
| 20 | |
| 21 | func TestRegression(t *testing.T) { |
| 22 | buf := strings.Builder{} |
| 23 | |
| 24 | bar := progressbar.NewOptions(-1, |
| 25 | progressbar.OptionSetWriter(&buf), |
| 26 | progressbar.OptionSetDescription("Syncing resources..."), |
| 27 | progressbar.OptionSetItsString("resources"), |
| 28 | progressbar.OptionShowIts(), |
| 29 | progressbar.OptionSetElapsedTime(true), |
| 30 | progressbar.OptionShowCount(), |
| 31 | ) |
| 32 | bar.Reset() |
| 33 | time.Sleep(1 * time.Second) |
| 34 | expectBuffer(t, &buf, "") |
| 35 | _ = bar.Add(5) |
| 36 | expectBuffer(t, &buf, "- Syncing resources... (5/-, 5 resources/s) [1s]") |
| 37 | time.Sleep(1 * time.Second) |
| 38 | _ = bar.Add(5) |
| 39 | expectBuffer(t, &buf, "- Syncing resources... (5/-, 5 resources/s) [1s] \r \r\r| Syncing resources... (10/-, 5 resources/s) [2s]") |
| 40 | time.Sleep(1 * time.Second) |
| 41 | _ = bar.Finish() |
| 42 | expectBuffer(t, &buf, "- Syncing resources... (5/-, 5 resources/s) [1s] \r \r\r| Syncing resources... (10/-, 5 resources/s) [2s] \r \r\r- Syncing resources... (10/-, 3 resources/s) [3s]") |
| 43 | } |
| 44 | |
| 45 | func TestRegressionClearOnFinish(t *testing.T) { |
| 46 | buf := strings.Builder{} |
nothing calls this directly
no test coverage detected