more test cases

This commit is contained in:
Lynn Cyrin 2019-08-01 20:58:08 -07:00
parent 595382c509
commit d4740d10d0
No known key found for this signature in database
GPG Key ID: EE9CCB427DFEC897

View File

@ -893,6 +893,27 @@ func TestRequiredFlagAppRunBehavior(t *testing.T) {
appFlags: []Flag{StringFlag{Name: "requiredFlag", Required: true}},
expectedAnError: true,
},
{
testCase: "error_case_empty_input_with_required_flag",
appRunInput: []string{"myCLI", "myCommand"},
appCommands: []Command{Command{
Name: "myCommand",
Flags: []Flag{StringFlag{Name: "requiredFlag", Required: true}},
}},
expectedAnError: true,
},
{
testCase: "error_case_empty_input_with_required_flag",
appRunInput: []string{"myCLI", "myCommand", "mySubCommand"},
appCommands: []Command{Command{
Name: "myCommand",
Subcommands: []Command{Command{
Name: "mySubCommand",
Flags: []Flag{StringFlag{Name: "requiredFlag", Required: true}},
}},
}},
expectedAnError: true,
},
// expectations:
// - inputing --help, when a required flag is present, does not error
{