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

Function TestParseAtomicLevel

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

Source from the content-addressed store, hash-verified

59}
60
61func TestParseAtomicLevel(t *testing.T) {
62 tests := []struct {
63 text string
64 level AtomicLevel
65 err string
66 }{
67 {"info", NewAtomicLevel(), ""},
68 {"DEBUG", NewAtomicLevelAt(DebugLevel), ""},
69 {"FOO", NewAtomicLevel(), `unrecognized level: "FOO"`},
70 }
71
72 for _, tt := range tests {
73 parsedAtomicLevel, err := ParseAtomicLevel(tt.text)
74 if len(tt.err) == 0 {
75 require.NoError(t, err)
76 assert.Equal(t, tt.level, parsedAtomicLevel)
77 } else {
78 assert.ErrorContains(t, err, tt.err)
79 }
80 }
81}
82
83func TestAtomicLevelMutation(t *testing.T) {
84 lvl := NewAtomicLevel()

Callers

nothing calls this directly

Calls 3

NewAtomicLevelFunction · 0.85
NewAtomicLevelAtFunction · 0.85
ParseAtomicLevelFunction · 0.85

Tested by

no test coverage detected