refactor: yet another one, someday I might be happy

This commit is contained in:
2024-03-24 03:28:08 +00:00
parent ccc3668fa2
commit de3a9e55a8
18 changed files with 613 additions and 499 deletions

View File

@@ -1,4 +1,4 @@
package render_test
package render
import (
"bytes"
@@ -6,7 +6,6 @@ import (
"errors"
"testing"
"github.com/jimeh/go-render"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
)
@@ -69,19 +68,19 @@ func TestJSON_Render(t *testing.T) {
{
name: "error from json.Marshaler",
value: &mockJSONMarshaler{err: errors.New("marshal error!!1")},
wantErrIs: []error{render.Err, render.ErrFailed},
wantErrIs: []error{Err, ErrFailed},
},
{
name: "invalid value",
pretty: false,
value: make(chan int),
wantErr: "render: failed: json: unsupported type: chan int",
wantErrIs: []error{render.Err, render.ErrFailed},
wantErrIs: []error{Err, ErrFailed},
},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
j := &render.JSON{
j := &JSON{
Pretty: tt.pretty,
Prefix: tt.prefix,
Indent: tt.indent,