Capture immutable command declarations
This commit is contained in:
@@ -30,7 +30,7 @@ func TestScalarBindingsKeepDefaultsSeparateFromPresence(t *testing.T) {
|
||||
BoolFlag(FlagMeta{Name: "enabled"}, true, func(input *bindingInput, value Supplied[bool]) { input.enabled = value }),
|
||||
},
|
||||
}
|
||||
if _, err := NewCommand(spec); err != nil {
|
||||
if err := validateCommandDeclaration(NewCommand(spec)); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
defaultMessage = "changed after declaration"
|
||||
@@ -163,7 +163,7 @@ func TestRepeatArgumentAllocationReservesLaterMinimums(t *testing.T) {
|
||||
RepeatArgument(ArgumentMeta{Name: "suffix"}, 1, -1, func(value string) (string, error) { return value, nil }, func(input *operandsInput, value Supplied[[]string]) { input.suffix = value }),
|
||||
},
|
||||
}
|
||||
if _, err := NewCommand(spec); err != nil {
|
||||
if err := validateCommandDeclaration(NewCommand(spec)); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
prepared, err := prepareInput(spec, nil, []string{"a", "b", "id-1", "x", "y"}, true)
|
||||
@@ -193,7 +193,7 @@ func TestIncompletePreparationSkipsMissingRequirementsAndInputFactory(t *testing
|
||||
Flags: []Flag[struct{}]{ValueFlag(FlagMeta{Name: "required", Required: true}, (*string)(nil), func(value string) (string, error) { return value, nil }, func(*struct{}, Supplied[string]) {})},
|
||||
Arguments: []Argument[struct{}]{ValueArgument(ArgumentMeta{Name: "id"}, true, func(value string) (string, error) { return value, nil }, func(*struct{}, Supplied[string]) {})},
|
||||
}
|
||||
if _, err := NewCommand(spec); err != nil {
|
||||
if err := validateCommandDeclaration(NewCommand(spec)); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if _, err := prepareInput(spec, [][]string{nil}, nil, true); err == nil {
|
||||
|
||||
Reference in New Issue
Block a user