chore: add more tests (#3203)

This commit is contained in:
Kevin Wan
2023-05-04 23:43:34 +08:00
committed by GitHub
parent fe97fab274
commit 42300a7d83
2 changed files with 18 additions and 7 deletions

View File

@@ -46,7 +46,6 @@ func (b *Buffer) Bytes() []byte {
func (b *Buffer) Content() string {
var m map[string]interface{}
if err := json.Unmarshal(b.buf.Bytes(), &m); err != nil {
b.t.Error(err)
return ""
}
@@ -59,12 +58,8 @@ func (b *Buffer) Content() string {
case string:
return val
default:
bs, err := json.Marshal(content)
if err != nil {
b.t.Error(err)
return ""
}
// err is impossible to be not nil, unmarshaled from b.buf.Bytes()
bs, _ := json.Marshal(content)
return string(bs)
}
}