diff options
author | Adam Cozzette <acozzette@gmail.com> | 2016-10-04 13:14:12 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-10-04 13:14:12 -0700 |
commit | 71e5994b1a0a254c20486fd16cdb33f35e0c0953 (patch) | |
tree | cc3eec8458e085a188208bc060a611718639e338 /js/message_test.js | |
parent | 2d897c8fa2cbe21683263e3eeddd1ab8e0d89091 (diff) | |
parent | c4d70123ac99ff1a0886fc7dfa492010b027210a (diff) | |
download | protobuf-71e5994b1a0a254c20486fd16cdb33f35e0c0953.tar.gz protobuf-71e5994b1a0a254c20486fd16cdb33f35e0c0953.tar.bz2 protobuf-71e5994b1a0a254c20486fd16cdb33f35e0c0953.zip |
Merge pull request #2193 from acozzette/common-js-fix
Fixed references to foreign nested messages with CommonJS-style imports
Diffstat (limited to 'js/message_test.js')
-rw-r--r-- | js/message_test.js | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/js/message_test.js b/js/message_test.js index 97c594c8..b0a0a72e 100644 --- a/js/message_test.js +++ b/js/message_test.js @@ -1040,4 +1040,18 @@ describe('Message test suite', function() { assertNan(message.getDefaultDoubleField()); }); + // Verify that we can successfully use a field referring to a nested message + // from a different .proto file. + it('testForeignNestedMessage', function() { + var msg = new proto.jspb.test.ForeignNestedFieldMessage(); + var nested = new proto.jspb.test.Deeply.Nested.Message(); + nested.setCount(5); + msg.setDeeplyNestedMessage(nested); + + // After a serialization-deserialization round trip we should get back the + // same data we started with. + var serialized = msg.serializeBinary(); + var deserialized = proto.jspb.test.ForeignNestedFieldMessage.deserializeBinary(serialized); + assertEquals(5, deserialized.getDeeplyNestedMessage().getCount()); + }); }); |