summaryrefslogtreecommitdiff
path: root/src/pkg/flag/flag_test.go
diff options
context:
space:
mode:
Diffstat (limited to 'src/pkg/flag/flag_test.go')
-rw-r--r--src/pkg/flag/flag_test.go7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/pkg/flag/flag_test.go b/src/pkg/flag/flag_test.go
index 30a21e61a..1e47d12e4 100644
--- a/src/pkg/flag/flag_test.go
+++ b/src/pkg/flag/flag_test.go
@@ -8,6 +8,7 @@ import (
. "flag"
"fmt"
"os"
+ "sort"
"testing"
)
@@ -77,6 +78,12 @@ func TestEverything(t *testing.T) {
t.Log(k, *v)
}
}
+ // Now test they're visited in sort order.
+ var flagNames []string
+ Visit(func(f *Flag) { flagNames = append(flagNames, f.Name) })
+ if !sort.StringsAreSorted(flagNames) {
+ t.Errorf("flag names not sorted: %v", flagNames)
+ }
}
func TestUsage(t *testing.T) {