This repository has been archived on 2021-06-21. You can view files and clone it, but cannot push or open issues/pull-requests.
beaver/level_test.go

38 lines
630 B
Go
Raw Normal View History

package beaver
import "testing"
func TestParseLevel(t *testing.T) {
tt := []struct {
Parse string
Expected Level
}{
{"T", TRACE},
{"Trace", TRACE},
{"D", DEBUG},
{"Debug", DEBUG},
{"I", INFO},
{"Info", INFO},
{"W", WARN},
{"Warn", WARN},
{"E", ERROR},
{"Error", ERROR},
{"F", FATAL},
{"Fatal", FATAL},
{"Unknown", INFO},
{"N/A", INFO},
{"1234", INFO},
{"A Space", INFO},
}
for _, tc := range tt {
t.Run(tc.Parse, func(t *testing.T) {
level := ParseLevel(tc.Parse)
if level != tc.Expected {
t.Logf("Expected `%s`, got `%s`", tc.Expected, level)
t.Fail()
}
})
}
}