diff --git a/bar_test.go b/bar_test.go index a2a44b1..c87543c 100644 --- a/bar_test.go +++ b/bar_test.go @@ -82,7 +82,7 @@ got := string(getLastLine(buf.Bytes())) - if got != wantBar { + if !strings.Contains(got, wantBar) { t.Errorf("Want bar: %q, got bar: %q\n", wantBar, got) } } @@ -109,7 +109,7 @@ ) got := string(getLastLine(buf.Bytes())) - if got != wantBar { + if !strings.Contains(got, wantBar) { t.Errorf("Want bar: %q:%d, got bar: %q:%d\n", wantBar, utf8.RuneCountInString(wantBar), got, utf8.RuneCountInString(got)) } } diff --git a/progress_test.go b/progress_test.go index 3898608..d02efbc 100644 --- a/progress_test.go +++ b/progress_test.go @@ -3,7 +3,6 @@ import ( "bytes" "context" - "fmt" "io/ioutil" "math/rand" "sync" @@ -11,13 +10,6 @@ "time" "github.com/vbauerster/mpb/v4" - "github.com/vbauerster/mpb/v4/cwriter" -) - -var ( - cursorUp = fmt.Sprintf("%c[%dA", cwriter.ESC, 1) - clearLine = fmt.Sprintf("%c[2K\r", cwriter.ESC) - clearCursorAndLine = cursorUp + clearLine ) func init() { @@ -118,8 +110,7 @@ func getLastLine(bb []byte) []byte { split := bytes.Split(bb, []byte("\n")) - lastLine := split[len(split)-2] - return lastLine[len(clearCursorAndLine):] + return split[len(split)-2] } func randomDuration(max time.Duration) time.Duration {