MCPcopy
hub / github.com/rs/zerolog / TestLevel_MarshalText

Function TestLevel_MarshalText

log_test.go:1340–1365  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

1338}
1339
1340func TestLevel_MarshalText(t *testing.T) {
1341 tests := []struct {
1342 name string
1343 l Level
1344 want string
1345 }{
1346 {"trace", TraceLevel, "trace"},
1347 {"debug", DebugLevel, "debug"},
1348 {"info", InfoLevel, "info"},
1349 {"warn", WarnLevel, "warn"},
1350 {"error", ErrorLevel, "error"},
1351 {"fatal", FatalLevel, "fatal"},
1352 {"panic", PanicLevel, "panic"},
1353 {"disabled", Disabled, "disabled"},
1354 {"nolevel", NoLevel, ""},
1355 }
1356 for _, tt := range tests {
1357 t.Run(tt.name, func(t *testing.T) {
1358 if got, err := tt.l.MarshalText(); err != nil {
1359 t.Errorf("MarshalText couldn't marshal: %v", tt.l)
1360 } else if string(got) != tt.want {
1361 t.Errorf("String() = %v, want %v", string(got), tt.want)
1362 }
1363 })
1364 }
1365}
1366
1367func TestParseLevel(t *testing.T) {
1368 type args struct {

Callers

nothing calls this directly

Calls 2

MarshalTextMethod · 0.80
RunMethod · 0.65

Tested by

no test coverage detected