diff options
| author | Eric Paris <[email protected]> | 2015-04-27 15:26:07 -0500 |
|---|---|---|
| committer | Eric Paris <[email protected]> | 2015-04-27 15:26:07 -0500 |
| commit | 5a5d661298302ebb7bf7fb205a37a566b0de94d7 (patch) | |
| tree | 33d6263efa5dc8b75a2434af658e3117402792bc /flag_test.go | |
| parent | 08b1790a84badfb786d0cb0a60d6849630fc0d09 (diff) | |
| parent | f21662750abbd76e54f307765b0986b357ed8b92 (diff) | |
Merge pull request #12 from fabianofranz/master
Add support to short form with equal sign: -p=value
Diffstat (limited to 'flag_test.go')
| -rw-r--r-- | flag_test.go | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/flag_test.go b/flag_test.go index ca500dd..c4055ed 100644 --- a/flag_test.go +++ b/flag_test.go @@ -185,7 +185,8 @@ 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") - stringFlag := f.StringP("string", "s", "0", "string value") + stringaFlag := f.StringP("stringa", "s", "0", "string value") + stringzFlag := f.StringP("stringz", "z", "0", "string value") extra := "interspersed-argument" notaflag := "--i-look-like-a-flag" args := []string{ @@ -193,6 +194,7 @@ func TestShorthand(t *testing.T) { extra, "-cs", "hello", + "-z=something", "--", notaflag, } @@ -212,8 +214,11 @@ func TestShorthand(t *testing.T) { if *boolcFlag != true { t.Error("boolc flag should be true, is ", *boolcFlag) } - if *stringFlag != "hello" { - t.Error("string flag should be `hello`, is ", *stringFlag) + if *stringaFlag != "hello" { + t.Error("stringa flag should be `hello`, is ", *stringaFlag) + } + if *stringzFlag != "something" { + t.Error("stringz flag should be `something`, is ", *stringzFlag) } if len(f.Args()) != 2 { t.Error("expected one argument, got", len(f.Args())) |
