aboutsummaryrefslogtreecommitdiff
path: root/flag_test.go
diff options
context:
space:
mode:
Diffstat (limited to 'flag_test.go')
-rw-r--r--flag_test.go9
1 files changed, 9 insertions, 0 deletions
diff --git a/flag_test.go b/flag_test.go
index 1b4005c..e17b2aa 100644
--- a/flag_test.go
+++ b/flag_test.go
@@ -387,6 +387,9 @@ func TestShorthand(t *testing.T) {
} else if f.Args()[1] != notaflag {
t.Errorf("expected argument %q got %q", notaflag, f.Args()[1])
}
+ if f.ArgsLenAtDash() != 1 {
+ t.Errorf("expected argsLenAtDash %d got %d", f.ArgsLenAtDash(), 1)
+ }
}
func TestParse(t *testing.T) {
@@ -424,6 +427,9 @@ func TestChangedHelper(t *testing.T) {
if f.Changed("invalid") {
t.Errorf("--invalid was changed!")
}
+ if f.ArgsLenAtDash() != -1 {
+ t.Errorf("Expected argsLenAtDash: %d but got %d", -1, f.ArgsLenAtDash())
+ }
}
func replaceSeparators(name string, from []string, to string) string {
@@ -713,6 +719,9 @@ func TestTermination(t *testing.T) {
if f.Args()[1] != arg2 {
t.Errorf("expected argument %q got %q", arg2, f.Args()[1])
}
+ if f.ArgsLenAtDash() != 0 {
+ t.Errorf("expected argsLenAtDash %d got %d", 0, f.ArgsLenAtDash())
+ }
}
func TestDeprecatedFlagInDocs(t *testing.T) {