aboutsummaryrefslogtreecommitdiffstats
path: root/commands/execenv/env_test.go
blob: 3fc6e58138cb8f1cc8e9e111d7bf98b119e4aad7 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
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))
}