diff options
author | creker <sam901@yandex.ru> | 2016-04-04 19:19:47 +0300 |
---|---|---|
committer | Jens Geyer <jensg@apache.org> | 2016-04-06 22:53:25 +0200 |
commit | ca714c4397ed78bd880f0dd76526e3817ecc08f0 (patch) | |
tree | 1579f0fe4ce8e8e00f235e91855401063f8ee0b2 /test/go | |
parent | 51850abb7ed0a7304f60cbced853285c9b63f4cb (diff) | |
download | thrift-ca714c4397ed78bd880f0dd76526e3817ecc08f0.tar.gz |
THRIFT-3467 Go Maps for Thrift Sets Should Have Values of Type struct{}
Client: Go
Patch: artem antonenko <sam901@yandex.ru>
This closes #976
Diffstat (limited to 'test/go')
-rw-r--r-- | test/go/src/bin/stress/main.go | 7 | ||||
-rw-r--r-- | test/go/src/bin/testclient/main.go | 2 | ||||
-rw-r--r-- | test/go/src/common/clientserver_test.go | 4 | ||||
-rw-r--r-- | test/go/src/common/mock_handler.go | 4 | ||||
-rw-r--r-- | test/go/src/common/printing_handler.go | 2 | ||||
-rw-r--r-- | test/go/src/common/simple_handler.go | 2 |
6 files changed, 10 insertions, 11 deletions
diff --git a/test/go/src/bin/stress/main.go b/test/go/src/bin/stress/main.go index 4fc88e075..1f713bbd1 100644 --- a/test/go/src/bin/stress/main.go +++ b/test/go/src/bin/stress/main.go @@ -201,14 +201,13 @@ func client(protocolFactory thrift.TProtocolFactory) { atomic.AddInt64(&clicounter, 1) } case echoSet: - s := map[int8]bool{-10: true, -9: true, -8: true, -7: true, -6: true, -5: true, -4: true, -3: true, -2: true, -1: true, 0: true, 1: true, 2: true, 3: true, 4: true, 5: true, 6: true, 7: true, 8: true} + s := map[int8]struct{}{-10: {}, -9: {}, -8: {}, -7: {}, -6: {}, -5: {}, -4: {}, -3: {}, -2: {}, -1: {}, 0: {}, 1: {}, 2: {}, 3: {}, 4: {}, 5: {}, 6: {}, 7: {}, 8: {}} for i := 0; i < *loop; i++ { client.EchoSet(s) atomic.AddInt64(&clicounter, 1) } case echoMap: - m := map[int8]int8{ - -10: 10, -9: 9, -8: 8, -7: 7, -6: 6, -5: 5, -4: 4, -3: 3, -2: 2, -1: 1, 0: 0, 1: 1, 2: 2, 3: 3, 4: 4, 5: 5, 6: 6, 7: 7, 8: 8} + m := map[int8]int8{-10: 10, -9: 9, -8: 8, -7: 7, -6: 6, -5: 5, -4: 4, -3: 3, -2: 2, -1: 1, 0: 0, 1: 1, 2: 2, 3: 3, 4: 4, 5: 5, 6: 6, 7: 7, 8: 8} for i := 0; i < *loop; i++ { client.EchoMap(m) atomic.AddInt64(&clicounter, 1) @@ -244,7 +243,7 @@ func (h *handler) EchoList(arg []int8) (r []int8, err error) { atomic.AddInt64(&counter, 1) return arg, nil } -func (h *handler) EchoSet(arg map[int8]bool) (r map[int8]bool, err error) { +func (h *handler) EchoSet(arg map[int8]struct{}) (r map[int8]struct{}, err error) { atomic.AddInt64(&counter, 1) return arg, nil } diff --git a/test/go/src/bin/testclient/main.go b/test/go/src/bin/testclient/main.go index 7a7af7232..f4a19dded 100644 --- a/test/go/src/bin/testclient/main.go +++ b/test/go/src/bin/testclient/main.go @@ -174,7 +174,7 @@ func callEverything(client *thrifttest.ThriftTestClient) { t.Fatalf("Unexpected TestStringMap() result expected %#v, got %#v ", sm, smret) } - s := map[int32]bool{1: true, 2: true, 42: true} + s := map[int32]struct{}{1: struct{}{}, 2: struct{}{}, 42: struct{}{}} sret, err := client.TestSet(s) if err != nil { t.Fatalf("Unexpected error in TestSet() call: ", err) diff --git a/test/go/src/common/clientserver_test.go b/test/go/src/common/clientserver_test.go index 3b8142374..2a9d5e9b9 100644 --- a/test/go/src/common/clientserver_test.go +++ b/test/go/src/common/clientserver_test.go @@ -105,7 +105,7 @@ func callEverythingWithMock(t *testing.T, client *thrifttest.ThriftTestClient, h handler.EXPECT().TestNest(&thrifttest.Xtruct2{StructThing: &thrifttest.Xtruct{StringThing: "thing", ByteThing: 42, I32Thing: 4242, I64Thing: 424242}}).Return(&thrifttest.Xtruct2{StructThing: &thrifttest.Xtruct{StringThing: "thing", ByteThing: 42, I32Thing: 4242, I64Thing: 424242}}, nil), handler.EXPECT().TestMap(map[int32]int32{1: 2, 3: 4, 5: 42}).Return(map[int32]int32{1: 2, 3: 4, 5: 42}, nil), handler.EXPECT().TestStringMap(map[string]string{"a": "2", "b": "blah", "some": "thing"}).Return(map[string]string{"a": "2", "b": "blah", "some": "thing"}, nil), - handler.EXPECT().TestSet(map[int32]bool{1: true, 2: true, 42: true}).Return(map[int32]bool{1: true, 2: true, 42: true}, nil), + handler.EXPECT().TestSet(map[int32]struct{}{1: struct{}{}, 2: struct{}{}, 42: struct{}{}}).Return(map[int32]struct{}{1: struct{}{}, 2: struct{}{}, 42: struct{}{}}, nil), handler.EXPECT().TestList([]int32{1, 2, 42}).Return([]int32{1, 2, 42}, nil), handler.EXPECT().TestEnum(thrifttest.Numberz_TWO).Return(thrifttest.Numberz_TWO, nil), handler.EXPECT().TestTypedef(thrifttest.UserId(42)).Return(thrifttest.UserId(42), nil), @@ -222,7 +222,7 @@ func callEverythingWithMock(t *testing.T, client *thrifttest.ThriftTestClient, h t.Errorf("Unexpected TestStringMap() result expected %#v, got %#v ", sm, smret) } - s := map[int32]bool{1: true, 2: true, 42: true} + s := map[int32]struct{}{1: struct{}{}, 2: struct{}{}, 42: struct{}{}} sret, err := client.TestSet(s) if err != nil { t.Errorf("Unexpected error in TestSet() call: ", err) diff --git a/test/go/src/common/mock_handler.go b/test/go/src/common/mock_handler.go index 7495fc66f..6ae8130a8 100644 --- a/test/go/src/common/mock_handler.go +++ b/test/go/src/common/mock_handler.go @@ -223,9 +223,9 @@ func (_mr *_MockThriftTestRecorder) TestOneway(arg0 interface{}) *gomock.Call { return _mr.mock.ctrl.RecordCall(_mr.mock, "TestOneway", arg0) } -func (_m *MockThriftTest) TestSet(_param0 map[int32]bool) (map[int32]bool, error) { +func (_m *MockThriftTest) TestSet(_param0 map[int32]struct{}) (map[int32]struct{}, error) { ret := _m.ctrl.Call(_m, "TestSet", _param0) - ret0, _ := ret[0].(map[int32]bool) + ret0, _ := ret[0].(map[int32]struct{}) ret1, _ := ret[1].(error) return ret0, ret1 } diff --git a/test/go/src/common/printing_handler.go b/test/go/src/common/printing_handler.go index 5fe3d5352..afee8da7a 100644 --- a/test/go/src/common/printing_handler.go +++ b/test/go/src/common/printing_handler.go @@ -188,7 +188,7 @@ func (p *printingHandler) TestStringMap(thing map[string]string) (r map[string]s // // Parameters: // - Thing -func (p *printingHandler) TestSet(thing map[int32]bool) (r map[int32]bool, err error) { +func (p *printingHandler) TestSet(thing map[int32]struct{}) (r map[int32]struct{}, err error) { fmt.Printf("testSet({") first := true for k, _ := range thing { diff --git a/test/go/src/common/simple_handler.go b/test/go/src/common/simple_handler.go index 944f11c1b..7bd3a30f1 100644 --- a/test/go/src/common/simple_handler.go +++ b/test/go/src/common/simple_handler.go @@ -77,7 +77,7 @@ func (p *simpleHandler) TestStringMap(thing map[string]string) (r map[string]str return thing, nil } -func (p *simpleHandler) TestSet(thing map[int32]bool) (r map[int32]bool, err error) { +func (p *simpleHandler) TestSet(thing map[int32]struct{}) (r map[int32]struct{}, err error) { return thing, nil } |