refactoring: TestBarCount
Vladimir Bauer
3 years ago
| 22 | 22 | } |
| 23 | 23 | |
| 24 | 24 | func TestBarCount(t *testing.T) { |
| 25 | shutdown := make(chan struct{}) | |
| 26 | p := mpb.New(mpb.WithShutdownNotifier(shutdown), mpb.WithOutput(io.Discard)) | |
| 25 | p := mpb.New(mpb.WithOutput(io.Discard)) | |
| 27 | 26 | |
| 28 | 27 | b := p.AddBar(0, mpb.BarRemoveOnComplete()) |
| 29 | 28 | |
| 39 | 38 | t.Errorf("BarCount want: %d, got: %d\n", 0, count) |
| 40 | 39 | } |
| 41 | 40 | |
| 42 | go p.Wait() | |
| 43 | ||
| 44 | select { | |
| 45 | case <-shutdown: | |
| 46 | case <-time.After(timeout): | |
| 47 | t.Errorf("Progress didn't shutdown after %v", timeout) | |
| 48 | } | |
| 41 | p.Wait() | |
| 49 | 42 | } |
| 50 | 43 | |
| 51 | 44 | func TestBarAbort(t *testing.T) { |