forked from morita-kuma/golog
-
Notifications
You must be signed in to change notification settings - Fork 0
/
loglevel_test.go
53 lines (40 loc) · 934 Bytes
/
loglevel_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
package golog
import (
"testing"
"github.com/stretchr/testify/assert"
)
func TestLogLevels_Contains(t *testing.T) {
// is contains = true
func () {
logLevels := LogLevels{LogLevel_INFO, LogLevel_ERROR, LogLevel_FATAL,}
assert.Equal(t, true, logLevels.Contains(LogLevel_ERROR))
}()
// is contains = false
func () {
logLevels := LogLevels{LogLevel_FATAL}
assert.Equal(t, false, logLevels.Contains(LogLevel_DEBUG))
}()
}
func TestLogLevels_Len(t *testing.T) {
// Length is 1
func () {
logLevels := LogLevels{LogLevel_FATAL}
assert.Equal(t, 1, logLevels.Len())
}()
}
func TestLogLevels_Sort(t *testing.T) {
// is Sorted LogLevels
func () {
logLevels := LogLevels {
LogLevel_FATAL, // 5
LogLevel_TRACE, // 0
LogLevel_DEBUG, // 1
}
expected := LogLevels {
LogLevel_TRACE, // 0
LogLevel_DEBUG, // 1
LogLevel_FATAL, // 5
}
assert.Equal(t, expected, logLevels.SortAsc())
}()
}