summaryrefslogtreecommitdiff
path: root/test/go/src/common
diff options
context:
space:
mode:
Diffstat (limited to 'test/go/src/common')
-rw-r--r--test/go/src/common/clientserver_test.go17
-rw-r--r--test/go/src/common/mock_handler.go12
-rw-r--r--test/go/src/common/printing_handler.go11
-rw-r--r--test/go/src/common/simple_handler.go4
4 files changed, 44 insertions, 0 deletions
diff --git a/test/go/src/common/clientserver_test.go b/test/go/src/common/clientserver_test.go
index a7bd46c4e..5c8915ab3 100644
--- a/test/go/src/common/clientserver_test.go
+++ b/test/go/src/common/clientserver_test.go
@@ -89,6 +89,8 @@ func callEverythingWithMock(t *testing.T, client *thrifttest.ThriftTestClient, h
gomock.InOrder(
handler.EXPECT().TestVoid(),
handler.EXPECT().TestString("thing").Return("thing", nil),
+ handler.EXPECT().TestBool(true).Return(true, nil),
+ handler.EXPECT().TestBool(false).Return(false, nil),
handler.EXPECT().TestByte(int8(42)).Return(int8(42), nil),
handler.EXPECT().TestI32(int32(4242)).Return(int32(4242), nil),
handler.EXPECT().TestI64(int64(424242)).Return(int64(424242), nil),
@@ -125,6 +127,21 @@ func callEverythingWithMock(t *testing.T, client *thrifttest.ThriftTestClient, h
t.Errorf("Unexpected TestString() result, expected 'thing' got '%s' ", thing)
}
+ bl, err := client.TestBool(true)
+ if err != nil {
+ t.Errorf("Unexpected error in TestBool() call: ", err)
+ }
+ if !bl {
+ t.Errorf("Unexpected TestBool() result expected true, got %f ", bl)
+ }
+ bl, err = client.TestBool(false)
+ if err != nil {
+ t.Errorf("Unexpected error in TestBool() call: ", err)
+ }
+ if bl {
+ t.Errorf("Unexpected TestBool() result expected false, got %f ", bl)
+ }
+
b, err := client.TestByte(42)
if err != nil {
t.Errorf("Unexpected error in TestByte() call: ", err)
diff --git a/test/go/src/common/mock_handler.go b/test/go/src/common/mock_handler.go
index ec7e051be..7495fc66f 100644
--- a/test/go/src/common/mock_handler.go
+++ b/test/go/src/common/mock_handler.go
@@ -48,6 +48,18 @@ func (_m *MockThriftTest) EXPECT() *_MockThriftTestRecorder {
return _m.recorder
}
+func (_m *MockThriftTest) TestBool(_param0 bool) (bool, error) {
+ ret := _m.ctrl.Call(_m, "TestBool", _param0)
+ ret0, _ := ret[0].(bool)
+ ret1, _ := ret[1].(error)
+ return ret0, ret1
+}
+
+func (_mr *_MockThriftTestRecorder) TestBool(arg0 interface{}) *gomock.Call {
+ return _mr.mock.ctrl.RecordCall(_mr.mock, "TestBool", arg0)
+}
+
+
func (_m *MockThriftTest) TestByte(_param0 int8) (int8, error) {
ret := _m.ctrl.Call(_m, "TestByte", _param0)
ret0, _ := ret[0].(int8)
diff --git a/test/go/src/common/printing_handler.go b/test/go/src/common/printing_handler.go
index 8c902d1e8..bc308b614 100644
--- a/test/go/src/common/printing_handler.go
+++ b/test/go/src/common/printing_handler.go
@@ -48,6 +48,17 @@ func (p *printingHandler) TestString(thing string) (r string, err error) {
return thing, nil
}
+// Prints 'testBool("%d")' with thing as 'true' or 'false'
+// @param bool thing - the bool to print
+// @return bool - returns the bool 'thing'
+//
+// Parameters:
+// - Thing
+func (p *printingHandler) TestBool(thing bool) (r bool, err error) {
+ fmt.Printf("testBool(%d)\n", thing)
+ return thing, nil
+}
+
// Prints 'testByte("%d")' with thing as '%d'
// @param byte thing - the byte to print
// @return byte - returns the byte 'thing'
diff --git a/test/go/src/common/simple_handler.go b/test/go/src/common/simple_handler.go
index 97ff52d46..944f11c1b 100644
--- a/test/go/src/common/simple_handler.go
+++ b/test/go/src/common/simple_handler.go
@@ -37,6 +37,10 @@ func (p *simpleHandler) TestString(thing string) (r string, err error) {
return thing, nil
}
+func (p *simpleHandler) TestBool(thing []byte) (r []byte, err error) {
+ return thing, nil
+}
+
func (p *simpleHandler) TestByte(thing int8) (r int8, err error) {
return thing, nil
}