summaryrefslogtreecommitdiff
path: root/src/pkg/testing/quick/quick_test.go
diff options
context:
space:
mode:
authorRobert Griesemer <gri@golang.org>2009-12-15 15:41:46 -0800
committerRobert Griesemer <gri@golang.org>2009-12-15 15:41:46 -0800
commit3743fa38e180c74c51aae84eda082067e8e12523 (patch)
tree274d1d9bf832b7834ab60c65acdf945576271d14 /src/pkg/testing/quick/quick_test.go
parent13ac778ef2f757c7cd636b4336a2bd6c8f403b43 (diff)
downloadgolang-3743fa38e180c74c51aae84eda082067e8e12523.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 5th and last set of files. R=rsc CC=golang-dev http://codereview.appspot.com/180050
Diffstat (limited to 'src/pkg/testing/quick/quick_test.go')
-rw-r--r--src/pkg/testing/quick/quick_test.go114
1 files changed, 57 insertions, 57 deletions
diff --git a/src/pkg/testing/quick/quick_test.go b/src/pkg/testing/quick/quick_test.go
index b4037ab55..c7bff962b 100644
--- a/src/pkg/testing/quick/quick_test.go
+++ b/src/pkg/testing/quick/quick_test.go
@@ -5,60 +5,60 @@
package quick
import (
- "rand";
- "reflect";
- "testing";
- "os";
+ "rand"
+ "reflect"
+ "testing"
+ "os"
)
-func fBool(a bool) bool { return a }
+func fBool(a bool) bool { return a }
-func fFloat32(a float32) float32 { return a }
+func fFloat32(a float32) float32 { return a }
-func fFloat64(a float64) float64 { return a }
+func fFloat64(a float64) float64 { return a }
-func fFloat(a float) float { return a }
+func fFloat(a float) float { return a }
-func fInt16(a int16) int16 { return a }
+func fInt16(a int16) int16 { return a }
-func fInt32(a int32) int32 { return a }
+func fInt32(a int32) int32 { return a }
-func fInt64(a int64) int64 { return a }
+func fInt64(a int64) int64 { return a }
-func fInt8(a int8) int8 { return a }
+func fInt8(a int8) int8 { return a }
-func fInt(a int) int { return a }
+func fInt(a int) int { return a }
-func fUInt8(a uint8) uint8 { return a }
+func fUInt8(a uint8) uint8 { return a }
-func fMap(a map[int]int) map[int]int { return a }
+func fMap(a map[int]int) map[int]int { return a }
-func fSlice(a []byte) []byte { return a }
+func fSlice(a []byte) []byte { return a }
-func fString(a string) string { return a }
+func fString(a string) string { return a }
type TestStruct struct {
- A int;
- B string;
+ A int
+ B string
}
-func fStruct(a TestStruct) TestStruct { return a }
+func fStruct(a TestStruct) TestStruct { return a }
-func fUint16(a uint16) uint16 { return a }
+func fUint16(a uint16) uint16 { return a }
-func fUint32(a uint32) uint32 { return a }
+func fUint32(a uint32) uint32 { return a }
-func fUint64(a uint64) uint64 { return a }
+func fUint64(a uint64) uint64 { return a }
-func fUint8(a uint8) uint8 { return a }
+func fUint8(a uint8) uint8 { return a }
-func fUint(a uint) uint { return a }
+func fUint(a uint) uint { return a }
-func fUintptr(a uintptr) uintptr { return a }
+func fUintptr(a uintptr) uintptr { return a }
func fIntptr(a *int) *int {
- b := *a;
- return &b;
+ b := *a
+ return &b
}
func reportError(property string, err os.Error, t *testing.T) {
@@ -68,49 +68,49 @@ func reportError(property string, err os.Error, t *testing.T) {
}
func TestCheckEqual(t *testing.T) {
- reportError("fBool", CheckEqual(fBool, fBool, nil), t);
- reportError("fFloat32", CheckEqual(fFloat32, fFloat32, nil), t);
- reportError("fFloat64", CheckEqual(fFloat64, fFloat64, nil), t);
- reportError("fFloat", CheckEqual(fFloat, fFloat, nil), t);
- reportError("fInt16", CheckEqual(fInt16, fInt16, nil), t);
- reportError("fInt32", CheckEqual(fInt32, fInt32, nil), t);
- reportError("fInt64", CheckEqual(fInt64, fInt64, nil), t);
- reportError("fInt8", CheckEqual(fInt8, fInt8, nil), t);
- reportError("fInt", CheckEqual(fInt, fInt, nil), t);
- reportError("fUInt8", CheckEqual(fUInt8, fUInt8, nil), t);
- reportError("fInt32", CheckEqual(fInt32, fInt32, nil), t);
- reportError("fMap", CheckEqual(fMap, fMap, nil), t);
- reportError("fSlice", CheckEqual(fSlice, fSlice, nil), t);
- reportError("fString", CheckEqual(fString, fString, nil), t);
- reportError("fStruct", CheckEqual(fStruct, fStruct, nil), t);
- reportError("fUint16", CheckEqual(fUint16, fUint16, nil), t);
- reportError("fUint32", CheckEqual(fUint32, fUint32, nil), t);
- reportError("fUint64", CheckEqual(fUint64, fUint64, nil), t);
- reportError("fUint8", CheckEqual(fUint8, fUint8, nil), t);
- reportError("fUint", CheckEqual(fUint, fUint, nil), t);
- reportError("fUintptr", CheckEqual(fUintptr, fUintptr, nil), t);
- reportError("fIntptr", CheckEqual(fIntptr, fIntptr, nil), t);
+ reportError("fBool", CheckEqual(fBool, fBool, nil), t)
+ reportError("fFloat32", CheckEqual(fFloat32, fFloat32, nil), t)
+ reportError("fFloat64", CheckEqual(fFloat64, fFloat64, nil), t)
+ reportError("fFloat", CheckEqual(fFloat, fFloat, nil), t)
+ reportError("fInt16", CheckEqual(fInt16, fInt16, nil), t)
+ reportError("fInt32", CheckEqual(fInt32, fInt32, nil), t)
+ reportError("fInt64", CheckEqual(fInt64, fInt64, nil), t)
+ reportError("fInt8", CheckEqual(fInt8, fInt8, nil), t)
+ reportError("fInt", CheckEqual(fInt, fInt, nil), t)
+ reportError("fUInt8", CheckEqual(fUInt8, fUInt8, nil), t)
+ reportError("fInt32", CheckEqual(fInt32, fInt32, nil), t)
+ reportError("fMap", CheckEqual(fMap, fMap, nil), t)
+ reportError("fSlice", CheckEqual(fSlice, fSlice, nil), t)
+ reportError("fString", CheckEqual(fString, fString, nil), t)
+ reportError("fStruct", CheckEqual(fStruct, fStruct, nil), t)
+ reportError("fUint16", CheckEqual(fUint16, fUint16, nil), t)
+ reportError("fUint32", CheckEqual(fUint32, fUint32, nil), t)
+ reportError("fUint64", CheckEqual(fUint64, fUint64, nil), t)
+ reportError("fUint8", CheckEqual(fUint8, fUint8, nil), t)
+ reportError("fUint", CheckEqual(fUint, fUint, nil), t)
+ reportError("fUintptr", CheckEqual(fUintptr, fUintptr, nil), t)
+ reportError("fIntptr", CheckEqual(fIntptr, fIntptr, nil), t)
}
// This tests that ArbitraryValue is working by checking that all the arbitrary
// values of type MyStruct have x = 42.
type myStruct struct {
- x int;
+ x int
}
func (m myStruct) Generate(r *rand.Rand, _ int) reflect.Value {
return reflect.NewValue(myStruct{x: 42})
}
-func myStructProperty(in myStruct) bool { return in.x == 42 }
+func myStructProperty(in myStruct) bool { return in.x == 42 }
func TestCheckProperty(t *testing.T) {
reportError("myStructProperty", Check(myStructProperty, nil), t)
}
func TestFailure(t *testing.T) {
- f := func(x int) bool { return false };
- err := Check(f, nil);
+ f := func(x int) bool { return false }
+ err := Check(f, nil)
if err == nil {
t.Errorf("Check didn't return an error")
}
@@ -118,7 +118,7 @@ func TestFailure(t *testing.T) {
t.Errorf("Error was not a CheckError: %s", err)
}
- err = CheckEqual(fUint, fUint32, nil);
+ err = CheckEqual(fUint, fUint32, nil)
if err == nil {
t.Errorf("#1 CheckEqual didn't return an error")
}
@@ -126,7 +126,7 @@ func TestFailure(t *testing.T) {
t.Errorf("#1 Error was not a SetupError: %s", err)
}
- err = CheckEqual(func(x, y int) {}, func(x int) {}, nil);
+ err = CheckEqual(func(x, y int) {}, func(x int) {}, nil)
if err == nil {
t.Errorf("#2 CheckEqual didn't return an error")
}
@@ -134,7 +134,7 @@ func TestFailure(t *testing.T) {
t.Errorf("#2 Error was not a SetupError: %s", err)
}
- err = CheckEqual(func(x int) int { return 0 }, func(x int) int32 { return 0 }, nil);
+ err = CheckEqual(func(x int) int { return 0 }, func(x int) int32 { return 0 }, nil)
if err == nil {
t.Errorf("#3 CheckEqual didn't return an error")
}