Skip to content

Commit

Permalink
tests(level) : add TestMarshalText
Browse files Browse the repository at this point in the history
  • Loading branch information
seipan committed Sep 15, 2023
1 parent eb14ccf commit 72cdb82
Showing 1 changed file with 29 additions and 0 deletions.
29 changes: 29 additions & 0 deletions level_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -85,3 +85,32 @@ func TestParseLevel(t *testing.T) {
})
}
}

func TestMarshalText(t *testing.T) {
tests := []struct {
name string
reqlvl Level
reqstr string
}{
{
name: "success info level",
reqlvl: InfoLevel,
reqstr: "info",
},
{
name: "success error level",
reqlvl: ErrorLevel,
reqstr: "error",
},
}

for _, tt := range tests {
tt := tt
t.Run(tt.name, func(t *testing.T) {
res := tt.reqlvl.MarshalText()
if tt.reqstr != string(res) {
t.Errorf("marshal text err want %v, got %v", tt.reqstr, string(res))
}
})
}
}

0 comments on commit 72cdb82

Please sign in to comment.