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

Function TestLevelEnablerFunc

level_test.go:33–50  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

31)
32
33func TestLevelEnablerFunc(t *testing.T) {
34 enab := LevelEnablerFunc(func(l zapcore.Level) bool { return l == zapcore.InfoLevel })
35 tests := []struct {
36 level zapcore.Level
37 enabled bool
38 }{
39 {DebugLevel, false},
40 {InfoLevel, true},
41 {WarnLevel, false},
42 {ErrorLevel, false},
43 {DPanicLevel, false},
44 {PanicLevel, false},
45 {FatalLevel, false},
46 }
47 for _, tt := range tests {
48 assert.Equal(t, tt.enabled, enab.Enabled(tt.level), "Unexpected result applying LevelEnablerFunc to %s", tt.level)
49 }
50}
51
52func TestNewAtomicLevel(t *testing.T) {
53 lvl := NewAtomicLevel()

Callers

nothing calls this directly

Calls 2

LevelEnablerFuncFuncType · 0.85
EnabledMethod · 0.65

Tested by

no test coverage detected