| Index: third_party/protobuf/js/binary/reader_test.js
|
| diff --git a/third_party/protobuf/js/binary/reader_test.js b/third_party/protobuf/js/binary/reader_test.js
|
| index 957113859e5d2e765717d7cd8d2455d37a542537..6f7e5d4567d12aef9508f3dcb03332ad73f9cb06 100644
|
| --- a/third_party/protobuf/js/binary/reader_test.js
|
| +++ b/third_party/protobuf/js/binary/reader_test.js
|
| @@ -52,8 +52,9 @@ goog.require('jspb.BinaryWriter');
|
| describe('binaryReaderTest', function() {
|
| /**
|
| * Tests the reader instance cache.
|
| + * @suppress {visibility}
|
| */
|
| - it('testInstanceCaches', /** @suppress {visibility} */ function() {
|
| + it('testInstanceCaches', function() {
|
| var writer = new jspb.BinaryWriter();
|
| var dummyMessage = /** @type {!jspb.BinaryMessage} */({});
|
| writer.writeMessage(1, dummyMessage, goog.nullFunction);
|
| @@ -130,8 +131,9 @@ describe('binaryReaderTest', function() {
|
|
|
| /**
|
| * Verifies that misuse of the reader class triggers assertions.
|
| + * @suppress {checkTypes|visibility}
|
| */
|
| - it('testReadErrors', /** @suppress {checkTypes|visibility} */ function() {
|
| + it('testReadErrors', function() {
|
| // Calling readMessage on a non-delimited field should trigger an
|
| // assertion.
|
| var reader = jspb.BinaryReader.alloc([8, 1]);
|
| @@ -198,7 +200,7 @@ describe('binaryReaderTest', function() {
|
| * @private
|
| * @suppress {missingProperties}
|
| */
|
| - var doTestUnsignedField_ = function(readField,
|
| + function doTestUnsignedField_(readField,
|
| writeField, epsilon, upperLimit, filter) {
|
| assertNotNull(readField);
|
| assertNotNull(writeField);
|
| @@ -250,7 +252,7 @@ describe('binaryReaderTest', function() {
|
| * @private
|
| * @suppress {missingProperties}
|
| */
|
| - var doTestSignedField_ = function(readField,
|
| + function doTestSignedField_(readField,
|
| writeField, epsilon, lowerLimit, upperLimit, filter) {
|
| var writer = new jspb.BinaryWriter();
|
|
|
| @@ -319,12 +321,12 @@ describe('binaryReaderTest', function() {
|
| * Tests fields that use varint encoding.
|
| */
|
| it('testVarintFields', function() {
|
| - assertNotUndefined(jspb.BinaryReader.prototype.readUint32);
|
| - assertNotUndefined(jspb.BinaryWriter.prototype.writeUint32);
|
| - assertNotUndefined(jspb.BinaryReader.prototype.readUint64);
|
| - assertNotUndefined(jspb.BinaryWriter.prototype.writeUint64);
|
| - assertNotUndefined(jspb.BinaryReader.prototype.readBool);
|
| - assertNotUndefined(jspb.BinaryWriter.prototype.writeBool);
|
| + assertNotNull(jspb.BinaryReader.prototype.readUint32);
|
| + assertNotNull(jspb.BinaryReader.prototype.writeUint32);
|
| + assertNotNull(jspb.BinaryReader.prototype.readUint64);
|
| + assertNotNull(jspb.BinaryReader.prototype.writeUint64);
|
| + assertNotNull(jspb.BinaryReader.prototype.readBool);
|
| + assertNotNull(jspb.BinaryReader.prototype.writeBool);
|
| doTestUnsignedField_(
|
| jspb.BinaryReader.prototype.readUint32,
|
| jspb.BinaryWriter.prototype.writeUint32,
|
| @@ -358,57 +360,6 @@ describe('binaryReaderTest', function() {
|
|
|
|
|
| /**
|
| - * Tests reading a field from hexadecimal string (format: '08 BE EF').
|
| - * @param {Function} readField
|
| - * @param {number} expected
|
| - * @param {string} hexString
|
| - */
|
| - function doTestHexStringVarint_(readField, expected, hexString) {
|
| - var bytesCount = (hexString.length + 1) / 3;
|
| - var bytes = new Uint8Array(bytesCount);
|
| - for (var i = 0; i < bytesCount; i++) {
|
| - bytes[i] = parseInt(hexString.substring(i * 3, i * 3 + 2), 16);
|
| - }
|
| - var reader = jspb.BinaryReader.alloc(bytes);
|
| - reader.nextField();
|
| - assertEquals(expected, readField.call(reader));
|
| - }
|
| -
|
| -
|
| - /**
|
| - * Tests non-canonical redundant varint decoding.
|
| - */
|
| - it('testRedundantVarintFields', function() {
|
| - assertNotNull(jspb.BinaryReader.prototype.readUint32);
|
| - assertNotNull(jspb.BinaryReader.prototype.readUint64);
|
| - assertNotNull(jspb.BinaryReader.prototype.readSint32);
|
| - assertNotNull(jspb.BinaryReader.prototype.readSint64);
|
| -
|
| - // uint32 and sint32 take no more than 5 bytes
|
| - // 08 - field prefix (type = 0 means varint)
|
| - doTestHexStringVarint_(
|
| - jspb.BinaryReader.prototype.readUint32,
|
| - 12, '08 8C 80 80 80 00');
|
| -
|
| - // 11 stands for -6 in zigzag encoding
|
| - doTestHexStringVarint_(
|
| - jspb.BinaryReader.prototype.readSint32,
|
| - -6, '08 8B 80 80 80 00');
|
| -
|
| - // uint64 and sint64 take no more than 10 bytes
|
| - // 08 - field prefix (type = 0 means varint)
|
| - doTestHexStringVarint_(
|
| - jspb.BinaryReader.prototype.readUint64,
|
| - 12, '08 8C 80 80 80 80 80 80 80 80 00');
|
| -
|
| - // 11 stands for -6 in zigzag encoding
|
| - doTestHexStringVarint_(
|
| - jspb.BinaryReader.prototype.readSint64,
|
| - -6, '08 8B 80 80 80 80 80 80 80 80 00');
|
| - });
|
| -
|
| -
|
| - /**
|
| * Tests 64-bit fields that are handled as strings.
|
| */
|
| it('testStringInt64Fields', function() {
|
|
|