aboutsummaryrefslogtreecommitdiffstats
path: root/commands/execenv/env_test.go
diff options
context:
space:
mode:
Diffstat (limited to 'commands/execenv/env_test.go')
-rw-r--r--commands/execenv/env_test.go21
1 files changed, 21 insertions, 0 deletions
diff --git a/commands/execenv/env_test.go b/commands/execenv/env_test.go
new file mode 100644
index 00000000..3fc6e581
--- /dev/null
+++ b/commands/execenv/env_test.go
@@ -0,0 +1,21 @@
+package execenv
+
+import (
+ "os"
+ "testing"
+
+ "github.com/stretchr/testify/require"
+)
+
+func TestIsTerminal(t *testing.T) {
+ // easy way to get a reader and a writer
+ r, w, err := os.Pipe()
+ require.NoError(t, err)
+
+ require.False(t, isTerminal(r))
+ require.False(t, isTerminal(w))
+
+ // golang's testing framework replaces os.Stdin and os.Stdout, so the following doesn't work here
+ // require.True(t, isTerminal(os.Stdin))
+ // require.True(t, isTerminal(os.Stdout))
+}