Cumulative argument needs to be last (#331)

This commit is contained in:
Michal Kralik
2022-09-20 14:47:41 +02:00
committed by GitHub
parent 15aa6d8d4e
commit 9c8b401de0
2 changed files with 38 additions and 4 deletions
+18
View File
@@ -1718,3 +1718,21 @@ func TestChildNameCanBeDuplicated(t *testing.T) {
}
mustNew(t, &cli)
}
func TestCumulativeArgumentLast(t *testing.T) {
var cli struct {
Arg1 string `arg:""`
Arg2 []string `arg:""`
}
_, err := kong.New(&cli)
assert.NoError(t, err)
}
func TestCumulativeArgumentNotLast(t *testing.T) {
var cli struct {
Arg2 []string `arg:""`
Arg1 string `arg:""`
}
_, err := kong.New(&cli)
assert.Error(t, err)
}