diff --git a/bar_test.go b/bar_test.go index e6d5dd2..ac01520 100644 --- a/bar_test.go +++ b/bar_test.go @@ -91,7 +91,7 @@ func TestBarHas100PercentWithOnCompleteDecorator(t *testing.T) { var buf bytes.Buffer - p := New(WithOutput(&buf)) + p := New(WithOutput(&buf), WithWidth(80)) total := 50 @@ -119,7 +119,7 @@ func TestBarHas100PercentWithBarRemoveOnComplete(t *testing.T) { var buf bytes.Buffer - p := New(WithOutput(&buf)) + p := New(WithOutput(&buf), WithWidth(80)) total := 50 diff --git a/draw_test.go b/draw_test.go index c9f245a..abad23d 100644 --- a/draw_test.go +++ b/draw_test.go @@ -22,7 +22,7 @@ total: 60, current: 20, barWidth: 80, - want: " ", + want: "… ", }, { name: "t,c,bw{60,20,80}trim", @@ -39,7 +39,7 @@ total: 60, current: 20, barWidth: 80, - want: " ", + want: "… ", }, { name: "t,c,bw{60,20,80}trim", @@ -319,7 +319,7 @@ } var tmpBuf bytes.Buffer - for termWidth, cases := range testSuite { + for tw, cases := range testSuite { for _, tc := range cases { s := newTestState(tc.reverse) s.reqWidth = tc.barWidth @@ -332,13 +332,13 @@ } } tmpBuf.Reset() - tmpBuf.ReadFrom(s.draw(newStatistics(termWidth, s))) + tmpBuf.ReadFrom(s.draw(newStatistics(tw, s))) by := tmpBuf.Bytes() by = by[:len(by)-1] got := string(by) if got != tc.want { - t.Errorf("termWidth:%d %q want: %q %d, got: %q %d\n", termWidth, tc.name, tc.want, len(tc.want), got, len(got)) + t.Errorf("termWidth:%d %q want: %q %d, got: %q %d\n", tw, tc.name, tc.want, len(tc.want), got, len(got)) } } }