github.com/knoebber/dotfile@v1.0.6/cli/cli_test.go (about) 1 package cli 2 3 import ( 4 "os" 5 "testing" 6 7 "github.com/stretchr/testify/assert" 8 "gopkg.in/alecthomas/kingpin.v2" 9 ) 10 11 func TestAddCommandsToApplication(t *testing.T) { 12 app := kingpin.New("dotfile", "version control optimized for single files") 13 t.Run("error", func(t *testing.T) { 14 defer os.Setenv("HOME", os.Getenv("HOME")) 15 _ = os.Unsetenv("HOME") 16 17 assert.Error(t, AddCommandsToApplication(app)) 18 }) 19 20 t.Run("ok", func(t *testing.T) { 21 assert.NoError(t, AddCommandsToApplication(app)) 22 }) 23 }