Skip to content

Commit

Permalink
TestBarSetTotal
Browse files Browse the repository at this point in the history
  • Loading branch information
vbauerster committed Mar 5, 2023
1 parent b4ecb5b commit 7d9b39a
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions bar_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,23 @@ func TestBarAborted(t *testing.T) {
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()
}

func TestBarEnableTriggerCompleteAndIncrementBefore(t *testing.T) {
p := mpb.New(mpb.WithWidth(80), mpb.WithOutput(io.Discard))
bar := p.AddBar(0) // never complete bar
Expand Down

0 comments on commit 7d9b39a

Please sign in to comment.