Fix redundant error for unknown root command

This commit is contained in:
Adam Mckaig
2015-04-03 01:07:34 -04:00
parent be3cf39f80
commit 2c370cd936
2 changed files with 12 additions and 3 deletions

View File

@ -554,6 +554,15 @@ func TestRootNoCommandHelp(t *testing.T) {
}
}
func TestRootUnknownCommand(t *testing.T) {
r := noRRSetupTest("bogus")
s := "Error: unknown command \"bogus\"\nRun 'cobra-test help' for usage.\n"
if r.Output != s {
t.Errorf("Unexpected response.\nExpecting to be:\n %q\nGot:\n %q\n", s, r.Output)
}
}
func TestFlagsBeforeCommand(t *testing.T) {
// short without space
x := fullSetupTest("-i10 echo")