@@ -49,95 +49,95 @@ goog.require('jspb.utils');
49
49
goog.requireType('jspb.BinaryMessage');
50
50
51
51
52
- describe('binaryWriterTest', function() {
52
+ describe('binaryWriterTest', () => {
53
53
/**
54
54
* Verifies that misuse of the writer class triggers assertions.
55
55
*/
56
- it('testWriteErrors', function() {
56
+ it('testWriteErrors', () => {
57
57
// Submessages with invalid field indices should assert.
58
58
let writer = new jspb.BinaryWriter();
59
59
const dummyMessage = /** @type {!jspb.BinaryMessage} */ ({});
60
60
61
- expect(function() {
61
+ expect(() => {
62
62
writer.writeMessage(-1, dummyMessage, () => {});
63
63
}).toThrow();
64
64
65
65
// Writing invalid field indices should assert.
66
66
writer = new jspb.BinaryWriter();
67
- expect(function() {
67
+ expect(() => {
68
68
writer.writeUint64(-1, 1);
69
69
}).toThrow();
70
70
71
71
// Writing out-of-range field values should assert.
72
72
writer = new jspb.BinaryWriter();
73
73
74
- expect(function() {
74
+ expect(() => {
75
75
writer.writeInt32(1, -Infinity);
76
76
}).toThrow();
77
- expect(function() {
77
+ expect(() => {
78
78
writer.writeInt32(1, Infinity);
79
79
}).toThrow();
80
80
81
- expect(function() {
81
+ expect(() => {
82
82
writer.writeInt64(1, -Infinity);
83
83
}).toThrow();
84
- expect(function() {
84
+ expect(() => {
85
85
writer.writeInt64(1, Infinity);
86
86
}).toThrow();
87
87
88
- expect(function() {
88
+ expect(() => {
89
89
writer.writeUint32(1, -1);
90
90
}).toThrow();
91
- expect(function() {
91
+ expect(() => {
92
92
writer.writeUint32(1, Infinity);
93
93
}).toThrow();
94
94
95
- expect(function() {
95
+ expect(() => {
96
96
writer.writeUint64(1, -1);
97
97
}).toThrow();
98
- expect(function() {
98
+ expect(() => {
99
99
writer.writeUint64(1, Infinity);
100
100
}).toThrow();
101
101
102
- expect(function() {
102
+ expect(() => {
103
103
writer.writeSint32(1, -Infinity);
104
104
}).toThrow();
105
- expect(function() {
105
+ expect(() => {
106
106
writer.writeSint32(1, Infinity);
107
107
}).toThrow();
108
108
109
- expect(function() {
109
+ expect(() => {
110
110
writer.writeSint64(1, -Infinity);
111
111
}).toThrow();
112
- expect(function() {
112
+ expect(() => {
113
113
writer.writeSint64(1, Infinity);
114
114
}).toThrow();
115
115
116
- expect(function() {
116
+ expect(() => {
117
117
writer.writeFixed32(1, -1);
118
118
}).toThrow();
119
- expect(function() {
119
+ expect(() => {
120
120
writer.writeFixed32(1, Infinity);
121
121
}).toThrow();
122
<
10000
td data-grid-cell-id="diff-5520715a20e082914180800f5dba93952927590ae5b6fcc3245221184286a79c-122-122-1" data-selected="false" role="gridcell" style="background-color:var(--bgColor-default);text-align:center" tabindex="-1" valign="top" class="focusable-grid-cell diff-line-number position-relative diff-line-number-neutral left-side">122
123
- expect(function() {
123
+ expect(() => {
124
124
writer.writeFixed64(1, -1);
125
125
}).toThrow();
126
- expect(function() {
126
+ expect(() => {
127
127
writer.writeFixed64(1, Infinity);
128
128
}).toThrow();
129
129
130
- expect(function() {
130
+ expect(() => {
131
131
writer.writeSfixed32(1, -Infinity);
132
132
}).toThrow();
133
- expect(function() {
133
+ expect(() => {
134
134
writer.writeSfixed32(1, Infinity);
135
135
}).toThrow();
136
136
137
- expect(function() {
137
+ expect(() => {
138
138
writer.writeSfixed64(1, -Infinity);
139
139
}).toThrow();
140
- expect(function() {
140
+ expect(() => {
141
141
writer.writeSfixed64(1, Infinity);
142
142
}).toThrow();
143
143
});
@@ -146,7 +146,7 @@ describe('binaryWriterTest', function() {
146
146
/**
147
147
* Basic test of retrieving the result as a Uint8Array buffer
148
148
*/
149
- it('testGetResultBuffer', function() {
149
+ it('testGetResultBuffer', () => {
150
150
const expected = '0864120b48656c6c6f20776f726c641a0301020320c801';
151
151
152
152
const writer = new jspb.BinaryWriter();
@@ -163,7 +163,7 @@ describe('binaryWriterTest', function() {
163
163
/**
164
164
* Tests websafe encodings for base64 strings.
165
165
*/
166
- it('testWebSafeOption', function() {
166
+ it('testWebSafeOption', () => {
167
167
const writer = new jspb.BinaryWriter();
168
168
writer.writeBytes(1, new Uint8Array([127]));
169
169
expect('CgF/').toEqual(writer.getResultBase64String());
@@ -173,7 +173,7 @@ describe('binaryWriterTest', function() {
173
173
goog.crypt.base64.Alphabet.WEBSAFE_NO_PADDING));
174
174
});
175
175
176
- it('writes split 64 fields', function() {
176
+ it('writes split 64 fields', () => {
177
177
const writer = new jspb.BinaryWriter();
178
178
writer.writeSplitVarint64(1, 0x1, 0x2);
179
179
writer.writeSplitVarint64(1, 0xFFFFFFFF, 0xFFFFFFFF);
@@ -243,7 +243,7 @@ describe('binaryWriterTest', function() {
243
243
]);
244
244
});
245
245
246
- it('writes zigzag 64 fields', function() {
246
+ it('writes zigzag 64 fields', () => {
247
247
// Test cases directly from the protobuf dev guide.
248
248
// https://engdoc.corp.google.com/eng/howto/protocolbuffers/developerguide/encoding.shtml?cl=head#types
249
249
const testCases = [
@@ -355,7 +355,7 @@ describe('binaryWriterTest', function() {
355
355
}));
356
356
});
357
357
358
- it('writes float32 fields', function() {
358
+ it('writes float32 fields', () => {
359
359
const testCases = [
360
360
0, 1, -1, jspb.BinaryConstants.FLOAT32_MIN,
361
361
-jspb.BinaryConstants.FLOAT32_MIN, jspb.BinaryConstants.FLOAT32_MAX,
@@ -378,7 +378,7 @@ describe('binaryWriterTest', function() {
378
378
});
379
379
});
380
380
381
- it('writes double fields', function() {
381
+ it('writes double fields', () => {
382
382
const testCases = [
383
383
0, 1, -1, Number.MAX_SAFE_INTEGER, Number.MIN_SAFE_INTEGER,
384
384
Number.MAX_VALUE, Number.MIN_VALUE, jspb.BinaryConstants.FLOAT32_MIN,
0 commit comments