Focus on catching fewer panics in HandleAction

so that "unknown" panics can still bubble up.
This commit is contained in:
Dan Buch
2016-06-09 17:32:00 -04:00
parent 7817f72540
commit 5a3515fdf8
2 changed files with 21 additions and 5 deletions

View File

@@ -1452,3 +1452,16 @@ func TestHandleAction_WithInvalidFuncReturnSignature(t *testing.T) {
t.Fatalf("expected error exit code to be 2, but got: %v", exitErr.ExitCode())
}
}
func TestHandleAction_WithUnknownPanic(t *testing.T) {
defer func() { refute(t, recover(), nil) }()
var fn ActionFunc
app := NewApp()
app.Action = func(ctx *Context) error {
fn(ctx)
return nil
}
HandleAction(app.Action, NewContext(app, flagSet(app.Name, app.Flags), nil))
}