aboutsummaryrefslogtreecommitdiffstats
path: root/commands/execenv/env_testing.go
diff options
context:
space:
mode:
Diffstat (limited to 'commands/execenv/env_testing.go')
-rw-r--r--commands/execenv/env_testing.go10
1 files changed, 10 insertions, 0 deletions
diff --git a/commands/execenv/env_testing.go b/commands/execenv/env_testing.go
index 5761b410..34eafc9c 100644
--- a/commands/execenv/env_testing.go
+++ b/commands/execenv/env_testing.go
@@ -2,6 +2,7 @@ package execenv
import (
"bytes"
+ "encoding/json"
"fmt"
"testing"
@@ -27,6 +28,15 @@ func (te *TestOut) Println(a ...interface{}) {
_, _ = fmt.Fprintln(te.Buffer, a...)
}
+func (te *TestOut) PrintJSON(v interface{}) error {
+ raw, err := json.MarshalIndent(v, "", " ")
+ if err != nil {
+ return err
+ }
+ te.Println(string(raw))
+ return nil
+}
+
func NewTestEnv(t *testing.T) *Env {
t.Helper()