@@ -172,56 +172,67 @@ assert.doesNotMatch(
172
172
const dv = new DataView ( ab , 1 , 2 ) ;
173
173
assert . strictEqual (
174
174
util . inspect ( ab , showHidden ) ,
175
- 'ArrayBuffer { [Uint8Contents]: <01 02 03 04>, byteLength: 4 }'
175
+ 'ArrayBuffer { [Uint8Contents]: <01 02 03 04>, [ byteLength] : 4 }'
176
176
) ;
177
177
assert . strictEqual ( util . inspect ( new DataView ( ab , 1 , 2 ) , showHidden ) ,
178
178
'DataView {\n' +
179
- ' byteLength: 2,\n' +
180
- ' byteOffset: 1,\n' +
181
- ' buffer: ArrayBuffer {' +
182
- ' [Uint8Contents]: <01 02 03 04>, byteLength: 4 }\n}' ) ;
179
+ ' [ byteLength] : 2,\n' +
180
+ ' [ byteOffset] : 1,\n' +
181
+ ' [ buffer] : ArrayBuffer {' +
182
+ ' [Uint8Contents]: <01 02 03 04>, [ byteLength] : 4 }\n}' ) ;
183
183
assert . strictEqual (
184
184
util . inspect ( ab , showHidden ) ,
185
- 'ArrayBuffer { [Uint8Contents]: <01 02 03 04>, byteLength: 4 }'
185
+ 'ArrayBuffer { [Uint8Contents]: <01 02 03 04>, [ byteLength] : 4 }'
186
186
) ;
187
187
assert . strictEqual ( util . inspect ( dv , showHidden ) ,
188
188
'DataView {\n' +
189
- ' byteLength: 2,\n' +
190
- ' byteOffset: 1,\n' +
191
- ' buffer: ArrayBuffer { [Uint8Contents]: ' +
192
- '<01 02 03 04>, byteLength: 4 }\n}' ) ;
189
+ ' [ byteLength] : 2,\n' +
190
+ ' [ byteOffset] : 1,\n' +
191
+ ' [ buffer] : ArrayBuffer { [Uint8Contents]: ' +
192
+ '<01 02 03 04>, [ byteLength] : 4 }\n}' ) ;
193
193
ab . x = 42 ;
194
194
dv . y = 1337 ;
195
195
assert . strictEqual ( util . inspect ( ab , showHidden ) ,
196
196
'ArrayBuffer { [Uint8Contents]: <01 02 03 04>, ' +
197
- 'byteLength: 4, x: 42 }' ) ;
198
- assert . strictEqual ( util . inspect ( dv , showHidden ) ,
197
+ '[ byteLength] : 4, x: 42 }' ) ;
198
+ assert . strictEqual ( util . inspect ( dv , { showHidden, breakLength : 82 } ) ,
199
199
'DataView {\n' +
200
- ' byteLength: 2,\n' +
201
- ' byteOffset: 1,\n' +
202
- ' buffer: ArrayBuffer { [Uint8Contents]: <01 02 03 04>,' +
203
- ' byteLength: 4, x: 42 },\n' +
200
+ ' [ byteLength] : 2,\n' +
201
+ ' [ byteOffset] : 1,\n' +
202
+ ' [ buffer] : ArrayBuffer { [Uint8Contents]: <01 02 03 04>,' +
203
+ ' [ byteLength] : 4, x: 42 },\n' +
204
204
' y: 1337\n}' ) ;
205
205
}
206
206
207
207
{
208
208
const ab = new ArrayBuffer ( 42 ) ;
209
+ const dv = new DataView ( ab ) ;
210
+
209
211
assert . strictEqual ( ab . byteLength , 42 ) ;
210
212
new MessageChannel ( ) . port1 . postMessage ( ab , [ ab ] ) ;
211
213
assert . strictEqual ( ab . byteLength , 0 ) ;
212
214
assert . strictEqual ( util . inspect ( ab ) ,
213
- 'ArrayBuffer { (detached), byteLength: 0 }' ) ;
215
+ 'ArrayBuffer { (detached), [byteLength]: 0 }' ) ;
216
+
217
+ assert . strictEqual (
218
+ util . inspect ( dv ) ,
219
+ 'DataView {\n' +
220
+ ' [byteLength]: 0,\n' +
221
+ ' [byteOffset]: undefined,\n' +
222
+ ' [buffer]: ArrayBuffer { (detached), [byteLength]: 0 }\n' +
223
+ ' }' ,
224
+ ) ;
214
225
}
215
226
216
227
// Truncate output for ArrayBuffers using plural or singular bytes
217
228
{
218
229
const ab = new ArrayBuffer ( 3 ) ;
219
- assert . strictEqual ( util . inspect ( ab , { showHidden : true , maxArrayLength : 2 } ) ,
230
+ assert . strictEqual ( util . inspect ( ab , { showHidden : true , maxArrayLength : 2 , breakLength : 82 } ) ,
220
231
'ArrayBuffer { [Uint8Contents]' +
221
- ': <00 00 ... 1 more byte>, byteLength: 3 }' ) ;
222
- assert . strictEqual ( util . inspect ( ab , { showHidden : true , maxArrayLength : 1 } ) ,
232
+ ': <00 00 ... 1 more byte>, [ byteLength] : 3 }' ) ;
233
+ assert . strictEqual ( util . inspect ( ab , { showHidden : true , maxArrayLength : 1 , breakLength : 82 } ) ,
223
234
'ArrayBuffer { [Uint8Contents]' +
224
- ': <00 ... 2 more bytes>, byteLength: 3 }' ) ;
235
+ ': <00 ... 2 more bytes>, [ byteLength] : 3 }' ) ;
225
236
}
226
237
227
238
// Now do the same checks but from a different context.
@@ -231,35 +242,35 @@ assert.doesNotMatch(
231
242
const dv = vm . runInNewContext ( 'new DataView(ab, 1, 2)' , { ab } ) ;
232
243
assert . strictEqual (
233
244
util . inspect ( ab , showHidden ) ,
234
- 'ArrayBuffer { [Uint8Contents]: <00 00 00 00>, byteLength: 4 }'
245
+ 'ArrayBuffer { [Uint8Contents]: <00 00 00 00>, [ byteLength] : 4 }'
235
246
) ;
236
247
assert . strictEqual ( util . inspect ( new DataView ( ab , 1 , 2 ) , showHidden ) ,
237
248
'DataView {\n' +
238
- ' byteLength: 2,\n' +
239
- ' byteOffset: 1,\n' +
240
- ' buffer: ArrayBuffer { [Uint8Contents]: <00 00 00 00>,' +
241
- ' byteLength: 4 }\n}' ) ;
249
+ ' [ byteLength] : 2,\n' +
250
+ ' [ byteOffset] : 1,\n' +
251
+ ' [ buffer] : ArrayBuffer { [Uint8Contents]: <00 00 00 00>,' +
252
+ ' [ byteLength] : 4 }\n}' ) ;
242
253
assert . strictEqual (
243
254
util . inspect ( ab , showHidden ) ,
244
- 'ArrayBuffer { [Uint8Contents]: <00 00 00 00>, byteLength: 4 }'
255
+ 'ArrayBuffer { [Uint8Contents]: <00 00 00 00>, [ byteLength] : 4 }'
245
256
) ;
246
257
assert . strictEqual ( util . inspect ( dv , showHidden ) ,
247
258
'DataView {\n' +
248
- ' byteLength: 2,\n' +
249
- ' byteOffset: 1,\n' +
250
- ' buffer: ArrayBuffer { [Uint8Contents]: <00 00 00 00>,' +
251
- ' byteLength: 4 }\n}' ) ;
259
+ ' [ byteLength] : 2,\n' +
260
+ ' [ byteOffset] : 1,\n' +
261
+ ' [ buffer] : ArrayBuffer { [Uint8Contents]: <00 00 00 00>,' +
262
+ ' [ byteLength] : 4 }\n}' ) ;
252
263
ab . x = 42 ;
253
264
dv . y = 1337 ;
254
265
assert . strictEqual ( util . inspect ( ab , showHidden ) ,
255
266
'ArrayBuffer { [Uint8Contents]: <00 00 00 00>, ' +
256
- 'byteLength: 4, x: 42 }' ) ;
257
- assert . strictEqual ( util . inspect ( dv , showHidden ) ,
267
+ '[ byteLength] : 4, x: 42 }' ) ;
268
+ assert . strictEqual ( util . inspect ( dv , { showHidden, breakLength : 82 } ) ,
258
269
'DataView {\n' +
259
- ' byteLength: 2,\n' +
260
- ' byteOffset: 1,\n' +
261
- ' buffer: ArrayBuffer { [Uint8Contents]: <00 00 00 00>,' +
262
- ' byteLength: 4, x: 42 },\n' +
270
+ ' [ byteLength] : 2,\n' +
271
+ ' [ byteOffset] : 1,\n' +
272
+ ' [ buffer] : ArrayBuffer { [Uint8Contents]: <00 00 00 00>,' +
273
+ ' [ byteLength] : 4, x: 42 },\n' +
263
274
' y: 1337\n}' ) ;
264
275
}
265
276
@@ -286,7 +297,7 @@ assert.doesNotMatch(
286
297
` [length]: ${ length } ,\n` +
287
298
` [byteLength]: ${ byteLength } ,\n` +
288
299
' [byteOffset]: 0,\n' +
289
- ` [buffer]: ArrayBuffer { byteLength: ${ byteLength } }\n]` ) ;
300
+ ` [buffer]: ArrayBuffer { [ byteLength] : ${ byteLength } }\n]` ) ;
290
301
assert . strictEqual (
291
302
util . inspect ( array , false ) ,
292
303
`${ constructor . name } (${ length } ) [ 65, 97 ]`
@@ -320,7 +331,7 @@ assert.doesNotMatch(
320
331
` [length]: ${ length } ,\n` +
321
332
` [byteLength]: ${ byteLength } ,\n` +
322
333
' [byteOffset]: 0,\n' +
323
- ` [buffer]: ArrayBuffer { byteLength: ${ byteLength } }\n]` ) ;
334
+ ` [buffer]: ArrayBuffer { [ byteLength] : ${ byteLength } }\n]` ) ;
324
335
assert . strictEqual (
325
336
util . inspect ( array , false ) ,
326
337
`${ constructor . name } (${ length } ) [ 65, 97 ]`
@@ -1837,7 +1848,7 @@ util.inspect(process);
1837
1848
' [byteLength]: 0,' ,
1838
1849
' [byteOffset]: 0,' ,
1839
1850
' [buffer]: ArrayBuffer {' ,
1840
- ' byteLength: 0,' ,
1851
+ ' [ byteLength] : 0,' ,
1841
1852
' foo: true' ,
1842
1853
' }' ,
1843
1854
' ],' ,
@@ -1855,7 +1866,7 @@ util.inspect(process);
1855
1866
' [byteLength]: 0,' ,
1856
1867
' [byteOffset]: 0,' ,
1857
1868
' [buffer]: ArrayBuffer {' ,
1858
- ' byteLength: 0,' ,
1869
+ ' [ byteLength] : 0,' ,
1859
1870
' foo: true' ,
1860
1871
' }' ,
1861
1872
' ],' ,
@@ -1885,7 +1896,7 @@ util.inspect(process);
1885
1896
' [length]: 0,' ,
1886
1897
' [byteLength]: 0,' ,
1887
1898
' [byteOffset]: 0,' ,
1888
- ' [buffer]: ArrayBuffer { byteLength: 0, foo: true }' ,
1899
+ ' [buffer]: ArrayBuffer { [ byteLength] : 0, foo: true }' ,
1889
1900
' ],' ,
1890
1901
' [Set Iterator] {' ,
1891
1902
' [ 1, 2, [length]: 2 ],' ,
@@ -1896,7 +1907,7 @@ util.inspect(process);
1896
1907
' [length]: 0,' ,
1897
1908
' [byteLength]: 0,' ,
1898
1909
' [byteOffset]: 0,' ,
1899
- ' [buffer]: ArrayBuffer { byteLength: 0, foo: true }' ,
1910
+ ' [buffer]: ArrayBuffer { [ byteLength] : 0, foo: true }' ,
1900
1911
' ],' ,
1901
1912
' [Circular *1],' ,
1902
1913
" [Symbol(Symbol.toStringTag)]: 'Map Iterator'" ,
@@ -1924,7 +1935,7 @@ util.inspect(process);
1924
1935
' [byteLength]: 0,' ,
1925
1936
' [byteOffset]: 0,' ,
1926
1937
' [buffer]: ArrayBuffer {' ,
1927
- ' byteLength: 0,' ,
1938
+ ' [ byteLength] : 0,' ,
1928
1939
' foo: true } ],' ,
1929
1940
' [Set Iterator] {' ,
1930
1941
' [ 1,' ,
@@ -1938,7 +1949,7 @@ util.inspect(process);
1938
1949
' [byteLength]: 0,' ,
1939
1950
' [byteOffset]: 0,' ,
1940
1951
' [buffer]: ArrayBuffer {' ,
1941
- ' byteLength: 0,' ,
1952
+ ' [ byteLength] : 0,' ,
1942
1953
' foo: true } ],' ,
1943
1954
' [Circular *1],' ,
1944
1955
' [Symbol(Symbol.toStringTag)]:' ,
@@ -2244,12 +2255,12 @@ assert.strictEqual(util.inspect('"\'${a}'), "'\"\\'${a}'");
2244
2255
[ new BigUint64Array ( 2 ) , '[BigUint64Array(2): null prototype] [ 0n, 0n ]' ] ,
2245
2256
[ new ArrayBuffer ( 16 ) , '[ArrayBuffer: null prototype] {\n' +
2246
2257
' [Uint8Contents]: <00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00>,\n' +
2247
- ' byteLength: undefined\n}' ] ,
2258
+ ' [ byteLength] : undefined\n}' ] ,
2248
2259
[ new DataView ( new ArrayBuffer ( 16 ) ) ,
2249
- '[DataView: null prototype] {\n byteLength: undefined,\n ' +
2250
- 'byteOffset: undefined,\n buffer: undefined\n}' ] ,
2260
+ '[DataView: null prototype] {\n [ byteLength] : undefined,\n ' +
2261
+ '[ byteOffset] : undefined,\n [ buffer] : undefined\n}' ] ,
2251
2262
[ new SharedArrayBuffer ( 2 ) , '[SharedArrayBuffer: null prototype] ' +
2252
- '{\n [Uint8Contents]: <00 00>,\n byteLength: undefined\n}' ] ,
2263
+ '{\n [Uint8Contents]: <00 00>,\n [ byteLength] : undefined\n}' ] ,
2253
2264
[ / f o o b a r / , '[RegExp: null prototype] /foobar/' ] ,
2254
2265
[ new Date ( 'Sun, 14 Feb 2010 11:48:40 GMT' ) ,
2255
2266
'[Date: null prototype] 2010-02-14T11:48:40.000Z' ] ,
@@ -3632,7 +3643,7 @@ assert.strictEqual(
3632
3643
assert . strictEqual (
3633
3644
util . inspect ( o ) ,
3634
3645
'{\n' +
3635
- ' arrayBuffer: ArrayBuffer { [Uint8Contents]: <>, byteLength: 0 },\n' +
3646
+ ' arrayBuffer: ArrayBuffer { [Uint8Contents]: <>, [ byteLength] : 0 },\n' +
3636
3647
' buffer: <Buffer 48 65 6c 6c 6f>,\n' +
3637
3648
' typedArray: TypedArray(5) [Uint8Array] [ 72, 101, 108, 108, 111 ],\n' +
3638
3649
' array: [],\n' +
0 commit comments