update test add wrap error
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
@@ -4,6 +4,7 @@ import (
|
|||||||
"bytes"
|
"bytes"
|
||||||
"context"
|
"context"
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
|
"fmt"
|
||||||
"io"
|
"io"
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
@@ -19,7 +20,11 @@ func TestEncodeLoad(t *testing.T) {
|
|||||||
buff := bytes.Buffer{}
|
buff := bytes.Buffer{}
|
||||||
|
|
||||||
exec, err := engine.NewEncode("json", func(w io.Writer, v interface{}) error {
|
exec, err := engine.NewEncode("json", func(w io.Writer, v interface{}) error {
|
||||||
return json.NewEncoder(w).Encode(v)
|
if err := json.NewEncoder(w).Encode(v); err != nil {
|
||||||
|
return fmt.Errorf("%w", err)
|
||||||
|
}
|
||||||
|
|
||||||
|
return nil
|
||||||
}).Load(ctx, render.NewReference("any"))
|
}).Load(ctx, render.NewReference("any"))
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
require.NoError(t, exec(ctx, &buff, map[string]string{"name": "json data"}, nil))
|
require.NoError(t, exec(ctx, &buff, map[string]string{"name": "json data"}, nil))
|
||||||
|
|||||||
Reference in New Issue
Block a user