(t *testing.T)
| 224 | } |
| 225 | |
| 226 | func TestLevelOf(t *testing.T) { |
| 227 | tests := []struct { |
| 228 | desc string |
| 229 | give LevelEnabler |
| 230 | want Level |
| 231 | }{ |
| 232 | {desc: "debug", give: DebugLevel, want: DebugLevel}, |
| 233 | {desc: "info", give: InfoLevel, want: InfoLevel}, |
| 234 | {desc: "warn", give: WarnLevel, want: WarnLevel}, |
| 235 | {desc: "error", give: ErrorLevel, want: ErrorLevel}, |
| 236 | {desc: "dpanic", give: DPanicLevel, want: DPanicLevel}, |
| 237 | {desc: "panic", give: PanicLevel, want: PanicLevel}, |
| 238 | {desc: "fatal", give: FatalLevel, want: FatalLevel}, |
| 239 | { |
| 240 | desc: "leveledEnabler", |
| 241 | give: &enablerWithCustomLevel{lvl: InfoLevel}, |
| 242 | want: InfoLevel, |
| 243 | }, |
| 244 | { |
| 245 | desc: "noop", |
| 246 | give: NewNopCore(), // always disabled |
| 247 | want: InvalidLevel, |
| 248 | }, |
| 249 | } |
| 250 | |
| 251 | for _, tt := range tests { |
| 252 | tt := tt |
| 253 | t.Run(tt.desc, func(t *testing.T) { |
| 254 | t.Parallel() |
| 255 | |
| 256 | assert.Equal(t, tt.want, LevelOf(tt.give), "Reported level did not match.") |
| 257 | }) |
| 258 | } |
| 259 | } |
nothing calls this directly
no test coverage detected