file_streamer_test.go 349 Bytes
Newer Older
“李磊”'s avatar
“李磊” committed
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
package file

import (
	"fmt"
	"testing"
)

func TestFileStreamer(t *testing.T) {
	fStreamer, err := NewStreamer("/tmp/test.log", false)
	if err != nil {
		t.Fatal(err)
	}
	var line string
	var ok bool
	for {
		line, ok = <-fStreamer.Lines
		if !ok {
			t.Fatal("readline err")
		}
		fmt.Println(line)
	}
	fStreamer.Close()
}