From d4740d10d0cbde53a8e3132a0964464b2b50fc0b Mon Sep 17 00:00:00 2001 From: Lynn Cyrin Date: Thu, 1 Aug 2019 20:58:08 -0700 Subject: [PATCH] more test cases --- app_test.go | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/app_test.go b/app_test.go index f785a44..b469644 100644 --- a/app_test.go +++ b/app_test.go @@ -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 {