diff options
| author | Alex Flint <[email protected]> | 2016-03-04 09:35:36 -0800 |
|---|---|---|
| committer | Alex Flint <[email protected]> | 2016-03-04 09:35:36 -0800 |
| commit | 45474a9b25793b65f90da5e25190b714c2bf1953 (patch) | |
| tree | cce6f609a63555bf11eb0974469ec9f4d01ffab0 /parse_test.go | |
| parent | aaae1550b702cee36c45fdee30a58ba4cc733edd (diff) | |
| parent | 1488562b1ebdb57ebdc74e640900153fb624b2e6 (diff) | |
Merge pull request #33 from walle/multiple
Defaults for multiples, intended behaviour
Diffstat (limited to 'parse_test.go')
| -rw-r--r-- | parse_test.go | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/parse_test.go b/parse_test.go index 964c9a7..8ee6a79 100644 --- a/parse_test.go +++ b/parse_test.go @@ -250,6 +250,19 @@ func TestMultipleWithEq(t *testing.T) { assert.Equal(t, []string{"x"}, args.Bar) } +func TestMultipleWithDefault(t *testing.T) { + var args struct { + Foo []int + Bar []string + } + args.Foo = []int{42} + args.Bar = []string{"foo"} + err := parse("--foo 1 2 3 --bar x y z", &args) + require.NoError(t, err) + assert.Equal(t, []int{1, 2, 3}, args.Foo) + assert.Equal(t, []string{"x", "y", "z"}, args.Bar) +} + func TestExemptField(t *testing.T) { var args struct { Foo string |
