File: writer_test.go

package info (click to toggle)
golang-github-gosuri-uilive 0.0~git20170323.ac356e6-1
  • links: PTS, VCS
  • area: main
  • in suites: bullseye, buster, sid
  • size: 244 kB
  • sloc: makefile: 4
file content (24 lines) | stat: -rw-r--r-- 337 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
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())
	}
}