aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorshawn <[email protected]>2024-12-05 23:02:18 +0800
committershawn <[email protected]>2024-12-05 23:02:18 +0800
commitf9b6619ed0e0d771f7812fea23cd8b514faf2b2d (patch)
treed50c1db590e53766c5534174beec3ba37f9827c6
parent7104d9034645340261ce7b590f8c7a9be484521e (diff)
fix: add test for argument length check
-rw-r--r--flag_test.go8
1 files changed, 6 insertions, 2 deletions
diff --git a/flag_test.go b/flag_test.go
index 58a5d25..0502618 100644
--- a/flag_test.go
+++ b/flag_test.go
@@ -100,6 +100,12 @@ func TestEverything(t *testing.T) {
}
}
+func TestNoArgument(t *testing.T) {
+ if GetCommandLine().Parse([]string{}) != nil {
+ t.Error("parse failed for empty argument list")
+ }
+}
+
func TestUsage(t *testing.T) {
called := false
ResetForTesting(func() { called = true })
@@ -1134,7 +1140,6 @@ func TestMultipleNormalizeFlagNameInvocations(t *testing.T) {
}
}
-//
func TestHiddenFlagInUsage(t *testing.T) {
f := NewFlagSet("bob", ContinueOnError)
f.Bool("secretFlag", true, "shhh")
@@ -1149,7 +1154,6 @@ func TestHiddenFlagInUsage(t *testing.T) {
}
}
-//
func TestHiddenFlagUsage(t *testing.T) {
f := NewFlagSet("bob", ContinueOnError)
f.Bool("secretFlag", true, "shhh")