-
Notifications
You must be signed in to change notification settings - Fork 0
/
logger_test.go
93 lines (68 loc) · 1.61 KB
/
logger_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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
package enlog
import (
"testing"
)
func TestGetPrefix(t *testing.T) {
var l *Enlog = New()
prefix := l.InfoLog.GetPrefix()
if prefix != "INFO" {
t.Error("Expected", "INFO", "got", prefix)
}
}
func TestSetPrefix(t *testing.T) {
var l *Enlog = New()
newPrefix := "TEST"
l.InfoLog.SetPrefix(newPrefix)
prefix := l.InfoLog.GetPrefix()
if prefix != newPrefix {
t.Error("Expected", newPrefix, "got", prefix)
}
}
func TestGetUseFile(t *testing.T) {
var l *Enlog = New()
useFile := l.InfoLog.GetUseFile()
if useFile != false {
t.Error("Expected", false, "got", useFile)
}
}
func TestSetUseFile(t *testing.T) {
var l *Enlog = New()
newUseFile := false
l.InfoLog.SetUseFile(newUseFile)
useFile := l.InfoLog.GetUseFile()
if useFile != newUseFile {
t.Error("Expected", newUseFile, "got", useFile)
}
}
func TestGetFilePath(t *testing.T) {
var l *Enlog = New()
filePath := l.InfoLog.GetFilePath()
if filePath != "info.log" {
t.Error("Expected", "info.log", "got", filePath)
}
}
func TestSetFilePath(t *testing.T) {
var l *Enlog = New()
newFilePath := "test.log"
l.InfoLog.SetFilePath(newFilePath)
filePath := l.InfoLog.GetFilePath()
if filePath != newFilePath {
t.Error("Expected", newFilePath, "got", filePath)
}
}
func TestGetColor(t *testing.T) {
var l *Enlog = New()
color := l.InfoLog.GetColor()
if color != ColorGreen {
t.Error("Expected", ColorGreen, "got", color)
}
}
func TestSetColor(t *testing.T) {
var l *Enlog = New()
newColor := ColorWhite
l.InfoLog.SetColor(newColor)
color := l.InfoLog.GetColor()
if color != newColor {
t.Error("Expected", newColor, "got", color)
}
}