summaryrefslogtreecommitdiff
path: root/src/pkg/flag/flag_test.go
diff options
context:
space:
mode:
authorRobert Griesemer <gri@golang.org>2009-12-15 15:27:16 -0800
committerRobert Griesemer <gri@golang.org>2009-12-15 15:27:16 -0800
commit881d6064d23d9da5c7ff368bc7d41d271290deff (patch)
tree44d5d948e3f27cc7eff15ec8cd7ee5165d9a7e90 /src/pkg/flag/flag_test.go
parentd9dfea3ebd51cea89fef8afc6b2377c2958b24f1 (diff)
downloadgolang-881d6064d23d9da5c7ff368bc7d41d271290deff.tar.gz
1) Change default gofmt default settings for
parsing and printing to new syntax. Use -oldparser to parse the old syntax, use -oldprinter to print the old syntax. 2) Change default gofmt formatting settings to use tabs for indentation only and to use spaces for alignment. This will make the code alignment insensitive to an editor's tabwidth. Use -spaces=false to use tabs for alignment. 3) Manually changed src/exp/parser/parser_test.go so that it doesn't try to parse the parser's source files using the old syntax (they have new syntax now). 4) gofmt -w src misc test/bench 2nd set of files. R=rsc CC=golang-dev http://codereview.appspot.com/179067
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)
}