diff --git a/cmd/root.go b/cmd/root.go index ec76178..13f71cb 100644 --- a/cmd/root.go +++ b/cmd/root.go @@ -1,8 +1,6 @@ package cmd import ( - "os" - "github.com/bdlm/log" "github.com/spf13/cobra" ) @@ -20,7 +18,8 @@ var RootCmd = &cobra.Command{ // This is called by main.main(). It only needs to happen once to the rootCmd. func Execute() { if err := RootCmd.Execute(); err != nil { - log.Fatal(err) - os.Exit(1) + // workaround for Fatal (os.Exit(1)) + //TODO https://github.com/stretchr/testify/issues/813 + log.Panic(err) } } diff --git a/main_test.go b/main_test.go index fd31a28..00f983c 100644 --- a/main_test.go +++ b/main_test.go @@ -1,7 +1,14 @@ package main -import "testing" +import ( + "testing" + + "github.com/stretchr/testify/assert" +) func TestDummy(t *testing.T) { - main() + assert := assert.New(t) + assert.Panics(func() { + main() + }) }