aboutsummaryrefslogtreecommitdiff
path: root/flag_test.go
diff options
context:
space:
mode:
authorMatthew Jaffee <[email protected]>2017-10-16 11:40:48 -0500
committerEric Paris <[email protected]>2017-10-16 12:40:48 -0400
commit1f33b80956cde38911d1f23d764deb8d77a649ce (patch)
tree01543a38a293fc35d694ae63c21a3c66f7414e9e /flag_test.go
parenta9789e855c7696159b7db0db7f440b449edf2b31 (diff)
add int16 flag (#143)
* add int16 flag copied int32.go to int16.go and s/32/16 added a case to testParse in flag_test.go * test the set value of int16 flag
Diffstat (limited to 'flag_test.go')
-rw-r--r--flag_test.go8
1 files changed, 8 insertions, 0 deletions
diff --git a/flag_test.go b/flag_test.go
index 7454d60..f2d6f28 100644
--- a/flag_test.go
+++ b/flag_test.go
@@ -168,6 +168,7 @@ func testParse(f *FlagSet, t *testing.T) {
bool3Flag := f.Bool("bool3", false, "bool3 value")
intFlag := f.Int("int", 0, "int value")
int8Flag := f.Int8("int8", 0, "int value")
+ int16Flag := f.Int16("int16", 0, "int value")
int32Flag := f.Int32("int32", 0, "int value")
int64Flag := f.Int64("int64", 0, "int64 value")
uintFlag := f.Uint("uint", 0, "uint value")
@@ -192,6 +193,7 @@ func testParse(f *FlagSet, t *testing.T) {
"--bool3=false",
"--int=22",
"--int8=-8",
+ "--int16=-16",
"--int32=-32",
"--int64=0x23",
"--uint", "24",
@@ -236,9 +238,15 @@ func testParse(f *FlagSet, t *testing.T) {
if *int8Flag != -8 {
t.Error("int8 flag should be 0x23, is ", *int8Flag)
}
+ if *int16Flag != -16 {
+ t.Error("int16 flag should be -16, is ", *int16Flag)
+ }
if v, err := f.GetInt8("int8"); err != nil || v != *int8Flag {
t.Error("GetInt8 does not work.")
}
+ if v, err := f.GetInt16("int16"); err != nil || v != *int16Flag {
+ t.Error("GetInt16 does not work.")
+ }
if *int32Flag != -32 {
t.Error("int32 flag should be 0x23, is ", *int32Flag)
}