Codebase list golang-github-vbauerster-mpb / 7d9b39a
TestBarSetTotal Vladimir Bauer 3 years ago
1 changed file(s) with 17 addition(s) and 0 deletion(s). Raw diff Collapse all Expand all
4444
4545 if !bar.Aborted() {
4646 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")
4764 }
4865
4966 p.Wait()