@@ -84,10 +84,10 @@ function doTestUnsignedValue(
84
84
}
85
85
86
86
// Encoding values outside the valid range should assert.
87
- expect ( function ( ) {
87
+ expect ( ( ) => {
88
88
writeValue . call ( encoder , - 1 ) ;
89
89
} ) . toThrow ( ) ;
90
- expect ( function ( ) {
90
+ expect ( ( ) => {
91
91
writeValue . call ( encoder , upperLimit * 1.1 ) ;
92
92
} ) . toThrow ( ) ;
93
93
}
@@ -155,11 +155,11 @@ function doTestSignedValue(
155
155
}
156
156
}
157
157
158
- describe ( 'binaryDecoderTest' , function ( ) {
158
+ describe ( 'binaryDecoderTest' , ( ) => {
159
159
/**
160
160
* Tests the decoder instance cache.
161
161
*/
162
- it ( 'testInstanceCache' , /** @suppress {visibility} */ function ( ) {
162
+ it ( 'testInstanceCache' , /** @suppress {visibility} */ ( ) => {
163
163
// Empty the instance caches.
164
164
jspb . BinaryDecoder . instanceCache_ = [ ] ;
165
165
@@ -183,7 +183,7 @@ describe('binaryDecoderTest', function() {
183
183
} ) ;
184
184
185
185
186
- describe ( 'varint64' , function ( ) {
186
+ describe ( 'varint64' , ( ) => {
187
187
let /** !jspb.BinaryEncoder */ encoder ;
188
188
let /** !jspb.BinaryDecoder */ decoder ;
189
189
@@ -195,7 +195,7 @@ describe('binaryDecoderTest', function() {
195
195
String . fromCharCode ( 0x12 , 0x34 , 0x56 , 0x78 , 0x87 , 0x65 , 0x43 , 0x21 ) ;
196
196
const hashD =
197
197
String . fromCharCode ( 0xFF , 0xFF , 0xFF , 0xFF , 0xFF , 0xFF , 0xFF , 0xFF ) ;
198
- beforeEach ( function ( ) {
198
+ beforeEach ( ( ) => {
199
199
encoder = new jspb . BinaryEncoder ( ) ;
200
200
201
201
encoder . writeVarintHash64 ( hashA ) ;
@@ -211,7 +211,7 @@ describe('binaryDecoderTest', function() {
211
211
decoder = jspb . BinaryDecoder . alloc ( encoder . end ( ) ) ;
212
212
} ) ;
213
213
214
- it ( 'reads 64-bit integers as hash strings' , function ( ) {
214
+ it ( 'reads 64-bit integers as hash strings' , ( ) => {
215
215
expect ( hashA ) . toEqual ( decoder . readVarintHash64 ( ) ) ;
216
216
expect ( hashB ) . toEqual ( decoder . readVarintHash64 ( ) ) ;
217
217
expect ( hashC ) . toEqual ( decoder . readVarintHash64 ( ) ) ;
@@ -223,7 +223,7 @@ describe('binaryDecoderTest', function() {
223
223
expect ( hashD ) . toEqual ( decoder . readFixedHash64 ( ) ) ;
224
224
} ) ;
225
225
226
- it ( 'reads split 64 bit integers' , function ( ) {
226
+ it ( 'reads split 64 bit integers' , ( ) => {
227
227
function hexJoin ( bitsLow , bitsHigh ) {
228
228
return `0x${ ( bitsHigh >>> 0 ) . toString ( 16 ) } :0x${
229
229
( bitsLow >>> 0 ) . toString ( 16 ) } `;
@@ -245,7 +245,7 @@ describe('binaryDecoderTest', function() {
245
245
} ) ;
246
246
} ) ;
247
247
248
- describe ( 'sint64' , function ( ) {
248
+ describe ( 'sint64' , ( ) => {
249
249
let /** !jspb.BinaryDecoder */ decoder ;
250
250
251
251
const hashA =
@@ -256,7 +256,7 @@ describe('binaryDecoderTest', function() {
256
256
String . fromCharCode ( 0x12 , 0x34 , 0x56 , 0x78 , 0x87 , 0x65 , 0x43 , 0x21 ) ;
257
257
const hashD =
258
258
String . fromCharCode ( 0xFF , 0xFF , 0xFF , 0xFF , 0xFF , 0xFF , 0xFF , 0xFF ) ;
259
- beforeEach ( function ( ) {
259
+ beforeEach ( ( ) => {
260
260
const encoder = new jspb . BinaryEncoder ( ) ;
261
261
262
262
encoder . writeZigzagVarintHash64 ( hashA ) ;
@@ -267,7 +267,7 @@ describe('binaryDecoderTest', function() {
267
267
decoder = jspb . BinaryDecoder . alloc ( encoder . end ( ) ) ;
268
268
} ) ;
269
269
270
- it ( 'reads 64-bit integers as decimal strings' , function ( ) {
270
+ it ( 'reads 64-bit integers as decimal strings' , ( ) => {
271
271
const signed = true ;
272
272
expect ( decoder . readZigzagVarint64String ( ) )
273
273
. toEqual ( jspb . utils . hash64ToDecimalString ( hashA , signed ) ) ;
@@ -279,14 +279,14 @@ describe('binaryDecoderTest', function() {
279
279
. toEqual ( jspb . utils . hash64ToDecimalString ( hashD , signed ) ) ;
280
280
} ) ;
281
281
282
- it ( 'reads 64-bit integers as hash strings' , function ( ) {
282
+ it ( 'reads 64-bit integers as hash strings' , ( ) => {
283
283
expect ( decoder . readZigzagVarintHash64 ( ) ) . toEqual ( hashA ) ;
284
284
expect ( decoder . readZigzagVarintHash64 ( ) ) . toEqual ( hashB ) ;
285
285
expect ( decoder . readZigzagVarintHash64 ( ) ) . toEqual ( hashC ) ;
286
286
expect ( decoder . readZigzagVarintHash64 ( ) ) . toEqual ( hashD ) ;
287
287
} ) ;
288
288
289
- it ( 'reads split 64 bit zigzag integers' , function ( ) {
289
+ it ( 'reads split 64 bit zigzag integers' , ( ) => {
290
290
function hexJoin ( bitsLow , bitsHigh ) {
291
291
return `0x${ ( bitsHigh >>> 0 ) . toString ( 16 ) } :0x${
292
292
( bitsLow >>> 0 ) . toString ( 16 ) } `;
@@ -306,7 +306,7 @@ describe('binaryDecoderTest', function() {
306
306
. toEqual ( hexJoinHash ( hashD ) ) ;
307
307
} ) ;
308
308
309
- it ( 'does zigzag encoding properly' , function ( ) {
309
+ it ( 'does zigzag encoding properly' , ( ) => {
310
310
// Test cases directly from the protobuf dev guide.
311
311
// https://engdoc.corp.google.com/eng/howto/protocolbuffers/developerguide/encoding.shtml?cl=head#types
312
312
const testCases = [
@@ -340,7 +340,7 @@ describe('binaryDecoderTest', function() {
340
340
/**
341
341
* Tests reading and writing large strings
342
342
*/
343
- it ( 'testLargeStrings' , function ( ) {
343
+ it ( 'testLargeStrings' , ( ) => {
344
344
const encoder = new jspb . BinaryEncoder ( ) ;
345
345
346
346
const len = 150000 ;
@@ -359,7 +359,7 @@ describe('binaryDecoderTest', function() {
359
359
/**
360
360
* Test encoding and decoding utf-8.
361
361
*/
362
- it ( 'testUtf8' , function ( ) {
362
+ it ( 'testUtf8' , ( ) => {
363
363
const encoder = new jspb . BinaryEncoder ( ) ;
364
364
365
365
const ascii = 'ASCII should work in 3, 2, 1...' ;
@@ -384,43 +384,43 @@ describe('binaryDecoderTest', function() {
384
384
/**
385
385
* Verifies that passing a non-string to writeString raises an error.
386
386
*/
387
- it ( 'testBadString' , function ( ) {
387
+ it ( 'testBadString' , ( ) => {
388
388
const encoder = new jspb . BinaryEncoder ( ) ;
389
389
390
- expect ( function ( ) {
390
+ expect ( ( ) => {
391
391
encoder . writeString ( 42 )
392
392
} ) . toThrow ( ) ;
393
- expect ( function ( ) {
393
+ expect ( ( ) => {
394
394
encoder . writeString ( null )
395
395
} ) . toThrow ( ) ;
396
396
} ) ;
397
397
398
398
/**
399
399
* Verifies that misuse of the decoder class triggers assertions.
400
400
*/
401
- it ( 'testDecodeErrors' , function ( ) {
401
+ it ( 'testDecodeErrors' , ( ) => {
402
402
// Reading a value past the end of the stream should trigger an assertion.
403
403
const decoder = jspb . BinaryDecoder . alloc ( [ 0 , 1 , 2 ] ) ;
404
- expect ( function ( ) {
404
+ expect ( ( ) => {
405
405
decoder . readUint64 ( )
406
406
} ) . toThrow ( ) ;
407
407
408
408
// Overlong varints should trigger assertions.
409
409
decoder . setBlock (
410
410
[ 255 , 255 , 255 , 255 , 255 , 255 , 255 , 255 , 255 , 255 , 255 , 0 ] ) ;
411
- expect ( function ( ) {
411
+ expect ( ( ) => {
412
412
decoder . readUnsignedVarint64 ( )
413
413
} ) . toThrow ( ) ;
414
414
decoder . reset ( ) ;
415
- expect ( function ( ) {
415
+ expect ( ( ) => {
416
416
decoder . readSignedVarint64 ( )
417
417
} ) . toThrow ( ) ;
418
418
decoder . reset ( ) ;
419
- expect ( function ( ) {
419
+ expect ( ( ) => {
420
420
decoder . readZigzagVarint64 ( )
421
421
} ) . toThrow ( ) ;
422
422
decoder . reset ( ) ;
423
- expect ( function ( ) {
423
+ expect ( ( ) => {
424
424
decoder . readUnsignedVarint32 ( )
425
425
} ) . toThrow ( ) ;
426
426
} ) ;
@@ -429,7 +429,7 @@ describe('binaryDecoderTest', function() {
429
429
/**
430
430
* Tests encoding and decoding of unsigned integers.
431
431
*/
432
- it ( 'testUnsignedIntegers' , function ( ) {
432
+ it ( 'testUnsignedIntegers' , ( ) => {
433
433
doTestUnsignedValue (
434
434
jspb . BinaryDecoder . prototype . readUint8 ,
435
435
jspb . BinaryEncoder . prototype . writeUint8 , 1 , 0xFF , Math . round ) ;
@@ -462,7 +462,7 @@ describe('binaryDecoderTest', function() {
462
462
/**
463
463
* Tests encoding and decoding of signed integers.
464
464
*/
465
- it ( 'testSignedIntegers' , function ( ) {
465
+ it ( 'testSignedIntegers' , ( ) => {
466
466
doTestSignedValue (
467
467
jspb . BinaryDecoder . prototype . readInt8 ,
468
468
jspb . BinaryEncoder . prototype . writeInt8 , 1 , - 0x80 , 0x7F , Math . round ) ;
@@ -497,7 +497,7 @@ describe('binaryDecoderTest', function() {
497
497
/**
498
498
* Tests encoding and decoding of floats.
499
499
*/
500
- it ( 'testFloats' , function ( ) {
500
+ it ( 'testFloats' , ( ) => {
501
501
/**
502
502
* @param {number } x
503
503
* @return {number }
0 commit comments