Skip to content

Commit

Permalink
Add test for unknown command
Browse files Browse the repository at this point in the history
Signed-off-by: David Gageot <[email protected]>
  • Loading branch information
dgageot committed Mar 19, 2019
1 parent a70fa5f commit 76717ae
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion cmd/skaffold/app/skaffold_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,14 @@ package app

import (
"bytes"
"io/ioutil"
"os"
"testing"

"github.com/GoogleContainerTools/skaffold/testutil"
)

func TestMain(t *testing.T) {
func TestMainHelp(t *testing.T) {
var (
output bytes.Buffer
errOutput bytes.Buffer
Expand All @@ -39,3 +40,12 @@ func TestMain(t *testing.T) {
testutil.CheckContains(t, "Available Commands", output.String())
testutil.CheckDeepEqual(t, "", errOutput.String())
}

func TestMainUnknownCommand(t *testing.T) {
defer func(args []string) { os.Args = args }(os.Args)
os.Args = []string{"skaffold", "unknown"}

err := Run(ioutil.Discard, ioutil.Discard)

testutil.CheckError(t, true, err)
}

0 comments on commit 76717ae

Please sign in to comment.