This repository has been archived on 2021-05-09. You can view files and clone it, but cannot push or open issues or pull requests.
beaver/level_test.go
jolheiser 45decbb778
Initial commit
Signed-off-by: jolheiser <john.olheiser@gmail.com>
2020-01-29 20:38:15 -06:00

38 lines
630 B
Go

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()
}
})
}
}