TestBarSetTotal
Vladimir Bauer
3 years ago
| 44 | 44 | |
| 45 | 45 | if !bar.Aborted() { |
| 46 | 46 | t.Error("bar isn't aborted after abort call") |
| 47 | } | |
| 48 | ||
| 49 | p.Wait() | |
| 50 | } | |
| 51 | ||
| 52 | func TestBarSetTotal(t *testing.T) { | |
| 53 | p := mpb.New(mpb.WithWidth(80), mpb.WithOutput(io.Discard)) | |
| 54 | bar := p.AddBar(0) | |
| 55 | ||
| 56 | bar.SetTotal(0, false) | |
| 57 | if bar.Completed() { | |
| 58 | t.Error("expected bar not to complete") | |
| 59 | } | |
| 60 | ||
| 61 | bar.SetTotal(0, true) | |
| 62 | if !bar.Completed() { | |
| 63 | t.Error("expected bar to complete") | |
| 47 | 64 | } |
| 48 | 65 | |
| 49 | 66 | p.Wait() |