-
Notifications
You must be signed in to change notification settings - Fork 0
/
writer_test.go
44 lines (36 loc) · 1.08 KB
/
writer_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
37
38
39
40
41
42
43
44
package transport
import (
"strings"
"testing"
"github.com/stretchr/testify/suite"
)
type MessageWriterSuite struct {
suite.Suite
}
func (suite *MessageWriterSuite) TestLog() {
buffer := strings.Builder{}
writer := NewMessageWriter(&buffer)
writer.Log("Hello, World!")
suite.Equal(buffer.String(), "101 Log\nMessage: Hello, World!\n\n")
}
func (suite *MessageWriterSuite) TestLogf() {
buffer := strings.Builder{}
writer := NewMessageWriter(&buffer)
writer.Logf("Hello, %s", "World!")
suite.Equal(buffer.String(), "101 Log\nMessage: Hello, World!\n\n")
}
func (suite *MessageWriterSuite) TestStatus() {
buffer := strings.Builder{}
writer := NewMessageWriter(&buffer)
writer.Status("Hello, World!")
suite.Equal(buffer.String(), "102 Status\nMessage: Hello, World!\n\n")
}
func (suite *MessageWriterSuite) TestWarning() {
buffer := strings.Builder{}
writer := NewMessageWriter(&buffer)
writer.Warning("Hello, World!")
suite.Equal(buffer.String(), "104 Warning\nMessage: Hello, World!\n\n")
}
func TestMessageWriter(test *testing.T) {
suite.Run(test, new(MessageWriterSuite))
}