| 1313 | } |
| 1314 | |
| 1315 | func TestLevel_String(t *testing.T) { |
| 1316 | tests := []struct { |
| 1317 | name string |
| 1318 | l Level |
| 1319 | want string |
| 1320 | }{ |
| 1321 | {"trace", TraceLevel, "trace"}, |
| 1322 | {"debug", DebugLevel, "debug"}, |
| 1323 | {"info", InfoLevel, "info"}, |
| 1324 | {"warn", WarnLevel, "warn"}, |
| 1325 | {"error", ErrorLevel, "error"}, |
| 1326 | {"fatal", FatalLevel, "fatal"}, |
| 1327 | {"panic", PanicLevel, "panic"}, |
| 1328 | {"disabled", Disabled, "disabled"}, |
| 1329 | {"nolevel", NoLevel, ""}, |
| 1330 | } |
| 1331 | for _, tt := range tests { |
| 1332 | t.Run(tt.name, func(t *testing.T) { |
| 1333 | if got := tt.l.String(); got != tt.want { |
| 1334 | t.Errorf("String() = %v, want %v", got, tt.want) |
| 1335 | } |
| 1336 | }) |
| 1337 | } |
| 1338 | } |
| 1339 | |
| 1340 | func TestLevel_MarshalText(t *testing.T) { |
| 1341 | tests := []struct { |