Skip to content

Commit f9b6619

Browse files
fix: add test for argument length check
1 parent 7104d90 commit f9b6619

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

flag_test.go

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,12 @@ func TestEverything(t *testing.T) {
100100
}
101101
}
102102

103+
func TestNoArgument(t *testing.T) {
104+
if GetCommandLine().Parse([]string{}) != nil {
105+
t.Error("parse failed for empty argument list")
106+
}
107+
}
108+
103109
func TestUsage(t *testing.T) {
104110
called := false
105111
ResetForTesting(func() { called = true })
@@ -1134,7 +1140,6 @@ func TestMultipleNormalizeFlagNameInvocations(t *testing.T) {
11341140
}
11351141
}
11361142

1137-
//
11381143
func TestHiddenFlagInUsage(t *testing.T) {
11391144
f := NewFlagSet("bob", ContinueOnError)
11401145
f.Bool("secretFlag", true, "shhh")
@@ -1149,7 +1154,6 @@ func TestHiddenFlagInUsage(t *testing.T) {
11491154
}
11501155
}
11511156

1152-
//
11531157
func TestHiddenFlagUsage(t *testing.T) {
11541158
f := NewFlagSet("bob", ContinueOnError)
11551159
f.Bool("secretFlag", true, "shhh")

0 commit comments

Comments
 (0)