add test cases
This commit is contained in:
parent
7b9e16b6b5
commit
3d6eec825a
19
app_test.go
19
app_test.go
@ -916,6 +916,25 @@ func TestRequiredFlagAppRunBehavior(t *testing.T) {
|
|||||||
appRunInput: []string{"myCLI", "--requiredFlag", "cats"},
|
appRunInput: []string{"myCLI", "--requiredFlag", "cats"},
|
||||||
appFlags: []Flag{StringFlag{Name: "requiredFlag", Required: true}},
|
appFlags: []Flag{StringFlag{Name: "requiredFlag", Required: true}},
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
testCase: "valid_case_required_flag_input_command",
|
||||||
|
appRunInput: []string{"myCLI", "myCommand", "--requiredFlag", "cats"},
|
||||||
|
appCommands: []Command{Command{
|
||||||
|
Name: "myCommand",
|
||||||
|
Flags: []Flag{StringFlag{Name: "requiredFlag", Required: true}},
|
||||||
|
}},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
testCase: "valid_case_required_flag_input_subcommand",
|
||||||
|
appRunInput: []string{"myCLI", "myCommand", "mySubCommand", "--requiredFlag", "cats"},
|
||||||
|
appCommands: []Command{Command{
|
||||||
|
Name: "myCommand",
|
||||||
|
Subcommands: []Command{Command{
|
||||||
|
Name: "mySubCommand",
|
||||||
|
Flags: []Flag{StringFlag{Name: "requiredFlag", Required: true}},
|
||||||
|
}},
|
||||||
|
}},
|
||||||
|
},
|
||||||
}
|
}
|
||||||
for _, test := range tdata {
|
for _, test := range tdata {
|
||||||
t.Run(test.testCase, func(t *testing.T) {
|
t.Run(test.testCase, func(t *testing.T) {
|
||||||
|
Loading…
Reference in New Issue
Block a user