From f842187ebb32ee7d5109783d02fe9902b68ee54e Mon Sep 17 00:00:00 2001 From: Ole Petter Date: Sat, 2 May 2020 19:45:17 +0200 Subject: [PATCH] test(context): Added regression test for requiredFlagsError This adds a test verifying that the requiredFlagsError does contain the long option of the missing flag, instead of the short option and a space, which was the old behaviour. Signed-off-by: Ole Petter --- context_test.go | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/context_test.go b/context_test.go index a9f9312328..74f655a8c0 100644 --- a/context_test.go +++ b/context_test.go @@ -576,6 +576,14 @@ func TestCheckRequiredFlags(t *testing.T) { }, parseInput: []string{"-n", "asd", "-n", "qwe"}, }, + { + testCase: "required_flag_with_short_alias_not_printed_on_error", + expectedAnError: true, + expectedErrorContents: []string{"Required flag \"names\" not set"}, + flags: []Flag{ + StringSliceFlag{Name: "names, n", Required: true}, + }, + }, } for _, test := range tdata { t.Run(test.testCase, func(t *testing.T) {