gorealis v2 refactor (#5)
* Changing default timeout for start maintenance. * Upgrading dependencies to gorealis v2 and thrift 0.12.0 * Refactored to update to gorealis v2.
This commit is contained in:
parent
ad4dd9606e
commit
6ab5c9334d
1335 changed files with 137431 additions and 61530 deletions
377
vendor/git.apache.org/thrift.git/lib/js/test/test.js
generated
vendored
377
vendor/git.apache.org/thrift.git/lib/js/test/test.js
generated
vendored
|
@ -23,7 +23,7 @@
|
|||
* will run against Normal (-gen js) and jQuery (-gen js:jquery)
|
||||
* Apache Thrift interfaces.
|
||||
*
|
||||
* Synchronous blocking calls should be identical in both
|
||||
* Synchronous blocking calls should be identical in both
|
||||
* Normal and jQuery interfaces. All synchronous tests belong
|
||||
* here.
|
||||
*
|
||||
|
@ -47,9 +47,9 @@
|
|||
* ++ test-jq.js for "-gen js:jquery" only tests
|
||||
*/
|
||||
|
||||
var transport = new Thrift.Transport("/service");
|
||||
var protocol = new Thrift.Protocol(transport);
|
||||
var client = new ThriftTest.ThriftTestClient(protocol);
|
||||
const transport = new Thrift.Transport('/service');
|
||||
const protocol = new Thrift.Protocol(transport);
|
||||
const client = new ThriftTest.ThriftTestClient(protocol);
|
||||
|
||||
// Work around for old API used by QUnitAdapter of jsTestDriver
|
||||
if (typeof QUnit.log == 'function') {
|
||||
|
@ -67,170 +67,170 @@ if (typeof QUnit.log == 'function') {
|
|||
}
|
||||
|
||||
// all Languages in UTF-8
|
||||
var stringTest = "Afrikaans, Alemannisch, Aragonés, العربية, مصرى, Asturianu, Aymar aru, Azərbaycan, Башҡорт, Boarisch, Žemaitėška, Беларуская, Беларуская (тарашкевіца), Български, Bamanankan, বাংলা, Brezhoneg, Bosanski, Català, Mìng-dĕ̤ng-ngṳ̄, Нохчийн, Cebuano, ᏣᎳᎩ, Česky, Словѣ́ньскъ / ⰔⰎⰑⰂⰡⰐⰠⰔⰍⰟ, Чӑвашла, Cymraeg, Dansk, Zazaki, ދިވެހިބަސް, Ελληνικά, Emiliàn e rumagnòl, English, Esperanto, Español, Eesti, Euskara, فارسی, Suomi, Võro, Føroyskt, Français, Arpetan, Furlan, Frysk, Gaeilge, 贛語, Gàidhlig, Galego, Avañe'ẽ, ગુજરાતી, Gaelg, עברית, हिन्दी, Fiji Hindi, Hrvatski, Kreyòl ayisyen, Magyar, Հայերեն, Interlingua, Bahasa Indonesia, Ilokano, Ido, Íslenska, Italiano, 日本語, Lojban, Basa Jawa, ქართული, Kongo, Kalaallisut, ಕನ್ನಡ, 한국어, Къарачай-Малкъар, Ripoarisch, Kurdî, Коми, Kernewek, Кыргызча, Latina, Ladino, Lëtzebuergesch, Limburgs, Lingála, ລາວ, Lietuvių, Latviešu, Basa Banyumasan, Malagasy, Македонски, മലയാളം, मराठी, Bahasa Melayu, مازِرونی, Nnapulitano, Nedersaksisch, नेपाल भाषा, Nederlands, Norsk (nynorsk), Norsk (bokmål), Nouormand, Diné bizaad, Occitan, Иронау, Papiamentu, Deitsch, Norfuk / Pitkern, Polski, پنجابی, پښتو, Português, Runa Simi, Rumantsch, Romani, Română, Русский, Саха тыла, Sardu, Sicilianu, Scots, Sámegiella, Simple English, Slovenčina, Slovenščina, Српски / Srpski, Seeltersk, Svenska, Kiswahili, தமிழ், తెలుగు, Тоҷикӣ, ไทย, Türkmençe, Tagalog, Türkçe, Татарча/Tatarça, Українська, اردو, Tiếng Việt, Volapük, Walon, Winaray, 吴语, isiXhosa, ייִדיש, Yorùbá, Zeêuws, 中文, Bân-lâm-gú, 粵語";
|
||||
const stringTest = "Afrikaans, Alemannisch, Aragonés, العربية, مصرى, Asturianu, Aymar aru, Azərbaycan, Башҡорт, Boarisch, Žemaitėška, Беларуская, Беларуская (тарашкевіца), Български, Bamanankan, বাংলা, Brezhoneg, Bosanski, Català, Mìng-dĕ̤ng-ngṳ̄, Нохчийн, Cebuano, ᏣᎳᎩ, Česky, Словѣ́ньскъ / ⰔⰎⰑⰂⰡⰐⰠⰔⰍⰟ, Чӑвашла, Cymraeg, Dansk, Zazaki, ދިވެހިބަސް, Ελληνικά, Emiliàn e rumagnòl, English, Esperanto, Español, Eesti, Euskara, فارسی, Suomi, Võro, Føroyskt, Français, Arpetan, Furlan, Frysk, Gaeilge, 贛語, Gàidhlig, Galego, Avañe'ẽ, ગુજરાતી, Gaelg, עברית, हिन्दी, Fiji Hindi, Hrvatski, Kreyòl ayisyen, Magyar, Հայերեն, Interlingua, Bahasa Indonesia, Ilokano, Ido, Íslenska, Italiano, 日本語, Lojban, Basa Jawa, ქართული, Kongo, Kalaallisut, ಕನ್ನಡ, 한국어, Къарачай-Малкъар, Ripoarisch, Kurdî, Коми, Kernewek, Кыргызча, Latina, Ladino, Lëtzebuergesch, Limburgs, Lingála, ລາວ, Lietuvių, Latviešu, Basa Banyumasan, Malagasy, Македонски, മലയാളം, मराठी, Bahasa Melayu, مازِرونی, Nnapulitano, Nedersaksisch, नेपाल भाषा, Nederlands, Norsk (nynorsk), Norsk (bokmål), Nouormand, Diné bizaad, Occitan, Иронау, Papiamentu, Deitsch, Norfuk / Pitkern, Polski, پنجابی, پښتو, Português, Runa Simi, Rumantsch, Romani, Română, Русский, Саха тыла, Sardu, Sicilianu, Scots, Sámegiella, Simple English, Slovenčina, Slovenščina, Српски / Srpski, Seeltersk, Svenska, Kiswahili, தமிழ், తెలుగు, Тоҷикӣ, ไทย, Türkmençe, Tagalog, Türkçe, Татарча/Tatarça, Українська, اردو, Tiếng Việt, Volapük, Walon, Winaray, 吴语, isiXhosa, ייִדיש, Yorùbá, Zeêuws, 中文, Bân-lâm-gú, 粵語";
|
||||
|
||||
function checkRecursively(map1, map2) {
|
||||
function checkRecursively(assert, map1, map2) {
|
||||
if (typeof map1 !== 'function' && typeof map2 !== 'function') {
|
||||
if (!map1 || typeof map1 !== 'object') {
|
||||
equal(map1, map2);
|
||||
assert.equal(map1, map2);
|
||||
} else {
|
||||
for (var key in map1) {
|
||||
checkRecursively(map1[key], map2[key]);
|
||||
for (let key in map1) {
|
||||
checkRecursively(assert, map1[key], map2[key]);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
module("Base Types");
|
||||
QUnit.module('Base Types');
|
||||
|
||||
test("Void", function() {
|
||||
equal(client.testVoid(), undefined);
|
||||
QUnit.test('Void', function(assert) {
|
||||
assert.equal(client.testVoid(), undefined);
|
||||
});
|
||||
test("Binary (String)", function() {
|
||||
var binary = '';
|
||||
for (var v = 255; v >= 0; --v) {
|
||||
QUnit.test('Binary (String)', function(assert) {
|
||||
let binary = '';
|
||||
for (let v = 255; v >= 0; --v) {
|
||||
binary += String.fromCharCode(v);
|
||||
}
|
||||
equal(client.testBinary(binary), binary);
|
||||
assert.equal(client.testBinary(binary), binary);
|
||||
});
|
||||
test("Binary (Uint8Array)", function() {
|
||||
var binary = '';
|
||||
for (var v = 255; v >= 0; --v) {
|
||||
QUnit.test('Binary (Uint8Array)', function(assert) {
|
||||
let binary = '';
|
||||
for (let v = 255; v >= 0; --v) {
|
||||
binary += String.fromCharCode(v);
|
||||
}
|
||||
var arr = new Uint8Array(binary.length);
|
||||
for (var i = 0; i < binary.length; ++i) {
|
||||
const arr = new Uint8Array(binary.length);
|
||||
for (let i = 0; i < binary.length; ++i) {
|
||||
arr[i] = binary[i].charCodeAt();
|
||||
}
|
||||
equal(client.testBinary(arr), binary);
|
||||
assert.equal(client.testBinary(arr), binary);
|
||||
});
|
||||
test("String", function() {
|
||||
equal(client.testString(''), '');
|
||||
equal(client.testString(stringTest), stringTest);
|
||||
QUnit.test('String', function(assert) {
|
||||
assert.equal(client.testString(''), '');
|
||||
assert.equal(client.testString(stringTest), stringTest);
|
||||
|
||||
var specialCharacters = 'quote: \" backslash:' +
|
||||
const specialCharacters = 'quote: \" backslash:' +
|
||||
' forwardslash-escaped: \/ ' +
|
||||
' backspace: \b formfeed: \f newline: \n return: \r tab: ' +
|
||||
' now-all-of-them-together: "\\\/\b\n\r\t' +
|
||||
' now-a-bunch-of-junk: !@#$%&()(&%$#{}{}<><><';
|
||||
equal(client.testString(specialCharacters),specialCharacters);
|
||||
assert.equal(client.testString(specialCharacters), specialCharacters);
|
||||
});
|
||||
test("Double", function() {
|
||||
equal(client.testDouble(0), 0);
|
||||
equal(client.testDouble(-1), -1);
|
||||
equal(client.testDouble(3.14), 3.14);
|
||||
equal(client.testDouble(Math.pow(2,60)), Math.pow(2,60));
|
||||
QUnit.test('Double', function(assert) {
|
||||
assert.equal(client.testDouble(0), 0);
|
||||
assert.equal(client.testDouble(-1), -1);
|
||||
assert.equal(client.testDouble(3.14), 3.14);
|
||||
assert.equal(client.testDouble(Math.pow(2, 60)), Math.pow(2, 60));
|
||||
});
|
||||
test("Byte", function() {
|
||||
equal(client.testByte(0), 0);
|
||||
equal(client.testByte(0x01), 0x01);
|
||||
QUnit.test('Byte', function(assert) {
|
||||
assert.equal(client.testByte(0), 0);
|
||||
assert.equal(client.testByte(0x01), 0x01);
|
||||
});
|
||||
test("I32", function() {
|
||||
equal(client.testI32(0), 0);
|
||||
equal(client.testI32(Math.pow(2,30)), Math.pow(2,30));
|
||||
equal(client.testI32(-Math.pow(2,30)), -Math.pow(2,30));
|
||||
QUnit.test('I32', function(assert) {
|
||||
assert.equal(client.testI32(0), 0);
|
||||
assert.equal(client.testI32(Math.pow(2, 30)), Math.pow(2, 30));
|
||||
assert.equal(client.testI32(-Math.pow(2, 30)), -Math.pow(2, 30));
|
||||
});
|
||||
test("I64", function() {
|
||||
equal(client.testI64(0), 0);
|
||||
QUnit.test('I64', function(assert) {
|
||||
assert.equal(client.testI64(0), 0);
|
||||
//This is usually 2^60 but JS cannot represent anything over 2^52 accurately
|
||||
equal(client.testI64(Math.pow(2,52)), Math.pow(2,52));
|
||||
equal(client.testI64(-Math.pow(2,52)), -Math.pow(2,52));
|
||||
assert.equal(client.testI64(Math.pow(2, 52)), Math.pow(2, 52));
|
||||
assert.equal(client.testI64(-Math.pow(2, 52)), -Math.pow(2, 52));
|
||||
});
|
||||
|
||||
|
||||
module("Structured Types");
|
||||
QUnit.module('Structured Types');
|
||||
|
||||
test("Struct", function() {
|
||||
var structTestInput = new ThriftTest.Xtruct();
|
||||
QUnit.test('Struct', function(assert) {
|
||||
const structTestInput = new ThriftTest.Xtruct();
|
||||
structTestInput.string_thing = 'worked';
|
||||
structTestInput.byte_thing = 0x01;
|
||||
structTestInput.i32_thing = Math.pow(2,30);
|
||||
structTestInput.i32_thing = Math.pow(2, 30);
|
||||
//This is usually 2^60 but JS cannot represent anything over 2^52 accurately
|
||||
structTestInput.i64_thing = Math.pow(2,52);
|
||||
structTestInput.i64_thing = Math.pow(2, 52);
|
||||
|
||||
var structTestOutput = client.testStruct(structTestInput);
|
||||
const structTestOutput = client.testStruct(structTestInput);
|
||||
|
||||
equal(structTestOutput.string_thing, structTestInput.string_thing);
|
||||
equal(structTestOutput.byte_thing, structTestInput.byte_thing);
|
||||
equal(structTestOutput.i32_thing, structTestInput.i32_thing);
|
||||
equal(structTestOutput.i64_thing, structTestInput.i64_thing);
|
||||
assert.equal(structTestOutput.string_thing, structTestInput.string_thing);
|
||||
assert.equal(structTestOutput.byte_thing, structTestInput.byte_thing);
|
||||
assert.equal(structTestOutput.i32_thing, structTestInput.i32_thing);
|
||||
assert.equal(structTestOutput.i64_thing, structTestInput.i64_thing);
|
||||
|
||||
equal(JSON.stringify(structTestOutput), JSON.stringify(structTestInput));
|
||||
assert.equal(JSON.stringify(structTestOutput), JSON.stringify(structTestInput));
|
||||
});
|
||||
|
||||
test("Nest", function() {
|
||||
var xtrTestInput = new ThriftTest.Xtruct();
|
||||
QUnit.test('Nest', function(assert) {
|
||||
const xtrTestInput = new ThriftTest.Xtruct();
|
||||
xtrTestInput.string_thing = 'worked';
|
||||
xtrTestInput.byte_thing = 0x01;
|
||||
xtrTestInput.i32_thing = Math.pow(2,30);
|
||||
xtrTestInput.i32_thing = Math.pow(2, 30);
|
||||
//This is usually 2^60 but JS cannot represent anything over 2^52 accurately
|
||||
xtrTestInput.i64_thing = Math.pow(2,52);
|
||||
xtrTestInput.i64_thing = Math.pow(2, 52);
|
||||
|
||||
var nestTestInput = new ThriftTest.Xtruct2();
|
||||
const nestTestInput = new ThriftTest.Xtruct2();
|
||||
nestTestInput.byte_thing = 0x02;
|
||||
nestTestInput.struct_thing = xtrTestInput;
|
||||
nestTestInput.i32_thing = Math.pow(2,15);
|
||||
nestTestInput.i32_thing = Math.pow(2, 15);
|
||||
|
||||
var nestTestOutput = client.testNest(nestTestInput);
|
||||
const nestTestOutput = client.testNest(nestTestInput);
|
||||
|
||||
equal(nestTestOutput.byte_thing, nestTestInput.byte_thing);
|
||||
equal(nestTestOutput.struct_thing.string_thing, nestTestInput.struct_thing.string_thing);
|
||||
equal(nestTestOutput.struct_thing.byte_thing, nestTestInput.struct_thing.byte_thing);
|
||||
equal(nestTestOutput.struct_thing.i32_thing, nestTestInput.struct_thing.i32_thing);
|
||||
equal(nestTestOutput.struct_thing.i64_thing, nestTestInput.struct_thing.i64_thing);
|
||||
equal(nestTestOutput.i32_thing, nestTestInput.i32_thing);
|
||||
assert.equal(nestTestOutput.byte_thing, nestTestInput.byte_thing);
|
||||
assert.equal(nestTestOutput.struct_thing.string_thing, nestTestInput.struct_thing.string_thing);
|
||||
assert.equal(nestTestOutput.struct_thing.byte_thing, nestTestInput.struct_thing.byte_thing);
|
||||
assert.equal(nestTestOutput.struct_thing.i32_thing, nestTestInput.struct_thing.i32_thing);
|
||||
assert.equal(nestTestOutput.struct_thing.i64_thing, nestTestInput.struct_thing.i64_thing);
|
||||
assert.equal(nestTestOutput.i32_thing, nestTestInput.i32_thing);
|
||||
|
||||
equal(JSON.stringify(nestTestOutput), JSON.stringify(nestTestInput));
|
||||
assert.equal(JSON.stringify(nestTestOutput), JSON.stringify(nestTestInput));
|
||||
});
|
||||
|
||||
test("Map", function() {
|
||||
var mapTestInput = {7:77, 8:88, 9:99};
|
||||
QUnit.test('Map', function(assert) {
|
||||
const mapTestInput = {7: 77, 8: 88, 9: 99};
|
||||
|
||||
var mapTestOutput = client.testMap(mapTestInput);
|
||||
const mapTestOutput = client.testMap(mapTestInput);
|
||||
|
||||
for (var key in mapTestOutput) {
|
||||
equal(mapTestOutput[key], mapTestInput[key]);
|
||||
for (let key in mapTestOutput) {
|
||||
assert.equal(mapTestOutput[key], mapTestInput[key]);
|
||||
}
|
||||
});
|
||||
|
||||
test("StringMap", function() {
|
||||
var mapTestInput = {
|
||||
"a":"123", "a b":"with spaces ", "same":"same", "0":"numeric key",
|
||||
"longValue":stringTest, stringTest:"long key"
|
||||
QUnit.test('StringMap', function(assert) {
|
||||
const mapTestInput = {
|
||||
'a': '123', 'a b': 'with spaces ', 'same': 'same', '0': 'numeric key',
|
||||
'longValue': stringTest, stringTest: 'long key'
|
||||
};
|
||||
|
||||
var mapTestOutput = client.testStringMap(mapTestInput);
|
||||
const mapTestOutput = client.testStringMap(mapTestInput);
|
||||
|
||||
for (var key in mapTestOutput) {
|
||||
equal(mapTestOutput[key], mapTestInput[key]);
|
||||
for (let key in mapTestOutput) {
|
||||
assert.equal(mapTestOutput[key], mapTestInput[key]);
|
||||
}
|
||||
});
|
||||
|
||||
test("Set", function() {
|
||||
var setTestInput = [1,2,3];
|
||||
ok(client.testSet(setTestInput), setTestInput);
|
||||
QUnit.test('Set', function(assert) {
|
||||
const setTestInput = [1, 2, 3];
|
||||
assert.ok(client.testSet(setTestInput), setTestInput);
|
||||
});
|
||||
|
||||
test("List", function() {
|
||||
var listTestInput = [1,2,3];
|
||||
ok(client.testList(listTestInput), listTestInput);
|
||||
QUnit.test('List', function(assert) {
|
||||
const listTestInput = [1, 2, 3];
|
||||
assert.ok(client.testList(listTestInput), listTestInput);
|
||||
});
|
||||
|
||||
test("Enum", function() {
|
||||
equal(client.testEnum(ThriftTest.Numberz.ONE), ThriftTest.Numberz.ONE);
|
||||
QUnit.test('Enum', function(assert) {
|
||||
assert.equal(client.testEnum(ThriftTest.Numberz.ONE), ThriftTest.Numberz.ONE);
|
||||
});
|
||||
|
||||
test("TypeDef", function() {
|
||||
equal(client.testTypedef(69), 69);
|
||||
QUnit.test('TypeDef', function(assert) {
|
||||
assert.equal(client.testTypedef(69), 69);
|
||||
});
|
||||
|
||||
test("Skip", function() {
|
||||
var structTestInput = new ThriftTest.Xtruct();
|
||||
var modifiedClient = new ThriftTest.ThriftTestClient(protocol);
|
||||
QUnit.test('Skip', function(assert) {
|
||||
const structTestInput = new ThriftTest.Xtruct();
|
||||
const modifiedClient = new ThriftTest.ThriftTestClient(protocol);
|
||||
|
||||
modifiedClient.recv_testStruct = function() {
|
||||
var input = modifiedClient.input;
|
||||
var xtruct3 = new ThriftTest.Xtruct3();
|
||||
const input = modifiedClient.input;
|
||||
const xtruct3 = new ThriftTest.Xtruct3();
|
||||
|
||||
input.readMessageBegin();
|
||||
input.readStructBegin();
|
||||
|
@ -250,163 +250,166 @@ module("Structured Types");
|
|||
};
|
||||
|
||||
structTestInput.string_thing = 'worked';
|
||||
structTestInput.byte_thing = 0x01;
|
||||
structTestInput.i32_thing = Math.pow(2,30);
|
||||
structTestInput.i64_thing = Math.pow(2,52);
|
||||
structTestInput.byte_thing = 0x01;
|
||||
structTestInput.i32_thing = Math.pow(2, 30);
|
||||
structTestInput.i64_thing = Math.pow(2, 52);
|
||||
|
||||
var structTestOutput = modifiedClient.testStruct(structTestInput);
|
||||
const structTestOutput = modifiedClient.testStruct(structTestInput);
|
||||
|
||||
equal(structTestOutput instanceof ThriftTest.Xtruct3, true);
|
||||
equal(structTestOutput.string_thing, structTestInput.string_thing);
|
||||
equal(structTestOutput.changed, null);
|
||||
equal(structTestOutput.i32_thing, structTestInput.i32_thing);
|
||||
equal(structTestOutput.i64_thing, structTestInput.i64_thing);
|
||||
assert.equal(structTestOutput instanceof ThriftTest.Xtruct3, true);
|
||||
assert.equal(structTestOutput.string_thing, structTestInput.string_thing);
|
||||
assert.equal(structTestOutput.changed, null);
|
||||
assert.equal(structTestOutput.i32_thing, structTestInput.i32_thing);
|
||||
assert.equal(structTestOutput.i64_thing, structTestInput.i64_thing);
|
||||
});
|
||||
|
||||
|
||||
module("deeper!");
|
||||
QUnit.module('deeper!');
|
||||
|
||||
test("MapMap", function() {
|
||||
var mapMapTestExpectedResult = {
|
||||
"4":{"1":1,"2":2,"3":3,"4":4},
|
||||
"-4":{"-4":-4, "-3":-3, "-2":-2, "-1":-1}
|
||||
QUnit.test('MapMap', function(assert) {
|
||||
const mapMapTestExpectedResult = {
|
||||
'4': {'1': 1, '2': 2, '3': 3, '4': 4},
|
||||
'-4': {'-4': -4, '-3': -3, '-2': -2, '-1': -1}
|
||||
};
|
||||
|
||||
var mapMapTestOutput = client.testMapMap(1);
|
||||
const mapMapTestOutput = client.testMapMap(1);
|
||||
|
||||
|
||||
for (var key in mapMapTestOutput) {
|
||||
for (var key2 in mapMapTestOutput[key]) {
|
||||
equal(mapMapTestOutput[key][key2], mapMapTestExpectedResult[key][key2]);
|
||||
for (let key in mapMapTestOutput) {
|
||||
for (let key2 in mapMapTestOutput[key]) {
|
||||
assert.equal(mapMapTestOutput[key][key2], mapMapTestExpectedResult[key][key2]);
|
||||
}
|
||||
}
|
||||
|
||||
checkRecursively(mapMapTestOutput, mapMapTestExpectedResult);
|
||||
checkRecursively(assert, mapMapTestOutput, mapMapTestExpectedResult);
|
||||
});
|
||||
|
||||
|
||||
module("Exception");
|
||||
QUnit.module('Exception');
|
||||
|
||||
test("Xception", function() {
|
||||
expect(2);
|
||||
try{
|
||||
client.testException("Xception");
|
||||
}catch(e){
|
||||
equal(e.errorCode, 1001);
|
||||
equal(e.message, "Xception");
|
||||
QUnit.test('Xception', function(assert) {
|
||||
assert.expect(2);
|
||||
const done = assert.async();
|
||||
try {
|
||||
client.testException('Xception');
|
||||
assert.ok(false);
|
||||
}catch (e) {
|
||||
assert.equal(e.errorCode, 1001);
|
||||
assert.equal(e.message, 'Xception');
|
||||
done();
|
||||
}
|
||||
});
|
||||
|
||||
test("no Exception", 0, function() {
|
||||
try{
|
||||
client.testException("no Exception");
|
||||
}catch(e){
|
||||
ok(false);
|
||||
QUnit.test('no Exception', function(assert) {
|
||||
assert.expect(1);
|
||||
try {
|
||||
client.testException('no Exception');
|
||||
assert.ok(true);
|
||||
}catch (e) {
|
||||
assert.ok(false);
|
||||
}
|
||||
});
|
||||
|
||||
test("TException", function() {
|
||||
QUnit.test('TException', function(assert) {
|
||||
//ThriftTest does not list TException as a legal exception so it will
|
||||
// generate an exception on the server that does not propagate back to
|
||||
// the client. This test has been modified to equate to "no exception"
|
||||
expect(1);
|
||||
try{
|
||||
client.testException("TException");
|
||||
} catch(e) {
|
||||
//ok(false);
|
||||
assert.expect(1);
|
||||
try {
|
||||
client.testException('TException');
|
||||
} catch (e) {
|
||||
//assert.ok(false);
|
||||
}
|
||||
ok(true);
|
||||
assert.ok(true);
|
||||
});
|
||||
|
||||
|
||||
module("Insanity");
|
||||
QUnit.module('Insanity');
|
||||
|
||||
var crazy = {
|
||||
"userMap":{ "5":5, "8":8 },
|
||||
"xtructs":[{
|
||||
"string_thing":"Goodbye4",
|
||||
"byte_thing":4,
|
||||
"i32_thing":4,
|
||||
"i64_thing":4
|
||||
const crazy = {
|
||||
'userMap': { '5': 5, '8': 8 },
|
||||
'xtructs': [{
|
||||
'string_thing': 'Goodbye4',
|
||||
'byte_thing': 4,
|
||||
'i32_thing': 4,
|
||||
'i64_thing': 4
|
||||
},
|
||||
{
|
||||
"string_thing":"Hello2",
|
||||
"byte_thing":2,
|
||||
"i32_thing":2,
|
||||
"i64_thing":2
|
||||
'string_thing': 'Hello2',
|
||||
'byte_thing': 2,
|
||||
'i32_thing': 2,
|
||||
'i64_thing': 2
|
||||
}]
|
||||
};
|
||||
test("testInsanity", function() {
|
||||
var insanity = {
|
||||
"1":{
|
||||
"2":crazy,
|
||||
"3":crazy
|
||||
QUnit.test('testInsanity', function(assert) {
|
||||
const insanity = {
|
||||
'1': {
|
||||
'2': crazy,
|
||||
'3': crazy
|
||||
},
|
||||
"2":{ "6":{ "userMap":null, "xtructs":null } }
|
||||
'2': { '6': { 'userMap': null, 'xtructs': null } }
|
||||
};
|
||||
var res = client.testInsanity(new ThriftTest.Insanity(crazy));
|
||||
ok(res, JSON.stringify(res));
|
||||
ok(insanity, JSON.stringify(insanity));
|
||||
const res = client.testInsanity(new ThriftTest.Insanity(crazy));
|
||||
assert.ok(res, JSON.stringify(res));
|
||||
assert.ok(insanity, JSON.stringify(insanity));
|
||||
|
||||
checkRecursively(res, insanity);
|
||||
checkRecursively(assert, res, insanity);
|
||||
});
|
||||
|
||||
|
||||
//////////////////////////////////
|
||||
//Run same tests asynchronously
|
||||
|
||||
module("Async");
|
||||
QUnit.module('Async');
|
||||
|
||||
test("Double", function() {
|
||||
expect( 1 );
|
||||
QUnit.test('Double', function(assert) {
|
||||
assert.expect(1);
|
||||
|
||||
QUnit.stop();
|
||||
const done = assert.async();
|
||||
client.testDouble(3.14159265, function(result) {
|
||||
equal(result, 3.14159265);
|
||||
QUnit.start();
|
||||
assert.equal(result, 3.14159265);
|
||||
done();
|
||||
});
|
||||
});
|
||||
|
||||
test("Byte", function() {
|
||||
expect( 1 );
|
||||
QUnit.test('Byte', function(assert) {
|
||||
assert.expect(1);
|
||||
|
||||
QUnit.stop();
|
||||
const done = assert.async();
|
||||
client.testByte(0x01, function(result) {
|
||||
equal(result, 0x01);
|
||||
QUnit.start();
|
||||
assert.equal(result, 0x01);
|
||||
done();
|
||||
});
|
||||
});
|
||||
|
||||
test("I32", function() {
|
||||
expect( 2 );
|
||||
QUnit.test('I32', function(assert) {
|
||||
assert.expect(2);
|
||||
|
||||
QUnit.stop();
|
||||
client.testI32(Math.pow(2,30), function(result) {
|
||||
equal(result, Math.pow(2,30));
|
||||
QUnit.start();
|
||||
const done = assert.async(2);
|
||||
client.testI32(Math.pow(2, 30), function(result) {
|
||||
assert.equal(result, Math.pow(2, 30));
|
||||
done();
|
||||
});
|
||||
|
||||
QUnit.stop();
|
||||
client.testI32(Math.pow(-2,31), function(result) {
|
||||
equal(result, Math.pow(-2,31));
|
||||
QUnit.start();
|
||||
client.testI32(Math.pow(-2, 31), function(result) {
|
||||
assert.equal(result, Math.pow(-2, 31));
|
||||
done();
|
||||
});
|
||||
});
|
||||
|
||||
test("I64", function() {
|
||||
expect( 2 );
|
||||
QUnit.test('I64', function(assert) {
|
||||
assert.expect(2);
|
||||
|
||||
QUnit.stop();
|
||||
const done = assert.async(2);
|
||||
//This is usually 2^60 but JS cannot represent anything over 2^52 accurately
|
||||
client.testI64(Math.pow(2,52), function(result) {
|
||||
equal(result, Math.pow(2,52));
|
||||
QUnit.start();
|
||||
client.testI64(Math.pow(2, 52), function(result) {
|
||||
assert.equal(result, Math.pow(2, 52));
|
||||
done();
|
||||
});
|
||||
|
||||
QUnit.stop();
|
||||
//This is usually 2^60 but JS cannot represent anything over 2^52 accurately
|
||||
client.testI64(Math.pow(-2,52), function(result) {
|
||||
equal(result, Math.pow(-2,52));
|
||||
QUnit.start();
|
||||
client.testI64(Math.pow(-2, 52), function(result) {
|
||||
assert.equal(result, Math.pow(-2, 52));
|
||||
done();
|
||||
});
|
||||
});
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue