Verify shared debug binding implementation
This commit is contained in:
@@ -325,9 +325,16 @@ func TestSharedDebugDeclarationValidation(t *testing.T) {
|
||||
{BoolFlag[struct{}](FlagMeta{Name: "debug"}, false, nil)},
|
||||
{BoolFlag(FlagMeta{Name: "debug", Short: "h"}, false, func(*struct{}, Supplied[bool]) {})},
|
||||
{ValueFlag(FlagMeta{Name: "debug"}, (*bool)(nil), strconv.ParseBool, func(*struct{}, Supplied[bool]) {})},
|
||||
{OccurrenceFlag(FlagMeta{Name: "debug"}, strconv.ParseBool, func(*struct{}, Supplied[bool]) {})},
|
||||
} {
|
||||
if _, err := New(Identity{Name: "Example"}, flagAliasCommand("bad", flags...)); err == nil {
|
||||
t.Fatalf("invalid binding accepted: %#v", flags)
|
||||
}
|
||||
}
|
||||
for _, name := range []string{"quiet", "verbose", "progress", "format"} {
|
||||
flag := BoolFlag(FlagMeta{Name: name}, false, func(*struct{}, Supplied[bool]) {})
|
||||
if _, err := New(Identity{Name: "Example"}, flagAliasCommand("bad", flag)); err == nil {
|
||||
t.Errorf("reserved boolean --%s was accepted", name)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user