update field
Some checks failed
continuous-integration/drone/pr Build is failing
continuous-integration/drone/push Build is failing

This commit is contained in:
andrey
2024-01-02 09:55:34 +03:00
parent a3091c4eb6
commit 931b802139
28 changed files with 1608 additions and 1822 deletions

View File

@@ -7,6 +7,8 @@ import (
)
func TestMarshalJSON(t *testing.T) {
t.Parallel()
levels := map[level.Level]string{
level.Emergency: `"emerg"`,
level.Alert: `"alert"`,
@@ -22,8 +24,10 @@ func TestMarshalJSON(t *testing.T) {
actual, err := level.MarshalJSON()
if err != nil {
t.Errorf("%s got err: %s", level, err)
continue
}
if string(actual) != expect {
t.Errorf("%s got: %s expect: %s", level, actual, expect)
}
@@ -31,6 +35,8 @@ func TestMarshalJSON(t *testing.T) {
}
func TestUnmarshalJSON(t *testing.T) {
t.Parallel()
levels := map[level.Level][]string{
level.Emergency: {`"emerg"`, `"Emerg"`},
level.Alert: {`"alert"`, `"ALERT"`},
@@ -47,13 +53,13 @@ func TestUnmarshalJSON(t *testing.T) {
var level level.Level
if err := level.UnmarshalJSON([]byte(actual)); err != nil {
t.Errorf("%s got err: %s", level, err)
continue
}
if !level.Is(expect) {
t.Errorf("%s got: %s expect: %s", actual, level, expect)
}
}
}
}