forked from slack-go/slack
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathlogger_test.go
More file actions
26 lines (23 loc) · 708 Bytes
/
logger_test.go
File metadata and controls
26 lines (23 loc) · 708 Bytes
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
package slack
import (
"bytes"
"log"
"testing"
"github.com/stretchr/testify/assert"
)
func TestLogging(t *testing.T) {
buf := bytes.NewBufferString("")
logger := internalLog{logger: log.New(buf, "", 0|log.Lshortfile)}
logger.Println("test line 123")
assert.Equal(t, buf.String(), "logger_test.go:14: test line 123\n")
buf.Truncate(0)
logger.Print("test line 123")
assert.Equal(t, buf.String(), "logger_test.go:17: test line 123\n")
buf.Truncate(0)
logger.Printf("test line 123\n")
assert.Equal(t, buf.String(), "logger_test.go:20: test line 123\n")
buf.Truncate(0)
logger.Output(1, "test line 123\n")
assert.Equal(t, buf.String(), "logger_test.go:23: test line 123\n")
buf.Truncate(0)
}