-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathlogging_test.go
More file actions
47 lines (35 loc) · 821 Bytes
/
logging_test.go
File metadata and controls
47 lines (35 loc) · 821 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
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
package queue
import "testing"
func Test_internalLogger(t *testing.T) {
debugOutput := false
errorOutput := false
debug := func(...interface{}) {
debugOutput = true
}
error := func(...interface{}) {
errorOutput = true
}
SetDebugLogger(debug)
SetErrorLogger(error)
logger.Debug("test")
logger.Error("test")
if debugOutput != true {
t.Fatalf("Expected custom debug function to be used")
}
if errorOutput != true {
t.Fatalf("Expected custom error function to be used")
}
// reset tests
debugOutput = false
errorOutput = false
SetDebugLogger(nil)
SetErrorLogger(nil)
logger.Debug("test")
logger.Error("test")
if debugOutput != false {
t.Fatalf("Expected custom debug function to be reset")
}
if errorOutput != false {
t.Fatalf("Expected custom error function to be reset")
}
}