THRIFT-4675: Fix int64 constants generation for map keys
diff --git a/lib/js/package.json b/lib/js/package.json
index c4bcc6d..a35ac15 100644
--- a/lib/js/package.json
+++ b/lib/js/package.json
@@ -16,7 +16,7 @@
},
"dependencies": {
"jsdoc": "^3.5.5",
- "json-int64": "^0.0.3",
+ "json-int64": "^1.0.0",
"nopt": "^4.0.1"
}
}
diff --git a/lib/js/test/test-int64.html b/lib/js/test/test-int64.html
index 620e6ff..bcb05fb 100644
--- a/lib/js/test/test-int64.html
+++ b/lib/js/test/test-int64.html
@@ -25,6 +25,7 @@
<script src="build/js/thrift.js" type="text/javascript" charset="utf-8"></script>
<!-- browserified node-int64 -->
<script src="build/js/lib/Int64.js" type="text/javascript" charset="utf-8"></script>
+ <script src="build/js/lib/JSONInt64.js" type="text/javascript" charset="utf-8"></script>
<!-- int64 constants to check -->
<script src="gen-js/Int64Test_types.js" type="text/javascript" charset="utf-8"></script>
diff --git a/lib/js/test/test-int64.js b/lib/js/test/test-int64.js
index 4df87e1..cf7e828 100644
--- a/lib/js/test/test-int64.js
+++ b/lib/js/test/test-int64.js
@@ -86,6 +86,12 @@
for (let i = 0; i < EXPECTED_INT64_LIST.length; ++i) {
assert.ok(EXPECTED_INT64_LIST[i].equals(Int64Test.INT64_LIST[i]));
}
+
+ for (let i = 0; i < EXPECTED_INT64_LIST.length; ++i){
+ let int64Object = EXPECTED_INT64_LIST[i];
+ assert.ok(Int64Test.INT64_2_INT64_MAP[JSONInt64.toDecimalString(int64Object)].equals(int64Object));
+ }
+
console.log('Int64 test -- ends');
});
diff --git a/lib/nodejs/test/int64.test.js b/lib/nodejs/test/int64.test.js
index 106e446..27ad28c 100644
--- a/lib/nodejs/test/int64.test.js
+++ b/lib/nodejs/test/int64.test.js
@@ -18,6 +18,7 @@
*/
const Int64 = require("node-int64");
+const JSONInt64 = require("json-int64");
const i64types = require("./gen-nodejs-es6/Int64Test_types.js");
const test = require("tape");
@@ -72,6 +73,16 @@
for (let i = 0; i < EXPECTED_INT64_LIST.length; ++i) {
assert.ok(EXPECTED_INT64_LIST[i].equals(i64types.INT64_LIST[i]));
}
+
+ for (let i = 0; i < EXPECTED_INT64_LIST.length; ++i) {
+ const int64Object = EXPECTED_INT64_LIST[i];
+ assert.ok(
+ i64types.INT64_2_INT64_MAP[
+ JSONInt64.toDecimalString(int64Object)
+ ].equals(int64Object)
+ );
+ }
+
assert.end();
}
};
diff --git a/lib/nodets/test/int64.test.ts b/lib/nodets/test/int64.test.ts
index 3ff0d85..d209234 100644
--- a/lib/nodets/test/int64.test.ts
+++ b/lib/nodets/test/int64.test.ts
@@ -18,6 +18,7 @@
*/
import Int64 = require("node-int64");
+import JSONInt64 = require('json-int64');
import i64types = require("./gen-nodejs/Int64Test_types");
import test = require("tape");
@@ -72,6 +73,12 @@
for (let i = 0; i < EXPECTED_INT64_LIST.length; ++i) {
assert.ok(EXPECTED_INT64_LIST[i].equals(i64types.INT64_LIST[i]));
}
+
+ for (let i = 0; i < EXPECTED_INT64_LIST.length; ++i){
+ let int64Object = EXPECTED_INT64_LIST[i];
+ assert.ok(i64types.INT64_2_INT64_MAP[JSONInt64.toDecimalString(int64Object)].equals(int64Object));
+ }
+
assert.end();
}
};
diff --git a/lib/ts/package.json b/lib/ts/package.json
index 47eec62..1a1ccdc 100644
--- a/lib/ts/package.json
+++ b/lib/ts/package.json
@@ -23,7 +23,7 @@
"dependencies": {
"bufferutil": "^4.0.1",
"jsdoc": "^3.5.5",
- "json-int64": "^0.0.3",
+ "json-int64": "^1.0.0",
"nopt": "^4.0.1"
},
"types": "./thrift.d.ts"
diff --git a/lib/ts/test/test-int64.ts b/lib/ts/test/test-int64.ts
index 3ea7919..254d8d7 100644
--- a/lib/ts/test/test-int64.ts
+++ b/lib/ts/test/test-int64.ts
@@ -19,6 +19,7 @@
/* jshint -W100 */
var Int64 = require("node-int64");
+var JSONInt64 = require("json-int64");
import { Int64Test } from "./gen-js/Int64Test_types";
@@ -89,6 +90,12 @@
for (let i = 0; i < EXPECTED_INT64_LIST.length; ++i) {
assert.ok(EXPECTED_INT64_LIST[i].equals(Int64Test.INT64_LIST[i]));
}
+
+ for (let i = 0; i < EXPECTED_INT64_LIST.length; ++i){
+ let int64Object = EXPECTED_INT64_LIST[i];
+ assert.ok(Int64Test.INT64_2_INT64_MAP[JSONInt64.toDecimalString(int64Object)].equals(int64Object));
+ }
+
console.log('Int64 test -- ends');
});