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 <ole.orhagen@northern.tech> (cherry picked from commit f842187ebb32ee7d5109783d02fe9902b68ee54e)
This commit is contained in:
parent
464c868816
commit
710c8f71c4
@ -534,6 +534,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 {
|
||||
|
Loading…
Reference in New Issue
Block a user