diff --git a/parse.go b/parse.go index 0bdddc7..c88faae 100644 --- a/parse.go +++ b/parse.go @@ -85,13 +85,6 @@ func MustParse(dest ...interface{}) *Parser { // mustParse is a helper that facilitates testing func mustParse(config Config, dest ...interface{}) *Parser { - if config.Exit == nil { - config.Exit = os.Exit - } - if config.Out == nil { - config.Out = os.Stdout - } - p, err := NewParser(config, dest...) if err != nil { fmt.Fprintln(config.Out, err) diff --git a/parse_test.go b/parse_test.go index 06e7a76..1512800 100644 --- a/parse_test.go +++ b/parse_test.go @@ -1735,3 +1735,11 @@ func TestSubcommandGlobalFlag_InCommand_Strict_Inner(t *testing.T) { assert.False(t, args.Global) assert.True(t, args.Sub.Guard) } + +func TestExitFunctionAndOutStreamGetFilledIn(t *testing.T) { + var args struct{} + p, err := NewParser(Config{}, &args) + require.NoError(t, err) + assert.NotNil(t, p.config.Exit) // go prohibits function pointer comparison + assert.Equal(t, p.config.Out, os.Stdout) +}