summaryrefslogtreecommitdiff
path: root/parse_test.go
diff options
context:
space:
mode:
Diffstat (limited to 'parse_test.go')
-rw-r--r--parse_test.go9
1 files changed, 9 insertions, 0 deletions
diff --git a/parse_test.go b/parse_test.go
index 9cd8bce..47e9ccd 100644
--- a/parse_test.go
+++ b/parse_test.go
@@ -1083,6 +1083,15 @@ func TestDefaultOptionValues(t *testing.T) {
assert.True(t, args.G)
}
+func TestDefaultUnparseable(t *testing.T) {
+ var args struct {
+ A int `default:"x"`
+ }
+
+ err := parse("", &args)
+ assert.EqualError(t, err, `error processing default value for --a: strconv.ParseInt: parsing "x": invalid syntax`)
+}
+
func TestDefaultPositionalValues(t *testing.T) {
var args struct {
A int `arg:"positional" default:"123"`