diff --git a/bar_test.go b/bar_test.go index 2e5b785..5ad749b 100644 --- a/bar_test.go +++ b/bar_test.go @@ -88,7 +88,7 @@ strings.Repeat("=", total-till-1), ) - got := string(getLastLine(buf.Bytes())) + got := string(bytes.Split(buf.Bytes(), []byte("\n"))[0]) if !strings.Contains(got, wantBar) { t.Errorf("Want bar: %q, got bar: %q\n", wantBar, got) @@ -141,7 +141,7 @@ string(runes[2]), string(runes[4]), ) - got := string(getLastLine(buf.Bytes())) + got := string(bytes.Split(buf.Bytes(), []byte("\n"))[0]) if !strings.Contains(got, wantBar) { t.Errorf("Want bar: %q:%d, got bar: %q:%d\n", wantBar, utf8.RuneCountInString(wantBar), got, utf8.RuneCountInString(got)) @@ -284,8 +284,3 @@ return "" }) } - -func getLastLine(bb []byte) []byte { - split := bytes.Split(bb, []byte("\n")) - return split[len(split)-2] -}