Codebase list golang-github-vbauerster-mpb / 50dde81
fix TestBarPanics Vladimir Bauer 8 years ago
1 changed file(s) with 4 addition(s) and 4 deletion(s). Raw diff Collapse all Expand all
8787 func TestBarPanics(t *testing.T) {
8888 var wg sync.WaitGroup
8989 var buf bytes.Buffer
90 p := New(WithOutput(&buf), WithWaitGroup(&wg))
90 p := New(WithDebugOutput(&buf), WithOutput(nil), WithWaitGroup(&wg))
9191
9292 wantPanic := "Upps!!!"
9393 numBars := 1
116116 p.Wait()
117117
118118 wantPanic = fmt.Sprintf("panic: %s", wantPanic)
119 lastLine := getLastLine(buf.Bytes())
120119
121 if string(lastLine) != wantPanic {
122 t.Errorf("Want: %q, got: %q\n", wantPanic, string(lastLine))
120 debugStr := buf.String()
121 if !strings.Contains(debugStr, wantPanic) {
122 t.Errorf("%q doesn't contain %q\n", debugStr, wantPanic)
123123 }
124124 }