diff options
author | Feng Xiao <xfxyjwf@gmail.com> | 2017-03-29 14:32:48 -0700 |
---|---|---|
committer | Feng Xiao <xfxyjwf@gmail.com> | 2017-03-29 14:33:05 -0700 |
commit | d36c0c538a545fac5d9db6ba65c525246d4efa95 (patch) | |
tree | 3fd29af0f137dfaf5df892723e60600f674392b3 /js/binary/decoder_test.js | |
parent | 4a0dd03e52e09332c8fd0f8f26a8e0ae9f911182 (diff) | |
download | protobuf-d36c0c538a545fac5d9db6ba65c525246d4efa95.tar.gz protobuf-d36c0c538a545fac5d9db6ba65c525246d4efa95.tar.bz2 protobuf-d36c0c538a545fac5d9db6ba65c525246d4efa95.zip |
Down-integrate from google3.
Diffstat (limited to 'js/binary/decoder_test.js')
-rw-r--r-- | js/binary/decoder_test.js | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/js/binary/decoder_test.js b/js/binary/decoder_test.js index cb8aff96..d0139e29 100644 --- a/js/binary/decoder_test.js +++ b/js/binary/decoder_test.js @@ -211,6 +211,25 @@ describe('binaryDecoderTest', function() { }); /** + * Tests reading and writing large strings + */ + it('testLargeStrings', function() { + var encoder = new jspb.BinaryEncoder(); + + var len = 150000; + var long_string = ''; + for (var i = 0; i < len; i++) { + long_string += 'a'; + } + + encoder.writeString(long_string); + + var decoder = jspb.BinaryDecoder.alloc(encoder.end()); + + assertEquals(long_string, decoder.readString(len)); + }); + + /** * Test encoding and decoding utf-8. */ it('testUtf8', function() { |