|
|
@ -4,6 +4,7 @@ import ( |
|
|
|
"bytes" |
|
|
|
"context" |
|
|
|
"encoding/json" |
|
|
|
"fmt" |
|
|
|
"io" |
|
|
|
"testing" |
|
|
|
|
|
|
@ -19,7 +20,11 @@ func TestEncodeLoad(t *testing.T) { |
|
|
|
buff := bytes.Buffer{} |
|
|
|
|
|
|
|
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")) |
|
|
|
require.NoError(t, err) |
|
|
|
require.NoError(t, exec(ctx, &buff, map[string]string{"name": "json data"}, nil)) |
|
|
|