remove wrong test
Vladimir Bauer
4 years ago
| 83 | 83 | |
| 84 | 84 | if !strings.Contains(got, wantBar) { |
| 85 | 85 | t.Errorf("Want bar: %q, got bar: %q\n", wantBar, got) |
| 86 | } | |
| 87 | } | |
| 88 | ||
| 89 | func TestBarHas100PercentWithOnCompleteDecorator(t *testing.T) { | |
| 90 | var buf bytes.Buffer | |
| 91 | ||
| 92 | p := mpb.New(mpb.WithWidth(80), mpb.WithOutput(&buf)) | |
| 93 | ||
| 94 | total := 50 | |
| 95 | ||
| 96 | bar := p.AddBar(int64(total), | |
| 97 | mpb.AppendDecorators( | |
| 98 | decor.OnComplete( | |
| 99 | decor.Percentage(), "done", | |
| 100 | ), | |
| 101 | ), | |
| 102 | ) | |
| 103 | ||
| 104 | for i := 0; i < total; i++ { | |
| 105 | bar.Increment() | |
| 106 | time.Sleep(10 * time.Millisecond) | |
| 107 | } | |
| 108 | ||
| 109 | p.Wait() | |
| 110 | ||
| 111 | hundred := "100 %" | |
| 112 | if !bytes.Contains(buf.Bytes(), []byte(hundred)) { | |
| 113 | t.Errorf("Bar's buffer does not contain: %q\n", hundred) | |
| 114 | 86 | } |
| 115 | 87 | } |
| 116 | 88 |