diff options
| author | Eric Paris <[email protected]> | 2015-05-08 13:50:18 -0400 |
|---|---|---|
| committer | Eric Paris <[email protected]> | 2015-05-08 13:50:18 -0400 |
| commit | 7bb45fd9d55ef17a0a0bdc8fcb7482e180a401b9 (patch) | |
| tree | 8d9b6f6c27f467f9df4f18e9bc9ebd608f7351cf /flag_test.go | |
| parent | 0d4b3d7112e1cd81953793e92031e43dc5a52190 (diff) | |
Support bool= with shortnames
Currently a shortname bool variable b cannot use the -b=true -b=false
form because the -b is assumed to mean true and the = format is never
noticed.
Diffstat (limited to 'flag_test.go')
| -rw-r--r-- | flag_test.go | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/flag_test.go b/flag_test.go index 7d114b2..b5956fa 100644 --- a/flag_test.go +++ b/flag_test.go @@ -184,6 +184,7 @@ func TestShorthand(t *testing.T) { boolaFlag := f.BoolP("boola", "a", false, "bool value") boolbFlag := f.BoolP("boolb", "b", false, "bool2 value") boolcFlag := f.BoolP("boolc", "c", false, "bool3 value") + booldFlag := f.BoolP("boold", "d", false, "bool4 value") stringaFlag := f.StringP("stringa", "s", "0", "string value") stringzFlag := f.StringP("stringz", "z", "0", "string value") extra := "interspersed-argument" @@ -194,6 +195,7 @@ func TestShorthand(t *testing.T) { "-cs", "hello", "-z=something", + "-d=true", "--", notaflag, } @@ -213,6 +215,9 @@ func TestShorthand(t *testing.T) { if *boolcFlag != true { t.Error("boolc flag should be true, is ", *boolcFlag) } + if *booldFlag != true { + t.Error("boold flag should be true, is ", *booldFlag) + } if *stringaFlag != "hello" { t.Error("stringa flag should be `hello`, is ", *stringaFlag) } |
