Skip to content

Commit f5093f1

Browse files
fix test
1 parent 920dfd7 commit f5093f1

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

progressbar.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -880,6 +880,11 @@ func (p *ProgressBar) AddMax64(added int64) {
880880
p.config.useIECUnits)
881881
}
882882

883+
if p.config.max == -1 {
884+
p.lengthUnknown()
885+
} else {
886+
p.lengthKnown(p.config.max)
887+
}
883888
p.lock.Unlock() // so p.Add can lock
884889

885890
p.Add(0) // re-render

progressbar_test.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -214,9 +214,8 @@ func ExampleProgressBar_ChangeMax() {
214214

215215
func ExampleProgressBar_AddMax() {
216216
bar := NewOptions(50, OptionSetWidth(10), OptionSetPredictTime(false))
217-
bar.Add(25)
218217
bar.AddMax(50)
219-
bar.Add(75)
218+
bar.Add(100)
220219
// Output:
221220
// 100% |██████████|
222221
}

0 commit comments

Comments
 (0)