Small fixes in tests #90
3 changed files with 44 additions and 45 deletions
|
@ -109,8 +109,7 @@ type RemoveChainResponse struct {
|
|||
session.ResponseHeaders
|
||||
}
|
||||
|
||||
type RemoveChainResponseBody struct {
|
||||
}
|
||||
type RemoveChainResponseBody struct{}
|
||||
|
||||
func (r *RemoveChainResponse) SetBody(body *RemoveChainResponseBody) {
|
||||
r.body = body
|
||||
|
|
|
@ -439,7 +439,7 @@ func TestFixed32Marshal(t *testing.T) {
|
|||
})
|
||||
}
|
||||
|
||||
func testMarshal(t *testing.T, c stablePrimitives, tr test.Primitives, wrongField bool) *test.Primitives {
|
||||
func testMarshal(t *testing.T, c stablePrimitives, tr *test.Primitives, wrongField bool) *test.Primitives {
|
||||
var (
|
||||
wire []byte
|
||||
err error
|
||||
|
@ -447,7 +447,7 @@ func testMarshal(t *testing.T, c stablePrimitives, tr test.Primitives, wrongFiel
|
|||
wire, err = c.stableMarshal(nil, wrongField)
|
||||
require.NoError(t, err)
|
||||
|
||||
wireGen, err := goproto.Marshal(&tr)
|
||||
wireGen, err := goproto.Marshal(tr)
|
||||
require.NoError(t, err)
|
||||
|
||||
if !wrongField {
|
||||
|
@ -470,7 +470,7 @@ func testBytesMarshal(t *testing.T, data []byte, wrongField bool) {
|
|||
transport = test.Primitives{FieldA: data}
|
||||
)
|
||||
|
||||
result := testMarshal(t, custom, transport, wrongField)
|
||||
result := testMarshal(t, custom, &transport, wrongField)
|
||||
|
||||
if !wrongField {
|
||||
require.Len(t, result.FieldA, len(data))
|
||||
|
@ -488,7 +488,7 @@ func testStringMarshal(t *testing.T, s string, wrongField bool) {
|
|||
transport = test.Primitives{FieldB: s}
|
||||
)
|
||||
|
||||
result := testMarshal(t, custom, transport, wrongField)
|
||||
result := testMarshal(t, custom, &transport, wrongField)
|
||||
|
||||
if !wrongField {
|
||||
require.Len(t, result.FieldB, len(s))
|
||||
|
@ -506,7 +506,7 @@ func testBoolMarshal(t *testing.T, b bool, wrongField bool) {
|
|||
transport = test.Primitives{FieldC: b}
|
||||
)
|
||||
|
||||
result := testMarshal(t, custom, transport, wrongField)
|
||||
result := testMarshal(t, custom, &transport, wrongField)
|
||||
|
||||
if !wrongField {
|
||||
require.Equal(t, b, result.FieldC)
|
||||
|
@ -521,7 +521,7 @@ func testInt32Marshal(t *testing.T, n int32, wrongField bool) {
|
|||
transport = test.Primitives{FieldD: n}
|
||||
)
|
||||
|
||||
result := testMarshal(t, custom, transport, wrongField)
|
||||
result := testMarshal(t, custom, &transport, wrongField)
|
||||
|
||||
if !wrongField {
|
||||
require.Equal(t, n, result.FieldD)
|
||||
|
@ -536,7 +536,7 @@ func testUInt32Marshal(t *testing.T, n uint32, wrongField bool) {
|
|||
transport = test.Primitives{FieldE: n}
|
||||
)
|
||||
|
||||
result := testMarshal(t, custom, transport, wrongField)
|
||||
result := testMarshal(t, custom, &transport, wrongField)
|
||||
|
||||
if !wrongField {
|
||||
require.Equal(t, n, result.FieldE)
|
||||
|
@ -551,7 +551,7 @@ func testInt64Marshal(t *testing.T, n int64, wrongField bool) {
|
|||
transport = test.Primitives{FieldF: n}
|
||||
)
|
||||
|
||||
result := testMarshal(t, custom, transport, wrongField)
|
||||
result := testMarshal(t, custom, &transport, wrongField)
|
||||
|
||||
if !wrongField {
|
||||
require.Equal(t, n, result.FieldF)
|
||||
|
@ -566,7 +566,7 @@ func testUInt64Marshal(t *testing.T, n uint64, wrongField bool) {
|
|||
transport = test.Primitives{FieldG: n}
|
||||
)
|
||||
|
||||
result := testMarshal(t, custom, transport, wrongField)
|
||||
result := testMarshal(t, custom, &transport, wrongField)
|
||||
|
||||
if !wrongField {
|
||||
require.Equal(t, n, result.FieldG)
|
||||
|
@ -581,7 +581,7 @@ func testFloat64Marshal(t *testing.T, n float64, wrongField bool) {
|
|||
transport = test.Primitives{FieldJ: n}
|
||||
)
|
||||
|
||||
result := testMarshal(t, custom, transport, wrongField)
|
||||
result := testMarshal(t, custom, &transport, wrongField)
|
||||
|
||||
if !wrongField {
|
||||
require.Equal(t, n, result.FieldJ)
|
||||
|
@ -596,7 +596,7 @@ func testEnumMarshal(t *testing.T, e SomeEnum, wrongField bool) {
|
|||
transport = test.Primitives{FieldH: test.Primitives_SomeEnum(e)}
|
||||
)
|
||||
|
||||
result := testMarshal(t, custom, transport, wrongField)
|
||||
result := testMarshal(t, custom, &transport, wrongField)
|
||||
|
||||
if !wrongField {
|
||||
require.EqualValues(t, custom.FieldH, result.FieldH)
|
||||
|
@ -605,7 +605,7 @@ func testEnumMarshal(t *testing.T, e SomeEnum, wrongField bool) {
|
|||
}
|
||||
}
|
||||
|
||||
func testRepMarshal(t *testing.T, c stableRepPrimitives, tr test.RepPrimitives, wrongField bool) *test.RepPrimitives {
|
||||
func testRepMarshal(t *testing.T, c stableRepPrimitives, tr *test.RepPrimitives, wrongField bool) *test.RepPrimitives {
|
||||
var (
|
||||
wire []byte
|
||||
err error
|
||||
|
@ -613,7 +613,7 @@ func testRepMarshal(t *testing.T, c stableRepPrimitives, tr test.RepPrimitives,
|
|||
wire, err = c.stableMarshal(nil, wrongField)
|
||||
require.NoError(t, err)
|
||||
|
||||
wireGen, err := goproto.Marshal(&tr)
|
||||
wireGen, err := goproto.Marshal(tr)
|
||||
require.NoError(t, err)
|
||||
|
||||
if !wrongField {
|
||||
|
@ -636,7 +636,7 @@ func testRepeatedBytesMarshal(t *testing.T, data [][]byte, wrongField bool) {
|
|||
transport = test.RepPrimitives{FieldA: data}
|
||||
)
|
||||
|
||||
result := testRepMarshal(t, custom, transport, wrongField)
|
||||
result := testRepMarshal(t, custom, &transport, wrongField)
|
||||
|
||||
if !wrongField {
|
||||
require.Len(t, result.FieldA, len(data))
|
||||
|
@ -654,7 +654,7 @@ func testRepeatedStringMarshal(t *testing.T, s []string, wrongField bool) {
|
|||
transport = test.RepPrimitives{FieldB: s}
|
||||
)
|
||||
|
||||
result := testRepMarshal(t, custom, transport, wrongField)
|
||||
result := testRepMarshal(t, custom, &transport, wrongField)
|
||||
|
||||
if !wrongField {
|
||||
require.Len(t, result.FieldB, len(s))
|
||||
|
@ -672,7 +672,7 @@ func testRepeatedInt32Marshal(t *testing.T, n []int32, wrongField bool) {
|
|||
transport = test.RepPrimitives{FieldC: n}
|
||||
)
|
||||
|
||||
result := testRepMarshal(t, custom, transport, wrongField)
|
||||
result := testRepMarshal(t, custom, &transport, wrongField)
|
||||
|
||||
if !wrongField {
|
||||
require.Len(t, result.FieldC, len(n))
|
||||
|
@ -690,7 +690,7 @@ func testRepeatedUInt32Marshal(t *testing.T, n []uint32, wrongField bool) {
|
|||
transport = test.RepPrimitives{FieldD: n}
|
||||
)
|
||||
|
||||
result := testRepMarshal(t, custom, transport, wrongField)
|
||||
result := testRepMarshal(t, custom, &transport, wrongField)
|
||||
|
||||
if !wrongField {
|
||||
require.Len(t, result.FieldD, len(n))
|
||||
|
@ -708,7 +708,7 @@ func testRepeatedInt64Marshal(t *testing.T, n []int64, wrongField bool) {
|
|||
transport = test.RepPrimitives{FieldE: n}
|
||||
)
|
||||
|
||||
result := testRepMarshal(t, custom, transport, wrongField)
|
||||
result := testRepMarshal(t, custom, &transport, wrongField)
|
||||
|
||||
if !wrongField {
|
||||
require.Len(t, result.FieldE, len(n))
|
||||
|
@ -726,7 +726,7 @@ func testRepeatedUInt64Marshal(t *testing.T, n []uint64, wrongField bool) {
|
|||
transport = test.RepPrimitives{FieldF: n}
|
||||
)
|
||||
|
||||
result := testRepMarshal(t, custom, transport, wrongField)
|
||||
result := testRepMarshal(t, custom, &transport, wrongField)
|
||||
|
||||
if !wrongField {
|
||||
require.Len(t, result.FieldF, len(n))
|
||||
|
@ -744,7 +744,7 @@ func testFixed64Marshal(t *testing.T, n uint64, wrongField bool) {
|
|||
transport = test.Primitives{FieldI: n}
|
||||
)
|
||||
|
||||
result := testMarshal(t, custom, transport, wrongField)
|
||||
result := testMarshal(t, custom, &transport, wrongField)
|
||||
|
||||
if !wrongField {
|
||||
require.Equal(t, n, result.FieldI)
|
||||
|
@ -759,7 +759,7 @@ func testFixed32Marshal(t *testing.T, n uint32, wrongField bool) {
|
|||
transport = test.Primitives{FieldK: n}
|
||||
)
|
||||
|
||||
result := testMarshal(t, custom, transport, wrongField)
|
||||
result := testMarshal(t, custom, &transport, wrongField)
|
||||
|
||||
if !wrongField {
|
||||
require.Equal(t, n, result.FieldK)
|
||||
|
|
|
@ -5,30 +5,30 @@ package test;
|
|||
option go_package = "util/proto/test";
|
||||
|
||||
message Primitives {
|
||||
bytes field_a = 1;
|
||||
string field_b = 2;
|
||||
bool field_c = 200;
|
||||
int32 field_d = 201;
|
||||
uint32 field_e = 202;
|
||||
int64 field_f = 203;
|
||||
uint64 field_g = 204;
|
||||
fixed64 field_i = 205;
|
||||
double field_j = 206;
|
||||
fixed32 field_k = 207;
|
||||
bytes field_a = 1;
|
||||
string field_b = 2;
|
||||
bool field_c = 200;
|
||||
int32 field_d = 201;
|
||||
uint32 field_e = 202;
|
||||
int64 field_f = 203;
|
||||
uint64 field_g = 204;
|
||||
fixed64 field_i = 205;
|
||||
double field_j = 206;
|
||||
fixed32 field_k = 207;
|
||||
|
||||
enum SomeEnum {
|
||||
UNKNOWN = 0;
|
||||
POSITIVE = 1;
|
||||
NEGATIVE = -1;
|
||||
}
|
||||
SomeEnum field_h = 300;
|
||||
enum SomeEnum {
|
||||
UNKNOWN = 0;
|
||||
POSITIVE = 1;
|
||||
NEGATIVE = -1;
|
||||
}
|
||||
SomeEnum field_h = 300;
|
||||
}
|
||||
|
||||
message RepPrimitives {
|
||||
repeated bytes field_a = 1;
|
||||
repeated string field_b = 2;
|
||||
repeated int32 field_c = 3;
|
||||
repeated uint32 field_d = 4;
|
||||
repeated int64 field_e = 5;
|
||||
repeated uint64 field_f = 6;
|
||||
repeated bytes field_a = 1;
|
||||
repeated string field_b = 2;
|
||||
repeated int32 field_c = 3;
|
||||
repeated uint32 field_d = 4;
|
||||
repeated int64 field_e = 5;
|
||||
repeated uint64 field_f = 6;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue