From 3743fa38e180c74c51aae84eda082067e8e12523 Mon Sep 17 00:00:00 2001 From: Robert Griesemer Date: Tue, 15 Dec 2009 15:41:46 -0800 Subject: 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 5th and last set of files. R=rsc CC=golang-dev http://codereview.appspot.com/180050 --- src/pkg/time/time_test.go | 46 +++++++++++++++++++++++----------------------- 1 file changed, 23 insertions(+), 23 deletions(-) (limited to 'src/pkg/time/time_test.go') diff --git a/src/pkg/time/time_test.go b/src/pkg/time/time_test.go index 88b16ee26..23040d8ed 100644 --- a/src/pkg/time/time_test.go +++ b/src/pkg/time/time_test.go @@ -5,10 +5,10 @@ package time_test import ( - "os"; - "testing"; - "testing/quick"; - . "time"; + "os" + "testing" + "testing/quick" + . "time" ) func init() { @@ -19,8 +19,8 @@ func init() { } type TimeTest struct { - seconds int64; - golden Time; + seconds int64 + golden Time } var utctests = []TimeTest{ @@ -55,42 +55,42 @@ func same(t, u *Time) bool { func TestSecondsToUTC(t *testing.T) { for i := 0; i < len(utctests); i++ { - sec := utctests[i].seconds; - golden := &utctests[i].golden; - tm := SecondsToUTC(sec); - newsec := tm.Seconds(); + sec := utctests[i].seconds + golden := &utctests[i].golden + tm := SecondsToUTC(sec) + newsec := tm.Seconds() if newsec != sec { t.Errorf("SecondsToUTC(%d).Seconds() = %d", sec, newsec) } if !same(tm, golden) { - t.Errorf("SecondsToUTC(%d):", sec); - t.Errorf(" want=%+v", *golden); - t.Errorf(" have=%+v", *tm); + t.Errorf("SecondsToUTC(%d):", sec) + t.Errorf(" want=%+v", *golden) + t.Errorf(" have=%+v", *tm) } } } func TestSecondsToLocalTime(t *testing.T) { for i := 0; i < len(localtests); i++ { - sec := localtests[i].seconds; - golden := &localtests[i].golden; - tm := SecondsToLocalTime(sec); - newsec := tm.Seconds(); + sec := localtests[i].seconds + golden := &localtests[i].golden + tm := SecondsToLocalTime(sec) + newsec := tm.Seconds() if newsec != sec { t.Errorf("SecondsToLocalTime(%d).Seconds() = %d", sec, newsec) } if !same(tm, golden) { - t.Errorf("SecondsToLocalTime(%d):", sec); - t.Errorf(" want=%+v", *golden); - t.Errorf(" have=%+v", *tm); + t.Errorf("SecondsToLocalTime(%d):", sec) + t.Errorf(" want=%+v", *golden) + t.Errorf(" have=%+v", *tm) } } } func TestSecondsToUTCAndBack(t *testing.T) { - f := func(sec int64) bool { return SecondsToUTC(sec).Seconds() == sec }; - f32 := func(sec int32) bool { return f(int64(sec)) }; - cfg := &quick.Config{MaxCount: 10000}; + f := func(sec int64) bool { return SecondsToUTC(sec).Seconds() == sec } + f32 := func(sec int32) bool { return f(int64(sec)) } + cfg := &quick.Config{MaxCount: 10000} // Try a reasonable date first, then the huge ones. if err := quick.Check(f32, cfg); err != nil { -- cgit v1.2.3