|
|
|
@ -346,3 +346,26 @@ func TestAppHelpPrinter(t *testing.T) {
|
|
|
|
|
t.Errorf("Help printer expected to be called, but was not")
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func TestAppCommandNotFound(t *testing.T) {
|
|
|
|
|
beforeRun, subcommandRun := false, false
|
|
|
|
|
app := cli.NewApp()
|
|
|
|
|
|
|
|
|
|
app.CommandNotFound = func(c *cli.Context, command string) {
|
|
|
|
|
beforeRun = true
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
app.Commands = []cli.Command{
|
|
|
|
|
cli.Command{
|
|
|
|
|
Name: "bar",
|
|
|
|
|
Action: func(c *cli.Context) {
|
|
|
|
|
subcommandRun = true
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
app.Run([]string{"command", "foo"})
|
|
|
|
|
|
|
|
|
|
expect(t, beforeRun, true)
|
|
|
|
|
expect(t, subcommandRun, false)
|
|
|
|
|
}
|
|
|
|
|