-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
pipe_test.go
36 lines (27 loc) · 854 Bytes
/
pipe_test.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
package ezquake_test
import (
"testing"
"github.com/stretchr/testify/assert"
"github.com/vikpe/go-ezquake"
"github.com/vikpe/go-ezquake/test_files"
)
func TestPipeWriter_Write(t *testing.T) {
username := "test"
helpers.ResetPipe(username)
pipeWriter := ezquake.NewPipeWriter(username)
pipeWriter.Write("console;;")
assert.Equal(t, "console;", helpers.ReadPipe(username))
pipeWriter.Write(" ")
assert.Equal(t, "console;", helpers.ReadPipe(username))
pipeWriter.Write("lastscores")
assert.Equal(t, "console;lastscores;", helpers.ReadPipe(username))
}
func TestPipeWriter_Clear(t *testing.T) {
username := "test"
helpers.ResetPipe(username)
pipeWriter := ezquake.NewPipeWriter(username)
pipeWriter.Write("console")
pipeWriter.Write("qtvplay 2@foo.com:28000")
pipeWriter.Clear()
assert.Equal(t, "", helpers.ReadPipe(username))
}