diff options
author | Robert Griesemer <gri@golang.org> | 2009-11-09 12:07:39 -0800 |
---|---|---|
committer | Robert Griesemer <gri@golang.org> | 2009-11-09 12:07:39 -0800 |
commit | e940edc7a026293153ba09ece40e8092a2fc2463 (patch) | |
tree | c94a425c84b7a48f91a5d76a222effad70c9a88c /src/pkg/gob/codec_test.go | |
parent | e067f862f1774ab89a2096a88571a94e3b9cd353 (diff) | |
download | golang-e940edc7a026293153ba09ece40e8092a2fc2463.tar.gz |
remove semis after statements in one-statement statement lists
R=rsc, r
http://go/go-review/1025029
Diffstat (limited to 'src/pkg/gob/codec_test.go')
-rw-r--r-- | src/pkg/gob/codec_test.go | 138 |
1 files changed, 69 insertions, 69 deletions
diff --git a/src/pkg/gob/codec_test.go b/src/pkg/gob/codec_test.go index aa3ae1cd6..4808c1146 100644 --- a/src/pkg/gob/codec_test.go +++ b/src/pkg/gob/codec_test.go @@ -47,10 +47,10 @@ func TestUintCodec(t *testing.T) { b.Reset(); encodeUint(encState, tt.x); if encState.err != nil { - t.Error("encodeUint:", tt.x, encState.err); + t.Error("encodeUint:", tt.x, encState.err) } if !bytes.Equal(tt.b, b.Bytes()) { - t.Errorf("encodeUint: %#x encode: expected % x got % x", tt.x, tt.b, b.Bytes()); + t.Errorf("encodeUint: %#x encode: expected % x got % x", tt.x, tt.b, b.Bytes()) } } decState := newDecodeState(b); @@ -58,17 +58,17 @@ func TestUintCodec(t *testing.T) { b.Reset(); encodeUint(encState, u); if encState.err != nil { - t.Error("encodeUint:", u, encState.err); + t.Error("encodeUint:", u, encState.err) } v := decodeUint(decState); if decState.err != nil { - t.Error("DecodeUint:", u, decState.err); + t.Error("DecodeUint:", u, decState.err) } if u != v { - t.Errorf("Encode/Decode: sent %#x received %#x\n", u, v); + t.Errorf("Encode/Decode: sent %#x received %#x\n", u, v) } if u&(1<<63) != 0 { - break; + break } } } @@ -79,16 +79,16 @@ func verifyInt(i int64, t *testing.T) { encState.b = b; encodeInt(encState, i); if encState.err != nil { - t.Error("encodeInt:", i, encState.err); + t.Error("encodeInt:", i, encState.err) } decState := newDecodeState(b); decState.buf = make([]byte, 8); j := decodeInt(decState); if decState.err != nil { - t.Error("DecodeInt:", i, decState.err); + t.Error("DecodeInt:", i, decState.err) } if i != j { - t.Errorf("Encode/Decode: sent %#x received %#x\n", uint64(i), uint64(j)); + t.Errorf("Encode/Decode: sent %#x received %#x\n", uint64(i), uint64(j)) } } @@ -101,7 +101,7 @@ func TestIntCodec(t *testing.T) { verifyInt(-i, t); verifyInt(^i, t); if u&(1<<63) != 0 { - break; + break } } verifyInt(-1 << 63, t); // a tricky case @@ -136,7 +136,7 @@ func TestScalarEncInstructions(t *testing.T) { state := newencoderState(b); instr.op(instr, state, unsafe.Pointer(&data)); if !bytes.Equal(boolResult, b.Bytes()) { - t.Errorf("bool enc instructions: expected % x got % x", boolResult, b.Bytes()); + t.Errorf("bool enc instructions: expected % x got % x", boolResult, b.Bytes()) } } @@ -148,7 +148,7 @@ func TestScalarEncInstructions(t *testing.T) { state := newencoderState(b); instr.op(instr, state, unsafe.Pointer(&data)); if !bytes.Equal(signedResult, b.Bytes()) { - t.Errorf("int enc instructions: expected % x got % x", signedResult, b.Bytes()); + t.Errorf("int enc instructions: expected % x got % x", signedResult, b.Bytes()) } } @@ -160,7 +160,7 @@ func TestScalarEncInstructions(t *testing.T) { state := newencoderState(b); instr.op(instr, state, unsafe.Pointer(&data)); if !bytes.Equal(unsignedResult, b.Bytes()) { - t.Errorf("uint enc instructions: expected % x got % x", unsignedResult, b.Bytes()); + t.Errorf("uint enc instructions: expected % x got % x", unsignedResult, b.Bytes()) } } @@ -172,7 +172,7 @@ func TestScalarEncInstructions(t *testing.T) { state := newencoderState(b); instr.op(instr, state, unsafe.Pointer(&data)); if !bytes.Equal(signedResult, b.Bytes()) { - t.Errorf("int8 enc instructions: expected % x got % x", signedResult, b.Bytes()); + t.Errorf("int8 enc instructions: expected % x got % x", signedResult, b.Bytes()) } } @@ -184,7 +184,7 @@ func TestScalarEncInstructions(t *testing.T) { state := newencoderState(b); instr.op(instr, state, unsafe.Pointer(&data)); if !bytes.Equal(unsignedResult, b.Bytes()) { - t.Errorf("uint8 enc instructions: expected % x got % x", unsignedResult, b.Bytes()); + t.Errorf("uint8 enc instructions: expected % x got % x", unsignedResult, b.Bytes()) } } @@ -196,7 +196,7 @@ func TestScalarEncInstructions(t *testing.T) { state := newencoderState(b); instr.op(instr, state, unsafe.Pointer(&data)); if !bytes.Equal(signedResult, b.Bytes()) { - t.Errorf("int16 enc instructions: expected % x got % x", signedResult, b.Bytes()); + t.Errorf("int16 enc instructions: expected % x got % x", signedResult, b.Bytes()) } } @@ -208,7 +208,7 @@ func TestScalarEncInstructions(t *testing.T) { state := newencoderState(b); instr.op(instr, state, unsafe.Pointer(&data)); if !bytes.Equal(unsignedResult, b.Bytes()) { - t.Errorf("uint16 enc instructions: expected % x got % x", unsignedResult, b.Bytes()); + t.Errorf("uint16 enc instructions: expected % x got % x", unsignedResult, b.Bytes()) } } @@ -220,7 +220,7 @@ func TestScalarEncInstructions(t *testing.T) { state := newencoderState(b); instr.op(instr, state, unsafe.Pointer(&data)); if !bytes.Equal(signedResult, b.Bytes()) { - t.Errorf("int32 enc instructions: expected % x got % x", signedResult, b.Bytes()); + t.Errorf("int32 enc instructions: expected % x got % x", signedResult, b.Bytes()) } } @@ -232,7 +232,7 @@ func TestScalarEncInstructions(t *testing.T) { state := newencoderState(b); instr.op(instr, state, unsafe.Pointer(&data)); if !bytes.Equal(unsignedResult, b.Bytes()) { - t.Errorf("uint32 enc instructions: expected % x got % x", unsignedResult, b.Bytes()); + t.Errorf("uint32 enc instructions: expected % x got % x", unsignedResult, b.Bytes()) } } @@ -244,7 +244,7 @@ func TestScalarEncInstructions(t *testing.T) { state := newencoderState(b); instr.op(instr, state, unsafe.Pointer(&data)); if !bytes.Equal(signedResult, b.Bytes()) { - t.Errorf("int64 enc instructions: expected % x got % x", signedResult, b.Bytes()); + t.Errorf("int64 enc instructions: expected % x got % x", signedResult, b.Bytes()) } } @@ -256,7 +256,7 @@ func TestScalarEncInstructions(t *testing.T) { state := newencoderState(b); instr.op(instr, state, unsafe.Pointer(&data)); if !bytes.Equal(unsignedResult, b.Bytes()) { - t.Errorf("uint64 enc instructions: expected % x got % x", unsignedResult, b.Bytes()); + t.Errorf("uint64 enc instructions: expected % x got % x", unsignedResult, b.Bytes()) } } @@ -268,7 +268,7 @@ func TestScalarEncInstructions(t *testing.T) { state := newencoderState(b); instr.op(instr, state, unsafe.Pointer(&data)); if !bytes.Equal(floatResult, b.Bytes()) { - t.Errorf("float enc instructions: expected % x got % x", floatResult, b.Bytes()); + t.Errorf("float enc instructions: expected % x got % x", floatResult, b.Bytes()) } } @@ -280,7 +280,7 @@ func TestScalarEncInstructions(t *testing.T) { state := newencoderState(b); instr.op(instr, state, unsafe.Pointer(&data)); if !bytes.Equal(floatResult, b.Bytes()) { - t.Errorf("float32 enc instructions: expected % x got % x", floatResult, b.Bytes()); + t.Errorf("float32 enc instructions: expected % x got % x", floatResult, b.Bytes()) } } @@ -292,7 +292,7 @@ func TestScalarEncInstructions(t *testing.T) { state := newencoderState(b); instr.op(instr, state, unsafe.Pointer(&data)); if !bytes.Equal(floatResult, b.Bytes()) { - t.Errorf("float64 enc instructions: expected % x got % x", floatResult, b.Bytes()); + t.Errorf("float64 enc instructions: expected % x got % x", floatResult, b.Bytes()) } } @@ -304,7 +304,7 @@ func TestScalarEncInstructions(t *testing.T) { state := newencoderState(b); instr.op(instr, state, unsafe.Pointer(&data)); if !bytes.Equal(bytesResult, b.Bytes()) { - t.Errorf("bytes enc instructions: expected % x got % x", bytesResult, b.Bytes()); + t.Errorf("bytes enc instructions: expected % x got % x", bytesResult, b.Bytes()) } } @@ -316,7 +316,7 @@ func TestScalarEncInstructions(t *testing.T) { state := newencoderState(b); instr.op(instr, state, unsafe.Pointer(&data)); if !bytes.Equal(bytesResult, b.Bytes()) { - t.Errorf("string enc instructions: expected % x got % x", bytesResult, b.Bytes()); + t.Errorf("string enc instructions: expected % x got % x", bytesResult, b.Bytes()) } } } @@ -324,10 +324,10 @@ func TestScalarEncInstructions(t *testing.T) { func execDec(typ string, instr *decInstr, state *decodeState, t *testing.T, p unsafe.Pointer) { v := int(decodeUint(state)); if state.err != nil { - t.Fatalf("decoding %s field: %v", typ, state.err); + t.Fatalf("decoding %s field: %v", typ, state.err) } if v + state.fieldnum != 6 { - t.Fatalf("decoding field number %d, got %d", 6, v + state.fieldnum); + t.Fatalf("decoding field number %d, got %d", 6, v + state.fieldnum) } instr.op(instr, state, decIndirect(p, instr.indir)); state.fieldnum = 6; @@ -353,7 +353,7 @@ func TestScalarDecInstructions(t *testing.T) { state := newDecodeStateFromData(boolResult); execDec("bool", instr, state, t, unsafe.Pointer(&data)); if data.a != true { - t.Errorf("bool a = %v not true", data.a); + t.Errorf("bool a = %v not true", data.a) } } // int @@ -365,7 +365,7 @@ func TestScalarDecInstructions(t *testing.T) { state := newDecodeStateFromData(signedResult); execDec("int", instr, state, t, unsafe.Pointer(&data)); if data.a != 17 { - t.Errorf("int a = %v not 17", data.a); + t.Errorf("int a = %v not 17", data.a) } } @@ -378,7 +378,7 @@ func TestScalarDecInstructions(t *testing.T) { state := newDecodeStateFromData(unsignedResult); execDec("uint", instr, state, t, unsafe.Pointer(&data)); if data.a != 17 { - t.Errorf("uint a = %v not 17", data.a); + t.Errorf("uint a = %v not 17", data.a) } } @@ -391,7 +391,7 @@ func TestScalarDecInstructions(t *testing.T) { state := newDecodeStateFromData(signedResult); execDec("int8", instr, state, t, unsafe.Pointer(&data)); if data.a != 17 { - t.Errorf("int8 a = %v not 17", data.a); + t.Errorf("int8 a = %v not 17", data.a) } } @@ -404,7 +404,7 @@ func TestScalarDecInstructions(t *testing.T) { state := newDecodeStateFromData(unsignedResult); execDec("uint8", instr, state, t, unsafe.Pointer(&data)); if data.a != 17 { - t.Errorf("uint8 a = %v not 17", data.a); + t.Errorf("uint8 a = %v not 17", data.a) } } @@ -417,7 +417,7 @@ func TestScalarDecInstructions(t *testing.T) { state := newDecodeStateFromData(signedResult); execDec("int16", instr, state, t, unsafe.Pointer(&data)); if data.a != 17 { - t.Errorf("int16 a = %v not 17", data.a); + t.Errorf("int16 a = %v not 17", data.a) } } @@ -430,7 +430,7 @@ func TestScalarDecInstructions(t *testing.T) { state := newDecodeStateFromData(unsignedResult); execDec("uint16", instr, state, t, unsafe.Pointer(&data)); if data.a != 17 { - t.Errorf("uint16 a = %v not 17", data.a); + t.Errorf("uint16 a = %v not 17", data.a) } } @@ -443,7 +443,7 @@ func TestScalarDecInstructions(t *testing.T) { state := newDecodeStateFromData(signedResult); execDec("int32", instr, state, t, unsafe.Pointer(&data)); if data.a != 17 { - t.Errorf("int32 a = %v not 17", data.a); + t.Errorf("int32 a = %v not 17", data.a) } } @@ -456,7 +456,7 @@ func TestScalarDecInstructions(t *testing.T) { state := newDecodeStateFromData(unsignedResult); execDec("uint32", instr, state, t, unsafe.Pointer(&data)); if data.a != 17 { - t.Errorf("uint32 a = %v not 17", data.a); + t.Errorf("uint32 a = %v not 17", data.a) } } @@ -469,7 +469,7 @@ func TestScalarDecInstructions(t *testing.T) { state := newDecodeStateFromData(unsignedResult); execDec("uintptr", instr, state, t, unsafe.Pointer(&data)); if data.a != 17 { - t.Errorf("uintptr a = %v not 17", data.a); + t.Errorf("uintptr a = %v not 17", data.a) } } @@ -482,7 +482,7 @@ func TestScalarDecInstructions(t *testing.T) { state := newDecodeStateFromData(signedResult); execDec("int64", instr, state, t, unsafe.Pointer(&data)); if data.a != 17 { - t.Errorf("int64 a = %v not 17", data.a); + t.Errorf("int64 a = %v not 17", data.a) } } @@ -495,7 +495,7 @@ func TestScalarDecInstructions(t *testing.T) { state := newDecodeStateFromData(unsignedResult); execDec("uint64", instr, state, t, unsafe.Pointer(&data)); if data.a != 17 { - t.Errorf("uint64 a = %v not 17", data.a); + t.Errorf("uint64 a = %v not 17", data.a) } } @@ -508,7 +508,7 @@ func TestScalarDecInstructions(t *testing.T) { state := newDecodeStateFromData(floatResult); execDec("float", instr, state, t, unsafe.Pointer(&data)); if data.a != 17 { - t.Errorf("float a = %v not 17", data.a); + t.Errorf("float a = %v not 17", data.a) } } @@ -521,7 +521,7 @@ func TestScalarDecInstructions(t *testing.T) { state := newDecodeStateFromData(floatResult); execDec("float32", instr, state, t, unsafe.Pointer(&data)); if data.a != 17 { - t.Errorf("float32 a = %v not 17", data.a); + t.Errorf("float32 a = %v not 17", data.a) } } @@ -534,7 +534,7 @@ func TestScalarDecInstructions(t *testing.T) { state := newDecodeStateFromData(floatResult); execDec("float64", instr, state, t, unsafe.Pointer(&data)); if data.a != 17 { - t.Errorf("float64 a = %v not 17", data.a); + t.Errorf("float64 a = %v not 17", data.a) } } @@ -547,7 +547,7 @@ func TestScalarDecInstructions(t *testing.T) { state := newDecodeStateFromData(bytesResult); execDec("bytes", instr, state, t, unsafe.Pointer(&data)); if string(data.a) != "hello" { - t.Errorf(`bytes a = %q not "hello"`, string(data.a)); + t.Errorf(`bytes a = %q not "hello"`, string(data.a)) } } @@ -560,7 +560,7 @@ func TestScalarDecInstructions(t *testing.T) { state := newDecodeStateFromData(bytesResult); execDec("bytes", instr, state, t, unsafe.Pointer(&data)); if data.a != "hello" { - t.Errorf(`bytes a = %q not "hello"`, data.a); + t.Errorf(`bytes a = %q not "hello"`, data.a) } } } @@ -596,7 +596,7 @@ func TestEndToEnd(t *testing.T) { var _t1 T1; decode(b, getTypeInfoNoError(reflect.Typeof(_t1)).id, &_t1); if !reflect.DeepEqual(t1, &_t1) { - t.Errorf("encode expected %v got %v", *t1, _t1); + t.Errorf("encode expected %v got %v", *t1, _t1) } } @@ -626,7 +626,7 @@ func TestOverflow(t *testing.T) { encode(b, it); err = decode(b, id, &o1); if err == nil || err.String() != `value for "maxi" out of range` { - t.Error("wrong overflow error for int8:", err); + t.Error("wrong overflow error for int8:", err) } it = inputT{ mini: math.MinInt8 - 1, @@ -635,7 +635,7 @@ func TestOverflow(t *testing.T) { encode(b, it); err = decode(b, id, &o1); if err == nil || err.String() != `value for "mini" out of range` { - t.Error("wrong underflow error for int8:", err); + t.Error("wrong underflow error for int8:", err) } // int16 @@ -651,7 +651,7 @@ func TestOverflow(t *testing.T) { encode(b, it); err = decode(b, id, &o2); if err == nil || err.String() != `value for "maxi" out of range` { - t.Error("wrong overflow error for int16:", err); + t.Error("wrong overflow error for int16:", err) } it = inputT{ mini: math.MinInt16 - 1, @@ -660,7 +660,7 @@ func TestOverflow(t *testing.T) { encode(b, it); err = decode(b, id, &o2); if err == nil || err.String() != `value for "mini" out of range` { - t.Error("wrong underflow error for int16:", err); + t.Error("wrong underflow error for int16:", err) } // int32 @@ -676,7 +676,7 @@ func TestOverflow(t *testing.T) { encode(b, it); err = decode(b, id, &o3); if err == nil || err.String() != `value for "maxi" out of range` { - t.Error("wrong overflow error for int32:", err); + t.Error("wrong overflow error for int32:", err) } it = inputT{ mini: math.MinInt32 - 1, @@ -685,7 +685,7 @@ func TestOverflow(t *testing.T) { encode(b, it); err = decode(b, id, &o3); if err == nil || err.String() != `value for "mini" out of range` { - t.Error("wrong underflow error for int32:", err); + t.Error("wrong underflow error for int32:", err) } // uint8 @@ -700,7 +700,7 @@ func TestOverflow(t *testing.T) { encode(b, it); err = decode(b, id, &o4); if err == nil || err.String() != `value for "maxu" out of range` { - t.Error("wrong overflow error for uint8:", err); + t.Error("wrong overflow error for uint8:", err) } // uint16 @@ -715,7 +715,7 @@ func TestOverflow(t *testing.T) { encode(b, it); err = decode(b, id, &o5); if err == nil || err.String() != `value for "maxu" out of range` { - t.Error("wrong overflow error for uint16:", err); + t.Error("wrong overflow error for uint16:", err) } // uint32 @@ -730,7 +730,7 @@ func TestOverflow(t *testing.T) { encode(b, it); err = decode(b, id, &o6); if err == nil || err.String() != `value for "maxu" out of range` { - t.Error("wrong overflow error for uint32:", err); + t.Error("wrong overflow error for uint32:", err) } // float32 @@ -746,7 +746,7 @@ func TestOverflow(t *testing.T) { encode(b, it); err = decode(b, id, &o7); if err == nil || err.String() != `value for "maxf" out of range` { - t.Error("wrong overflow error for float32:", err); + t.Error("wrong overflow error for float32:", err) } } @@ -765,13 +765,13 @@ func TestNesting(t *testing.T) { var drt RT; decode(b, getTypeInfoNoError(reflect.Typeof(drt)).id, &drt); if drt.a != rt.a { - t.Errorf("nesting: encode expected %v got %v", *rt, drt); + t.Errorf("nesting: encode expected %v got %v", *rt, drt) } if drt.next == nil { - t.Errorf("nesting: recursion failed"); + t.Errorf("nesting: recursion failed") } if drt.next.a != rt.next.a { - t.Errorf("nesting: encode expected %v got %v", *rt.next, *drt.next); + t.Errorf("nesting: encode expected %v got %v", *rt.next, *drt.next) } } @@ -814,7 +814,7 @@ func TestAutoIndirection(t *testing.T) { t0Id := getTypeInfoNoError(reflect.Typeof(t0)).id; decode(b, t0Id, &t0); if t0.a != 17 || t0.b != 177 || t0.c != 1777 || t0.d != 17777 { - t.Errorf("t1->t0: expected {17 177 1777 17777}; got %v", t0); + t.Errorf("t1->t0: expected {17 177 1777 17777}; got %v", t0) } // Now transfer t2 into t0 @@ -834,7 +834,7 @@ func TestAutoIndirection(t *testing.T) { t0 = T0{}; decode(b, t0Id, &t0); if t0.a != 17 || t0.b != 177 || t0.c != 1777 || t0.d != 17777 { - t.Errorf("t2->t0 expected {17 177 1777 17777}; got %v", t0); + t.Errorf("t2->t0 expected {17 177 1777 17777}; got %v", t0) } // Now transfer t0 into t1 @@ -845,7 +845,7 @@ func TestAutoIndirection(t *testing.T) { t1Id := getTypeInfoNoError(reflect.Typeof(t1)).id; decode(b, t1Id, &t1); if t1.a != 17 || *t1.b != 177 || **t1.c != 1777 || ***t1.d != 17777 { - t.Errorf("t0->t1 expected {17 177 1777 17777}; got {%d %d %d %d}", t1.a, *t1.b, **t1.c, ***t1.d); + t.Errorf("t0->t1 expected {17 177 1777 17777}; got {%d %d %d %d}", t1.a, *t1.b, **t1.c, ***t1.d) } // Now transfer t0 into t2 @@ -855,7 +855,7 @@ func TestAutoIndirection(t *testing.T) { t2Id := getTypeInfoNoError(reflect.Typeof(t2)).id; decode(b, t2Id, &t2); if ***t2.a != 17 || **t2.b != 177 || *t2.c != 1777 || t2.d != 17777 { - t.Errorf("t0->t2 expected {17 177 1777 17777}; got {%d %d %d %d}", ***t2.a, **t2.b, *t2.c, t2.d); + t.Errorf("t0->t2 expected {17 177 1777 17777}; got {%d %d %d %d}", ***t2.a, **t2.b, *t2.c, t2.d) } // Now do t2 again but without pre-allocated pointers. @@ -867,7 +867,7 @@ func TestAutoIndirection(t *testing.T) { t2.d = 0; decode(b, t2Id, &t2); if ***t2.a != 17 || **t2.b != 177 || *t2.c != 1777 || t2.d != 17777 { - t.Errorf("t0->t2 expected {17 177 1777 17777}; got {%d %d %d %d}", ***t2.a, **t2.b, *t2.c, t2.d); + t.Errorf("t0->t2 expected {17 177 1777 17777}; got {%d %d %d %d}", ***t2.a, **t2.b, *t2.c, t2.d) } } @@ -895,7 +895,7 @@ func TestReorderedFields(t *testing.T) { // Wire type is RT0, local type is RT1. decode(b, rt0Id, &rt1); if rt0.a != rt1.a || rt0.b != rt1.b || rt0.c != rt1.c { - t.Errorf("rt1->rt0: expected %v; got %v", rt0, rt1); + t.Errorf("rt1->rt0: expected %v; got %v", rt0, rt1) } } @@ -933,10 +933,10 @@ func TestIgnoredFields(t *testing.T) { // Wire type is IT0, local type is RT1. err := decode(b, rt0Id, &rt1); if err != nil { - t.Error("error: ", err); + t.Error("error: ", err) } if int(it0.a) != rt1.a || it0.b != rt1.b || it0.c != rt1.c { - t.Errorf("rt1->rt0: expected %v; got %v", it0, rt1); + t.Errorf("rt1->rt0: expected %v; got %v", it0, rt1) } } @@ -951,8 +951,8 @@ func TestInvalidField(t *testing.T) { b := new(bytes.Buffer); err := encode(b, &bad0); if err == nil { - t.Error("expected error; got none"); + t.Error("expected error; got none") } else if strings.Index(err.String(), "interface") < 0 { - t.Error("expected type error; got", err); + t.Error("expected type error; got", err) } } |