-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathlevel_test.go
55 lines (48 loc) · 1.03 KB
/
level_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
package ledger
import (
"testing"
"github.com/franela/goblin"
. "github.com/onsi/gomega"
)
func TestLevels(t *testing.T) {
g := goblin.Goblin(t)
RegisterFailHandler(func(m string, _ ...int) { g.Fail(m) })
g.Describe("Levels", func() {
g.Describe("Stringing", func() {
g.It("should output a level as a string", func() {
testData := []struct {
in Level
out string
}{
{FatalLevel, "FATAL"},
{ErrorLevel, "ERROR"},
{WarnLevel, "WARN"},
{InfoLevel, "INFO"},
{DebugLevel, "DEBUG"},
}
for _, r := range testData {
i := r.in.String()
Expect(i).To(Equal(r.out))
}
})
})
g.Describe("Parsing", func() {
g.It("should parse a string to a level", func() {
testData := []struct {
in string
out Level
}{
{"FATAL", FatalLevel},
{"ERROR", ErrorLevel},
{"WARN", WarnLevel},
{"INFO", InfoLevel},
{"DEBUG", DebugLevel},
}
for _, r := range testData {
i := ParseLevel(r.in)
Expect(i).To(Equal(r.out))
}
})
})
})
}