summaryrefslogtreecommitdiff
path: root/src/pkg/encoding/binary/binary_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/encoding/binary/binary_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/encoding/binary/binary_test.go')
-rw-r--r--src/pkg/encoding/binary/binary_test.go70
1 files changed, 35 insertions, 35 deletions
diff --git a/src/pkg/encoding/binary/binary_test.go b/src/pkg/encoding/binary/binary_test.go
index 33e6b0bea..12d192d1e 100644
--- a/src/pkg/encoding/binary/binary_test.go
+++ b/src/pkg/encoding/binary/binary_test.go
@@ -5,24 +5,24 @@
package binary
import (
- "os";
- "bytes";
- "math";
- "reflect";
- "testing";
+ "os"
+ "bytes"
+ "math"
+ "reflect"
+ "testing"
)
type Struct struct {
- Int8 int8;
- Int16 int16;
- Int32 int32;
- Int64 int64;
- Uint8 uint8;
- Uint16 uint16;
- Uint32 uint32;
- Uint64 uint64;
- Float64 float64;
- Array [4]uint8;
+ Int8 int8
+ Int16 int16
+ Int32 int32
+ Int64 int64
+ Uint8 uint8
+ Uint16 uint16
+ Uint32 uint32
+ Uint64 uint64
+ Float64 float64
+ Array [4]uint8
}
var s = Struct{
@@ -69,8 +69,8 @@ var res = []int32{0x01020304, 0x05060708}
func checkResult(t *testing.T, dir string, order, err os.Error, have, want interface{}) {
if err != nil {
- t.Errorf("%v %v: %v", dir, order, err);
- return;
+ t.Errorf("%v %v: %v", dir, order, err)
+ return
}
if !reflect.DeepEqual(have, want) {
t.Errorf("%v %v:\n\thave %+v\n\twant %+v", dir, order, have, want)
@@ -78,37 +78,37 @@ func checkResult(t *testing.T, dir string, order, err os.Error, have, want inter
}
func testRead(t *testing.T, order ByteOrder, b []byte, s1 interface{}) {
- var s2 Struct;
- err := Read(bytes.NewBuffer(b), order, &s2);
- checkResult(t, "Read", order, err, s2, s1);
+ var s2 Struct
+ err := Read(bytes.NewBuffer(b), order, &s2)
+ checkResult(t, "Read", order, err, s2, s1)
}
func testWrite(t *testing.T, order ByteOrder, b []byte, s1 interface{}) {
- buf := new(bytes.Buffer);
- err := Write(buf, order, s1);
- checkResult(t, "Write", order, err, buf.Bytes(), b);
+ buf := new(bytes.Buffer)
+ err := Write(buf, order, s1)
+ checkResult(t, "Write", order, err, buf.Bytes(), b)
}
-func TestBigEndianRead(t *testing.T) { testRead(t, BigEndian, big, s) }
+func TestBigEndianRead(t *testing.T) { testRead(t, BigEndian, big, s) }
-func TestLittleEndianRead(t *testing.T) { testRead(t, LittleEndian, little, s) }
+func TestLittleEndianRead(t *testing.T) { testRead(t, LittleEndian, little, s) }
-func TestBigEndianWrite(t *testing.T) { testWrite(t, BigEndian, big, s) }
+func TestBigEndianWrite(t *testing.T) { testWrite(t, BigEndian, big, s) }
-func TestLittleEndianWrite(t *testing.T) { testWrite(t, LittleEndian, little, s) }
+func TestLittleEndianWrite(t *testing.T) { testWrite(t, LittleEndian, little, s) }
-func TestBigEndianPtrWrite(t *testing.T) { testWrite(t, BigEndian, big, &s) }
+func TestBigEndianPtrWrite(t *testing.T) { testWrite(t, BigEndian, big, &s) }
-func TestLittleEndianPtrWrite(t *testing.T) { testWrite(t, LittleEndian, little, &s) }
+func TestLittleEndianPtrWrite(t *testing.T) { testWrite(t, LittleEndian, little, &s) }
func TestReadSlice(t *testing.T) {
- slice := make([]int32, 2);
- err := Read(bytes.NewBuffer(src), BigEndian, slice);
- checkResult(t, "ReadSlice", BigEndian, err, slice, res);
+ slice := make([]int32, 2)
+ err := Read(bytes.NewBuffer(src), BigEndian, slice)
+ checkResult(t, "ReadSlice", BigEndian, err, slice, res)
}
func TestWriteSlice(t *testing.T) {
- buf := new(bytes.Buffer);
- err := Write(buf, BigEndian, res);
- checkResult(t, "WriteSlice", BigEndian, err, buf.Bytes(), src);
+ buf := new(bytes.Buffer)
+ err := Write(buf, BigEndian, res)
+ checkResult(t, "WriteSlice", BigEndian, err, buf.Bytes(), src)
}