restore 100% code coverage
This commit is contained in:
parent
5ec29ce755
commit
68948b2ac1
7
parse.go
7
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)
|
||||
|
|
|
@ -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)
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue