add test for invalid durations

This commit is contained in:
Alex Flint 2016-01-23 18:35:08 -08:00
parent ed2b19f2bb
commit 64a4bab550
1 changed files with 8 additions and 0 deletions

View File

@ -63,6 +63,14 @@ func TestDuration(t *testing.T) {
assert.Equal(t, 3*time.Millisecond, args.Foo)
}
func TestInvalidDuration(t *testing.T) {
var args struct {
Foo time.Duration
}
err := parse("--foo xxx", &args)
require.Error(t, err)
}
func TestMixed(t *testing.T) {
var args struct {
Foo string `arg:"-f"`