From 3d6eec825ac768894a385ca3c3156a7905c27ce3 Mon Sep 17 00:00:00 2001 From: Lynn Cyrin Date: Thu, 1 Aug 2019 20:35:23 -0700 Subject: [PATCH] add test cases --- app_test.go | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/app_test.go b/app_test.go index 6f36ef9..63f0fc4 100644 --- a/app_test.go +++ b/app_test.go @@ -916,6 +916,25 @@ func TestRequiredFlagAppRunBehavior(t *testing.T) { appRunInput: []string{"myCLI", "--requiredFlag", "cats"}, 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 { t.Run(test.testCase, func(t *testing.T) {