diff --git a/bar_test.go b/bar_test.go index ca71513..db25d50 100644 --- a/bar_test.go +++ b/bar_test.go @@ -45,6 +45,23 @@ if !bar.Aborted() { t.Error("bar isn't aborted after abort call") + } + + p.Wait() +} + +func TestBarSetTotal(t *testing.T) { + p := mpb.New(mpb.WithWidth(80), mpb.WithOutput(io.Discard)) + bar := p.AddBar(0) + + bar.SetTotal(0, false) + if bar.Completed() { + t.Error("expected bar not to complete") + } + + bar.SetTotal(0, true) + if !bar.Completed() { + t.Error("expected bar to complete") } p.Wait()