Skip to content

Commit

Permalink
refactoring: draw_test
Browse files Browse the repository at this point in the history
  • Loading branch information
vbauerster committed Mar 28, 2024
1 parent e94c4bc commit 40eeb0c
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions draw_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -774,17 +774,16 @@ func TestDrawDefault(t *testing.T) {
s.trimSpace = tc.trim
s.refill = tc.refill
s.completed = tc.total > 0 && tc.current >= tc.total
tmpBuf.Reset()
r, err := s.draw(newStatistics(tw, s))
if err != nil {
t.FailNow()
t.Fatalf("tw: %d case %q draw error: %s", tw, tc.name, err.Error())
}
tmpBuf.Reset()
_, err = tmpBuf.ReadFrom(r)
if err != nil {
t.FailNow()
}
by := tmpBuf.Bytes()

got := string(by[:len(by)-1])
if !utf8.ValidString(got) {
t.Fail()
Expand Down Expand Up @@ -1229,11 +1228,11 @@ func TestDrawTipOnComplete(t *testing.T) {
s.trimSpace = tc.trim
s.refill = tc.refill
s.completed = tc.total > 0 && tc.current >= tc.total
tmpBuf.Reset()
r, err := s.draw(newStatistics(tw, s))
if err != nil {
t.FailNow()
t.Fatalf("tw: %d case %q draw error: %s", tw, tc.name, err.Error())
}
tmpBuf.Reset()
_, err = tmpBuf.ReadFrom(r)
if err != nil {
t.FailNow()
Expand Down Expand Up @@ -1406,11 +1405,11 @@ func TestDrawDoubleWidth(t *testing.T) {
s.trimSpace = tc.trim
s.refill = tc.refill
s.completed = tc.total > 0 && tc.current >= tc.total
tmpBuf.Reset()
r, err := s.draw(newStatistics(tw, s))
if err != nil {
t.FailNow()
t.Fatalf("tw: %d case %q draw error: %s", tw, tc.name, err.Error())
}
tmpBuf.Reset()
_, err = tmpBuf.ReadFrom(r)
if err != nil {
t.FailNow()
Expand Down

0 comments on commit 40eeb0c

Please sign in to comment.