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.go64
1 files changed, 32 insertions, 32 deletions
diff --git a/src/pkg/flag/flag_test.go b/src/pkg/flag/flag_test.go
index 0acfc2f96..d6e642b2b 100644
--- a/src/pkg/flag/flag_test.go
+++ b/src/pkg/flag/flag_test.go
@@ -5,35 +5,35 @@
package flag_test
import (
- . "flag";
- "testing";
+ . "flag"
+ "testing"
)
var (
- test_bool = Bool("test_bool", false, "bool value");
- test_int = Int("test_int", 0, "int value");
- test_int64 = Int64("test_int64", 0, "int64 value");
- test_uint = Uint("test_uint", 0, "uint value");
- test_uint64 = Uint64("test_uint64", 0, "uint64 value");
- test_string = String("test_string", "0", "string value");
- test_float = Float("test_float", 0, "float value");
- test_float64 = Float("test_float64", 0, "float64 value");
+ test_bool = Bool("test_bool", false, "bool value")
+ test_int = Int("test_int", 0, "int value")
+ test_int64 = Int64("test_int64", 0, "int64 value")
+ test_uint = Uint("test_uint", 0, "uint value")
+ test_uint64 = Uint64("test_uint64", 0, "uint64 value")
+ test_string = String("test_string", "0", "string value")
+ test_float = Float("test_float", 0, "float value")
+ test_float64 = Float("test_float64", 0, "float64 value")
)
func boolString(s string) string {
if s == "0" {
return "false"
}
- return "true";
+ return "true"
}
func TestEverything(t *testing.T) {
- m := make(map[string]*Flag);
- desired := "0";
+ m := make(map[string]*Flag)
+ desired := "0"
visitor := func(f *Flag) {
if len(f.Name) > 5 && f.Name[0:5] == "test_" {
- m[f.Name] = f;
- ok := false;
+ m[f.Name] = f
+ ok := false
switch {
case f.Value.String() == desired:
ok = true
@@ -44,35 +44,35 @@ func TestEverything(t *testing.T) {
t.Error("Visit: bad value", f.Value.String(), "for", f.Name)
}
}
- };
- VisitAll(visitor);
+ }
+ VisitAll(visitor)
if len(m) != 8 {
- t.Error("VisitAll misses some flags");
+ t.Error("VisitAll misses some flags")
for k, v := range m {
t.Log(k, *v)
}
}
- m = make(map[string]*Flag);
- Visit(visitor);
+ m = make(map[string]*Flag)
+ Visit(visitor)
if len(m) != 0 {
- t.Errorf("Visit sees unset flags");
+ t.Errorf("Visit sees unset flags")
for k, v := range m {
t.Log(k, *v)
}
}
// Now set all flags
- Set("test_bool", "true");
- Set("test_int", "1");
- Set("test_int64", "1");
- Set("test_uint", "1");
- Set("test_uint64", "1");
- Set("test_string", "1");
- Set("test_float", "1");
- Set("test_float64", "1");
- desired = "1";
- Visit(visitor);
+ Set("test_bool", "true")
+ Set("test_int", "1")
+ Set("test_int64", "1")
+ Set("test_uint", "1")
+ Set("test_uint64", "1")
+ Set("test_string", "1")
+ Set("test_float", "1")
+ Set("test_float64", "1")
+ desired = "1"
+ Visit(visitor)
if len(m) != 8 {
- t.Error("Visit fails after set");
+ t.Error("Visit fails after set")
for k, v := range m {
t.Log(k, *v)
}