(t *testing.T)
| 38 | } |
| 39 | |
| 40 | func TestLevelMarshalText(t *testing.T) { |
| 41 | levelStrings := []string{ |
| 42 | "panic", |
| 43 | "fatal", |
| 44 | "error", |
| 45 | "warning", |
| 46 | "info", |
| 47 | "debug", |
| 48 | "trace", |
| 49 | } |
| 50 | for idx, val := range logrus.AllLevels { |
| 51 | level := val |
| 52 | t.Run(level.String(), func(t *testing.T) { |
| 53 | var cmp logrus.Level |
| 54 | b, err := level.MarshalText() |
| 55 | require.NoError(t, err) |
| 56 | require.Equal(t, levelStrings[idx], string(b)) |
| 57 | err = cmp.UnmarshalText(b) |
| 58 | require.NoError(t, err) |
| 59 | require.Equal(t, level, cmp) |
| 60 | }) |
| 61 | } |
| 62 | } |
nothing calls this directly
no test coverage detected