|
|
@ -61,8 +61,13 @@ func TestParseAndRunShortOpts(t *testing.T) {
|
|
|
|
{testArgs: args{"foo", "test", "-af"}, expectedErr: nil, expectedArgs: &args{}},
|
|
|
|
{testArgs: args{"foo", "test", "-af"}, expectedErr: nil, expectedArgs: &args{}},
|
|
|
|
{testArgs: args{"foo", "test", "-cf"}, expectedErr: nil, expectedArgs: &args{}},
|
|
|
|
{testArgs: args{"foo", "test", "-cf"}, expectedErr: nil, expectedArgs: &args{}},
|
|
|
|
{testArgs: args{"foo", "test", "-acf"}, expectedErr: nil, expectedArgs: &args{}},
|
|
|
|
{testArgs: args{"foo", "test", "-acf"}, expectedErr: nil, expectedArgs: &args{}},
|
|
|
|
|
|
|
|
{testArgs: args{"foo", "test", "--acf"}, expectedErr: errors.New("flag provided but not defined: -acf"), expectedArgs: nil},
|
|
|
|
{testArgs: args{"foo", "test", "-invalid"}, expectedErr: errors.New("flag provided but not defined: -invalid"), expectedArgs: nil},
|
|
|
|
{testArgs: args{"foo", "test", "-invalid"}, expectedErr: errors.New("flag provided but not defined: -invalid"), expectedArgs: nil},
|
|
|
|
|
|
|
|
{testArgs: args{"foo", "test", "-acf", "-invalid"}, expectedErr: errors.New("flag provided but not defined: -invalid"), expectedArgs: nil},
|
|
|
|
|
|
|
|
{testArgs: args{"foo", "test", "--invalid"}, expectedErr: errors.New("flag provided but not defined: -invalid"), expectedArgs: nil},
|
|
|
|
|
|
|
|
{testArgs: args{"foo", "test", "-acf", "--invalid"}, expectedErr: errors.New("flag provided but not defined: -invalid"), expectedArgs: nil},
|
|
|
|
{testArgs: args{"foo", "test", "-acf", "arg1", "-invalid"}, expectedErr: nil, expectedArgs: &args{"arg1", "-invalid"}},
|
|
|
|
{testArgs: args{"foo", "test", "-acf", "arg1", "-invalid"}, expectedErr: nil, expectedArgs: &args{"arg1", "-invalid"}},
|
|
|
|
|
|
|
|
{testArgs: args{"foo", "test", "-acf", "arg1", "--invalid"}, expectedErr: nil, expectedArgs: &args{"arg1", "--invalid"}},
|
|
|
|
{testArgs: args{"foo", "test", "-acfi", "not-arg", "arg1", "-invalid"}, expectedErr: nil, expectedArgs: &args{"arg1", "-invalid"}},
|
|
|
|
{testArgs: args{"foo", "test", "-acfi", "not-arg", "arg1", "-invalid"}, expectedErr: nil, expectedArgs: &args{"arg1", "-invalid"}},
|
|
|
|
{testArgs: args{"foo", "test", "-i", "ivalue"}, expectedErr: nil, expectedArgs: &args{}},
|
|
|
|
{testArgs: args{"foo", "test", "-i", "ivalue"}, expectedErr: nil, expectedArgs: &args{}},
|
|
|
|
{testArgs: args{"foo", "test", "-i", "ivalue", "arg1"}, expectedErr: nil, expectedArgs: &args{"arg1"}},
|
|
|
|
{testArgs: args{"foo", "test", "-i", "ivalue", "arg1"}, expectedErr: nil, expectedArgs: &args{"arg1"}},
|
|
|
@ -84,7 +89,7 @@ func TestParseAndRunShortOpts(t *testing.T) {
|
|
|
|
&BoolFlag{Name: "abc", Aliases: []string{"a"}},
|
|
|
|
&BoolFlag{Name: "abc", Aliases: []string{"a"}},
|
|
|
|
&BoolFlag{Name: "cde", Aliases: []string{"c"}},
|
|
|
|
&BoolFlag{Name: "cde", Aliases: []string{"c"}},
|
|
|
|
&BoolFlag{Name: "fgh", Aliases: []string{"f"}},
|
|
|
|
&BoolFlag{Name: "fgh", Aliases: []string{"f"}},
|
|
|
|
&StringFlag{Name: "ijk", Aliases:[]string{"i"}},
|
|
|
|
&StringFlag{Name: "ijk", Aliases: []string{"i"}},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|