Codebase list golang-github-vbauerster-mpb / 03e774d
make sure every test has WithWidth Vladimir Bauer 6 years ago
1 changed file(s) with 8 addition(s) and 9 deletion(s). Raw diff Collapse all Expand all
1414 )
1515
1616 func TestBarCompleted(t *testing.T) {
17 p := New(WithOutput(ioutil.Discard))
17 p := New(WithWidth(80), WithOutput(ioutil.Discard))
1818 total := 80
1919 bar := p.AddBar(int64(total))
2020
3232 }
3333
3434 func TestBarID(t *testing.T) {
35 p := New(WithOutput(ioutil.Discard))
35 p := New(WithWidth(80), WithOutput(ioutil.Discard))
3636 total := 100
3737 wantID := 11
3838 bar := p.AddBar(int64(total), BarID(wantID))
5656 func TestBarSetRefill(t *testing.T) {
5757 var buf bytes.Buffer
5858
59 width := 100
60 p := New(WithOutput(&buf), WithWidth(width))
59 p := New(WithOutput(&buf), WithWidth(100))
6160
6261 total := 100
6362 till := 30
9089 func TestBarHas100PercentWithOnCompleteDecorator(t *testing.T) {
9190 var buf bytes.Buffer
9291
93 p := New(WithOutput(&buf), WithWidth(80))
92 p := New(WithWidth(80), WithOutput(&buf))
9493
9594 total := 50
9695
118117 func TestBarHas100PercentWithBarRemoveOnComplete(t *testing.T) {
119118 var buf bytes.Buffer
120119
121 p := New(WithOutput(&buf), WithWidth(80))
120 p := New(WithWidth(80), WithOutput(&buf))
122121
123122 total := 50
124123
144143 var buf bytes.Buffer
145144 customFormat := "╢▌▌░╟"
146145 total := 80
147 p := New(WithOutput(&buf), WithWidth(total))
146 p := New(WithWidth(total), WithOutput(&buf))
148147 bar := p.AddBar(int64(total), BarStyle(customFormat), TrimSpace())
149148
150149 for i := 0; i < total; i++ {
170169 func TestBarPanicBeforeComplete(t *testing.T) {
171170 var buf bytes.Buffer
172171 p := New(
172 WithWidth(80),
173173 WithDebugOutput(&buf),
174174 WithOutput(ioutil.Discard),
175 WithWidth(80),
176175 )
177176
178177 total := 100
210209 func TestBarPanicAfterComplete(t *testing.T) {
211210 var buf bytes.Buffer
212211 p := New(
212 WithWidth(80),
213213 WithDebugOutput(&buf),
214214 WithOutput(ioutil.Discard),
215 WithWidth(80),
216215 )
217216
218217 total := 100