| Index: third_party/protobuf/js/binary/decoder_test.js
|
| diff --git a/third_party/protobuf/js/binary/decoder_test.js b/third_party/protobuf/js/binary/decoder_test.js
|
| index d045e912cf044985c51e3db4339a34ec34d07483..9f947b99defd6ac6874dd5464f21a76a361bdf5a 100644
|
| --- a/third_party/protobuf/js/binary/decoder_test.js
|
| +++ b/third_party/protobuf/js/binary/decoder_test.js
|
| @@ -147,9 +147,8 @@ function doTestSignedValue(readValue,
|
| describe('binaryDecoderTest', function() {
|
| /**
|
| * Tests the decoder instance cache.
|
| - * @suppress {visibility}
|
| */
|
| - it('testInstanceCache', function() {
|
| + it('testInstanceCache', /** @suppress {visibility} */ function() {
|
| // Empty the instance caches.
|
| jspb.BinaryDecoder.instanceCache_ = [];
|
|
|
| @@ -210,7 +209,30 @@ describe('binaryDecoderTest', function() {
|
| assertEquals(hashC, decoder.readFixedHash64());
|
| assertEquals(hashD, decoder.readFixedHash64());
|
| });
|
| +
|
| + /**
|
| + * Test encoding and decoding utf-8.
|
| + */
|
| + it('testUtf8', function() {
|
| + var encoder = new jspb.BinaryEncoder();
|
|
|
| + var ascii = "ASCII should work in 3, 2, 1..."
|
| + var utf8_two_bytes = "©";
|
| + var utf8_three_bytes = "❄";
|
| + var utf8_four_bytes = "😁";
|
| +
|
| + encoder.writeString(ascii);
|
| + encoder.writeString(utf8_two_bytes);
|
| + encoder.writeString(utf8_three_bytes);
|
| + encoder.writeString(utf8_four_bytes);
|
| +
|
| + var decoder = jspb.BinaryDecoder.alloc(encoder.end());
|
| +
|
| + assertEquals(ascii, decoder.readString(ascii.length));
|
| + assertEquals(utf8_two_bytes, decoder.readString(utf8_two_bytes.length));
|
| + assertEquals(utf8_three_bytes, decoder.readString(utf8_three_bytes.length));
|
| + assertEquals(utf8_four_bytes, decoder.readString(utf8_four_bytes.length));
|
| + });
|
|
|
| /**
|
| * Verifies that misuse of the decoder class triggers assertions.
|
|
|