Codebase list golang-github-vbauerster-mpb / 39977d9
add TestBarAborted Vladimir Bauer 4 years ago
1 changed file(s) with 18 addition(s) and 0 deletion(s). Raw diff Collapse all Expand all
2828
2929 if !bar.Completed() {
3030 t.Error("bar isn't completed after increment")
31 }
32
33 p.Wait()
34 }
35
36 func TestBarAborted(t *testing.T) {
37 p := mpb.New(mpb.WithWidth(80), mpb.WithOutput(ioutil.Discard))
38 total := 80
39 bar := p.AddBar(int64(total))
40
41 if bar.Aborted() {
42 t.Fail()
43 }
44
45 bar.Abort(false)
46
47 if !bar.Aborted() {
48 t.Error("bar isn't aborted after abort call")
3149 }
3250
3351 p.Wait()