MCPcopy
hub / github.com/uber-go/zap / TestLevelOf

Function TestLevelOf

zapcore/level_test.go:226–259  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

224}
225
226func 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}

Callers

nothing calls this directly

Calls 2

NewNopCoreFunction · 0.85
LevelOfFunction · 0.85

Tested by

no test coverage detected