root_test.go

 1//go:build !windows
 2// +build !windows
 3
 4package commands_test
 5
 6import (
 7	"io/ioutil"
 8	"path/filepath"
 9	"testing"
10
11	"github.com/stretchr/testify/require"
12)
13
14func requireGoldenFileEqual(t *testing.T, path string, act []byte) {
15	t.Helper()
16
17	path = filepath.Join("testdata", path)
18
19	if *update {
20		require.NoError(t, ioutil.WriteFile(path, act, 0644))
21	}
22
23	exp, err := ioutil.ReadFile(path)
24	require.NoError(t, err)
25	require.Equal(t, string(exp), string(act))
26}
27
28func TestNewRootCommand(t *testing.T) {
29	t.Skip()
30
31	testEnv := newTestEnv(t)
32	testEnv.Execute(t)
33
34	requireGoldenFileEqual(t, "root_out_golden.txt", testEnv.out.Bytes())
35}