Clean up error handling a bit.

This commit is contained in:
Alec Thomas
2018-11-03 09:49:00 +11:00
parent c0df056b14
commit fddfb973d6
4 changed files with 48 additions and 20 deletions
+9
View File
@@ -688,3 +688,12 @@ func TestParentBindings(t *testing.T) {
require.NoError(t, err)
require.Equal(t, "foo", cli.Command.value)
}
func TestNumericParamErrors(t *testing.T) {
var cli struct {
Name string
}
parser := mustNew(t, &cli)
_, err := parser.Parse([]string{"--name", "-10"})
require.EqualError(t, err, `expected string value but got "-10" (short flag)`)
}