THRIFT-2576 Implement Thrift.Protocol.prototype.skip method in JavaScript library
Client: JavaScript
Patch: Hyungsul Kim
This closes #141
diff --git a/lib/js/test/test.js b/lib/js/test/test.js
index 7351fd9..1504f62 100755
--- a/lib/js/test/test.js
+++ b/lib/js/test/test.js
@@ -191,6 +191,45 @@
equal(client.testTypedef(69), 69);
});
+ test("Skip", function() {
+ var structTestInput = new ThriftTest.Xtruct();
+ var modifiedClient = new ThriftTest.ThriftTestClient(protocol);
+
+ modifiedClient.recv_testStruct = function() {
+ var input = modifiedClient.input;
+ var xtruct3 = new ThriftTest.Xtruct3();
+
+ input.readMessageBegin();
+ input.readStructBegin();
+
+ // read Xtruct data with Xtruct3
+ input.readFieldBegin();
+ xtruct3.read(input);
+ input.readFieldEnd();
+ // read Thrift.Type.STOP message
+ input.readFieldBegin();
+ input.readFieldEnd();
+
+ input.readStructEnd();
+ input.readMessageEnd();
+
+ return xtruct3;
+ };
+
+ structTestInput.string_thing = 'worked';
+ structTestInput.byte_thing = 0x01;
+ structTestInput.i32_thing = Math.pow(2,30);
+ structTestInput.i64_thing = Math.pow(2,52);
+
+ var 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);
+ });
+
module("deeper!");