MCPcopy
hub / github.com/redis/go-redis / TestLogLevel_IsValid

Function TestLogLevel_IsValid

logging/logging_test.go:24–43  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

22}
23
24func TestLogLevel_IsValid(t *testing.T) {
25 tests := []struct {
26 level LogLevelT
27 expected bool
28 }{
29 {LogLevelError, true},
30 {LogLevelWarn, true},
31 {LogLevelInfo, true},
32 {LogLevelDebug, true},
33 {LogLevelT(-1), false},
34 {LogLevelT(4), false},
35 {LogLevelT(99), false},
36 }
37
38 for _, test := range tests {
39 if got := test.level.IsValid(); got != test.expected {
40 t.Errorf("LogLevel(%d).IsValid() = %v, want %v", test.level, got, test.expected)
41 }
42 }
43}
44
45func TestLogLevelConstants(t *testing.T) {
46 // Test that constants have expected values

Callers

nothing calls this directly

Calls 2

LogLevelTTypeAlias · 0.85
IsValidMethod · 0.45

Tested by

no test coverage detected