You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@thrift.apache.org by ra...@apache.org on 2014/04/02 21:36:33 UTC

git commit: THRIFT-2443: node fails cross lang tests Client: node Patch: Randy Abernethy

Repository: thrift
Updated Branches:
  refs/heads/master a139c9175 -> 7f76e1d9f


THRIFT-2443: node fails cross lang tests
Client: node
Patch: Randy Abernethy

adds support for recursive tests of i64 types and fixes cross
lang test failure with C++.


Project: http://git-wip-us.apache.org/repos/asf/thrift/repo
Commit: http://git-wip-us.apache.org/repos/asf/thrift/commit/7f76e1d9
Tree: http://git-wip-us.apache.org/repos/asf/thrift/tree/7f76e1d9
Diff: http://git-wip-us.apache.org/repos/asf/thrift/diff/7f76e1d9

Branch: refs/heads/master
Commit: 7f76e1d9f41c2b324573ada383eef00cb4b342a5
Parents: a139c91
Author: ra <ra...@apache.org>
Authored: Wed Apr 2 12:31:05 2014 -0700
Committer: ra <ra...@apache.org>
Committed: Wed Apr 2 12:31:05 2014 -0700

----------------------------------------------------------------------
 lib/nodejs/test/thrift_test_driver.js | 13 ++++++++++---
 1 file changed, 10 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/thrift/blob/7f76e1d9/lib/nodejs/test/thrift_test_driver.js
----------------------------------------------------------------------
diff --git a/lib/nodejs/test/thrift_test_driver.js b/lib/nodejs/test/thrift_test_driver.js
index c61e99d..ccc105b 100644
--- a/lib/nodejs/test/thrift_test_driver.js
+++ b/lib/nodejs/test/thrift_test_driver.js
@@ -17,7 +17,7 @@
  * under the License.
  */
 
- // This is the Node test driver for the standard Apache Thrift 
+ // This is the Node.js test driver for the standard Apache Thrift 
  // test service. The driver invokes every function defined in the 
  // Thrift Test service with a representative range of parameters.
  //
@@ -28,14 +28,21 @@
 
 var assert = require('assert');
 var ttypes = require('./gen-nodejs/ThriftTest_types');
+var Int64 = require('node-int64');
 
 var ThriftTestDriver = exports.ThriftTestDriver = function(client, callback) {
 	
-// deepEqual doesn't work with fields using node-int64
 function checkRecursively(map1, map2) {
   if (typeof map1 !== 'function' && typeof map2 !== 'function') {
     if (!map1 || typeof map1 !== 'object') {
+      //Handle int64 types (which use node-int64 in Node.js JavaScript)
+      if ((typeof map1 === "number") && (typeof map2 === "object") && 
+          (map2.buffer) && (map2.buffer instanceof Buffer) && (map2.buffer.length === 8)) {
+        var n = new Int64(map2.buffer);
+        assert.equal(map1, n.toNumber());          
+      } else {
         assert.equal(map1, map2);
+      }
     } else {
       for (var key in map1) {
         checkRecursively(map1[key], map2[key]);
@@ -235,7 +242,7 @@ var crazy = new ttypes.Insanity({
 });
 var insanity = {
   "1":{ "2": crazy, "3": crazy },
-  "2":{ "6":{ "userMap":null, "xtructs":null } }
+  "2":{ "6":{ "userMap":{}, "xtructs":[] } }
 };
 client.testInsanity(crazy, function(err, response) {
   assert( ! err);