Handle Before and After of Command without handling it as subCommand if there is no subCommand.

This commit is contained in:
Gregor Noczinski
2015-12-25 21:45:58 +01:00
parent c31a797586
commit f90cd56647
3 changed files with 53 additions and 3 deletions

View File

@@ -942,6 +942,11 @@ func TestApp_Run_SubcommandDoesNotOverwriteErrorFromBefore(t *testing.T) {
app := NewApp()
app.Commands = []Command{
Command{
Subcommands: []Command{
Command{
Name: "sub",
},
},
Name: "bar",
Before: func(c *Context) error { return fmt.Errorf("before error") },
After: func(c *Context) error { return fmt.Errorf("after error") },