-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathlevel_test.go
More file actions
37 lines (32 loc) · 944 Bytes
/
level_test.go
File metadata and controls
37 lines (32 loc) · 944 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
package log_test
import (
"testing"
"github.com/goexl/log"
"github.com/goexl/log/internal/core"
"github.com/stretchr/testify/assert"
)
func TestLevel(t *testing.T) {
assert.Equal(t, log.LevelDebug, core.LevelDebug)
assert.Equal(t, log.LevelInfo, core.LevelInfo)
assert.Equal(t, log.LevelWarn, core.LevelWarn)
assert.Equal(t, log.LevelError, core.LevelError)
assert.Equal(t, log.LevelPanic, core.LevelPanic)
assert.Equal(t, log.LevelFatal, core.LevelFatal)
}
func TestParseLevel(t *testing.T) {
testcases := []struct {
in string
expected log.Level
}{
{in: "debug", expected: log.LevelDebug},
{in: "info", expected: log.LevelInfo},
{in: "warn", expected: log.LevelWarn},
{in: "error", expected: log.LevelError},
{in: "panic", expected: log.LevelPanic},
{in: "fatal", expected: log.LevelFatal},
}
for _, test := range testcases {
got := log.ParseLevel(test.in)
assert.Equal(t, test.expected, got)
}
}