kevinschoon-pomo/vendor/github.com/gosuri/uilive/writer_test.go

25 lines
337 B
Go
Raw Normal View History

2018-01-21 11:41:29 +01:00
package uilive
import (
"bytes"
"fmt"
"testing"
)
func TestWriter(t *testing.T) {
w := New()
b := &bytes.Buffer{}
w.Out = b
w.Start()
for i := 0; i < 2; i++ {
fmt.Fprintln(w, "foo")
}
w.Stop()
fmt.Fprintln(b, "bar")
want := "foo\nfoo\nbar\n"
if b.String() != want {
t.Fatalf("want %q, got %q", want, b.String())
}
}