MCPcopy
hub / github.com/sirupsen/logrus / TestLevelMarshalText

Function TestLevelMarshalText

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

Source from the content-addressed store, hash-verified

38}
39
40func 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}

Callers

nothing calls this directly

Calls 3

UnmarshalTextMethod · 0.95
MarshalTextMethod · 0.80
StringMethod · 0.45

Tested by

no test coverage detected