THRIFT-3337 Add testBool method to cross tests
This closes #611
diff --git a/lib/c_glib/test/testthrifttestclient.cpp b/lib/c_glib/test/testthrifttestclient.cpp
index e1737cd..e618fe9 100755
--- a/lib/c_glib/test/testthrifttestclient.cpp
+++ b/lib/c_glib/test/testthrifttestclient.cpp
@@ -67,6 +67,10 @@
out = thing;
}
+ bool testBool(const bool thing) {
+ printf("[C -> C++] testBool(%s)\n", thing ? "true" : "false");
+ return thing;
+ }
int8_t testByte(const int8_t thing) {
printf("[C -> C++] testByte(%d)\n", (int)thing);
return thing;
diff --git a/lib/csharp/test/ThriftTest/TestClient.cs b/lib/csharp/test/ThriftTest/TestClient.cs
index ec0696a..68949ac 100644
--- a/lib/csharp/test/ThriftTest/TestClient.cs
+++ b/lib/csharp/test/ThriftTest/TestClient.cs
@@ -242,6 +242,13 @@
string s = client.testString("Test");
Console.WriteLine(" = \"" + s + "\"");
+ Console.Write("testBool(true)");
+ bool t = client.testBool((bool)true);
+ Console.WriteLine(" = " + t);
+ Console.Write("testBool(false)");
+ bool f = client.testBool((bool)false);
+ Console.WriteLine(" = " + f);
+
Console.Write("testByte(1)");
sbyte i8 = client.testByte((sbyte)1);
Console.WriteLine(" = " + i8);
diff --git a/lib/csharp/test/ThriftTest/TestServer.cs b/lib/csharp/test/ThriftTest/TestServer.cs
index 0e9fe05..b5cc73c 100644
--- a/lib/csharp/test/ThriftTest/TestServer.cs
+++ b/lib/csharp/test/ThriftTest/TestServer.cs
@@ -73,6 +73,12 @@
return thing;
}
+ public bool testBool(bool thing)
+ {
+ Console.WriteLine("testBool(" + thing + ")");
+ return thing;
+ }
+
public sbyte testByte(sbyte thing)
{
Console.WriteLine("testByte(" + thing + ")");
diff --git a/lib/go/test/tests/thrifttest_handler.go b/lib/go/test/tests/thrifttest_handler.go
index eef45d5..50fe718 100644
--- a/lib/go/test/tests/thrifttest_handler.go
+++ b/lib/go/test/tests/thrifttest_handler.go
@@ -56,6 +56,10 @@
return thing, nil
}
+func (p *ThriftTestHandler) TestBool(thing bool) (r bool, err error) {
+ return thing, nil
+}
+
func (p *ThriftTestHandler) TestByte(thing int8) (r int8, err error) {
return thing, nil
}
diff --git a/lib/java/test/org/apache/thrift/server/ServerTestBase.java b/lib/java/test/org/apache/thrift/server/ServerTestBase.java
index a2836aa..b95779b 100755
--- a/lib/java/test/org/apache/thrift/server/ServerTestBase.java
+++ b/lib/java/test/org/apache/thrift/server/ServerTestBase.java
@@ -65,6 +65,11 @@
System.out.print("testString(\"" + thing + "\")\n");
return thing;
}
+
+ public boolean testBool(boolean thing) {
+ System.out.print("testBool(" + thing + ")\n");
+ return thing;
+ }
public byte testByte(byte thing) {
System.out.print("testByte(" + thing + ")\n");
@@ -305,6 +310,13 @@
public abstract TTransport getClientTransport(TTransport underlyingTransport) throws Exception;
+ private void testBool(ThriftTest.Client testClient) throws TException {
+ boolean t = testClient.testBool(true);
+ assertEquals(true, t);
+ boolean f = testClient.testBool(false);
+ assertEquals(false, f);
+ }
+
private void testByte(ThriftTest.Client testClient) throws TException {
byte i8 = testClient.testByte((byte)1);
assertEquals(1, i8);
@@ -404,6 +416,7 @@
open(transport);
testVoid(testClient);
testString(testClient);
+ testBool(testClient);
testByte(testClient);
testI32(testClient);
testI64(testClient);
@@ -585,6 +598,11 @@
}
@Override
+ public void testBool(boolean thing, AsyncMethodCallback resultHandler) throws TException {
+ resultHandler.onComplete(handler.testBool(thing));
+ }
+
+ @Override
public void testByte(byte thing, AsyncMethodCallback resultHandler) throws TException {
resultHandler.onComplete(handler.testByte(thing));
}
diff --git a/lib/nodejs/test/test-cases.js b/lib/nodejs/test/test-cases.js
index 7872295..2384221 100644
--- a/lib/nodejs/test/test-cases.js
+++ b/lib/nodejs/test/test-cases.js
@@ -49,6 +49,8 @@
['testString', ''],
['testString', stringTest],
['testString', specialCharacters],
+ ['testBool', true],
+ ['testBool', false],
['testByte', 1],
['testByte', 0],
['testByte', -1],
diff --git a/lib/nodejs/test/test_handler.js b/lib/nodejs/test/test_handler.js
index da32906..41df441 100644
--- a/lib/nodejs/test/test_handler.js
+++ b/lib/nodejs/test/test_handler.js
@@ -57,6 +57,7 @@
var identityHandlers = [
'testString',
+ 'testBool',
'testByte',
'testI32',
'testI64',