diff --git a/bar_test.go b/bar_test.go index af8f4b4..3cb7981 100644 --- a/bar_test.go +++ b/bar_test.go @@ -38,7 +38,7 @@ p.Stop() - gotWidth := len(buf.Bytes()) + gotWidth := utf8.RuneCount(buf.Bytes()) if gotWidth != tc.expected { t.Errorf("%s: Expected width: %d, got: %d\n", k, tc.expected, gotWidth) } diff --git a/progress_test.go b/progress_test.go index b81bbd2..4e4729f 100644 --- a/progress_test.go +++ b/progress_test.go @@ -45,23 +45,6 @@ gotWidth := utf8.RuneCount(buf.Bytes()) if gotWidth != wantWidth+1 { // +1 for new line t.Errorf("Expected default width: %d, got: %d\n", wantWidth, gotWidth) - } -} - -func TestInvalidWidth(t *testing.T) { - var buf bytes.Buffer - p := mpb.New(mpb.WithWidth(1), mpb.Output(&buf)) - bar := p.AddBar(100, mpb.BarTrim()) - - for i := 0; i < 100; i++ { - bar.Incr(1) - } - p.Stop() - - wantWidth := 80 - gotWidth := utf8.RuneCount(buf.Bytes()) - if gotWidth != wantWidth+1 { // +1 for new line - t.Errorf("Expected width: %d, got: %d\n", wantWidth, gotWidth) } }