@@ -126,7 +126,7 @@ assert.strictEqual(util.inspect({ 'a': { 'b': { 'c': 2 } } }, false, 1),
126
126
'{ a: { b: [Object] } }' ) ;
127
127
assert . strictEqual ( util . inspect ( { 'a' : { 'b' : [ 'c' ] } } , false , 1 ) ,
128
128
'{ a: { b: [Array] } }' ) ;
129
- assert . strictEqual ( util . inspect ( new Uint8Array ( 0 ) ) , 'Uint8Array []' ) ;
129
+ assert . strictEqual ( util . inspect ( new Uint8Array ( 0 ) ) , 'Uint8Array(0) []' ) ;
130
130
assert ( inspect ( new Uint8Array ( 0 ) , { showHidden : true } ) . includes ( '[buffer]' ) ) ;
131
131
assert . strictEqual (
132
132
util . inspect (
@@ -263,7 +263,7 @@ assert(!/Object/.test(
263
263
array [ 1 ] = 97 ;
264
264
assert . strictEqual (
265
265
util . inspect ( array , { showHidden : true } ) ,
266
- `${ constructor . name } [\n` +
266
+ `${ constructor . name } ( ${ length } ) [\n` +
267
267
' 65,\n' +
268
268
' 97,\n' +
269
269
` [BYTES_PER_ELEMENT]: ${ constructor . BYTES_PER_ELEMENT } ,\n` +
@@ -273,7 +273,7 @@ assert(!/Object/.test(
273
273
` [buffer]: ArrayBuffer { byteLength: ${ byteLength } }\n]` ) ;
274
274
assert . strictEqual (
275
275
util . inspect ( array , false ) ,
276
- `${ constructor . name } [ 65, 97 ]`
276
+ `${ constructor . name } ( ${ length } ) [ 65, 97 ]`
277
277
) ;
278
278
} ) ;
279
279
@@ -297,7 +297,7 @@ assert(!/Object/.test(
297
297
array [ 1 ] = 97 ;
298
298
assert . strictEqual (
299
299
util . inspect ( array , true ) ,
300
- `${ constructor . name } [\n` +
300
+ `${ constructor . name } ( ${ length } ) [\n` +
301
301
' 65,\n' +
302
302
' 97,\n' +
303
303
` [BYTES_PER_ELEMENT]: ${ constructor . BYTES_PER_ELEMENT } ,\n` +
@@ -307,7 +307,7 @@ assert(!/Object/.test(
307
307
` [buffer]: ArrayBuffer { byteLength: ${ byteLength } }\n]` ) ;
308
308
assert . strictEqual (
309
309
util . inspect ( array , false ) ,
310
- `${ constructor . name } [ 65, 97 ]`
310
+ `${ constructor . name } ( ${ length } ) [ 65, 97 ]`
311
311
) ;
312
312
} ) ;
313
313
@@ -397,11 +397,11 @@ assert.strictEqual(
397
397
arr [ 49 ] = 'I win' ;
398
398
assert . strictEqual (
399
399
util . inspect ( arr ) ,
400
- "CustomArray [ <49 empty items>, 'I win' ]"
400
+ "CustomArray(50) [ <49 empty items>, 'I win' ]"
401
401
) ;
402
402
assert . strictEqual (
403
403
util . inspect ( arr , { showHidden : true } ) ,
404
- 'CustomArray [\n' +
404
+ 'CustomArray(50) [\n' +
405
405
' <49 empty items>,\n' +
406
406
" 'I win',\n" +
407
407
' [length]: 50,\n' +
@@ -1291,7 +1291,7 @@ if (typeof Symbol !== 'undefined') {
1291
1291
assert . strictEqual ( util . inspect ( x ) ,
1292
1292
'ObjectSubclass { foo: 42 }' ) ;
1293
1293
assert . strictEqual ( util . inspect ( new ArraySubclass ( 1 , 2 , 3 ) ) ,
1294
- 'ArraySubclass [ 1, 2, 3 ]' ) ;
1294
+ 'ArraySubclass(3) [ 1, 2, 3 ]' ) ;
1295
1295
assert . strictEqual ( util . inspect ( new SetSubclass ( [ 1 , 2 , 3 ] ) ) ,
1296
1296
'SetSubclass [Set] { 1, 2, 3 }' ) ;
1297
1297
assert . strictEqual ( util . inspect ( new MapSubclass ( [ [ 'foo' , 42 ] ] ) ) ,
@@ -1387,7 +1387,7 @@ if (typeof Symbol !== 'undefined') {
1387
1387
assert ( util . inspect ( x ) . endsWith ( '1 more item\n]' ) ) ;
1388
1388
assert ( ! util . inspect ( x , { maxArrayLength : 101 } ) . includes ( '1 more item' ) ) ;
1389
1389
assert . strictEqual ( util . inspect ( x , { maxArrayLength : 0 } ) ,
1390
- 'Uint8Array [ ... 101 more items ]' ) ;
1390
+ 'Uint8Array(101) [ ... 101 more items ]' ) ;
1391
1391
assert ( ! util . inspect ( x , { maxArrayLength : null } ) . includes ( '1 more item' ) ) ;
1392
1392
assert ( util . inspect ( x , { maxArrayLength : Infinity } ) . endsWith ( ' 0, 0\n]' ) ) ;
1393
1393
}
@@ -1672,7 +1672,7 @@ util.inspect(process);
1672
1672
' ],' ,
1673
1673
' [length]: 1' ,
1674
1674
' ]' ,
1675
- ' } => Uint8Array [' ,
1675
+ ' } => Uint8Array(0) [' ,
1676
1676
' [BYTES_PER_ELEMENT]: 1,' ,
1677
1677
' [length]: 0,' ,
1678
1678
' [byteLength]: 0,' ,
@@ -1689,7 +1689,7 @@ util.inspect(process);
1689
1689
' [length]: 2' ,
1690
1690
' ]' ,
1691
1691
' } => [Map Iterator] {' ,
1692
- ' Uint8Array [' ,
1692
+ ' Uint8Array(0) [' ,
1693
1693
' [BYTES_PER_ELEMENT]: 1,' ,
1694
1694
' [length]: 0,' ,
1695
1695
' [byteLength]: 0,' ,
@@ -1720,15 +1720,15 @@ util.inspect(process);
1720
1720
' ],' ,
1721
1721
' [length]: 1' ,
1722
1722
' ]' ,
1723
- ' } => Uint8Array [' ,
1723
+ ' } => Uint8Array(0) [' ,
1724
1724
' [BYTES_PER_ELEMENT]: 1,' ,
1725
1725
' [length]: 0,' ,
1726
1726
' [byteLength]: 0,' ,
1727
1727
' [byteOffset]: 0,' ,
1728
1728
' [buffer]: ArrayBuffer { byteLength: 0, foo: true }' ,
1729
1729
' ],' ,
1730
1730
' [Set Iterator] { [ 1, 2, [length]: 2 ] } => [Map Iterator] {' ,
1731
- ' Uint8Array [' ,
1731
+ ' Uint8Array(0) [' ,
1732
1732
' [BYTES_PER_ELEMENT]: 1,' ,
1733
1733
' [length]: 0,' ,
1734
1734
' [byteLength]: 0,' ,
@@ -1756,7 +1756,7 @@ util.inspect(process);
1756
1756
' [length]: 2 ],' ,
1757
1757
' [size]: 1 },' ,
1758
1758
' [length]: 2 ],' ,
1759
- ' [length]: 1 ] } => Uint8Array [' ,
1759
+ ' [length]: 1 ] } => Uint8Array(0) [' ,
1760
1760
' [BYTES_PER_ELEMENT]: 1,' ,
1761
1761
' [length]: 0,' ,
1762
1762
' [byteLength]: 0,' ,
@@ -1768,7 +1768,7 @@ util.inspect(process);
1768
1768
' [ 1,' ,
1769
1769
' 2,' ,
1770
1770
' [length]: 2 ] } => [Map Iterator] {' ,
1771
- ' Uint8Array [' ,
1771
+ ' Uint8Array(0) [' ,
1772
1772
' [BYTES_PER_ELEMENT]: 1,' ,
1773
1773
' [length]: 0,' ,
1774
1774
' [byteLength]: 0,' ,
@@ -1946,7 +1946,7 @@ assert.strictEqual(util.inspect('"\'${a}'), "'\"\\'${a}'");
1946
1946
[ new Set ( [ 1 , 2 ] ) . entries ( ) , '[Set Entries] { [ 1, 1 ], [ 2, 2 ] }' ] ,
1947
1947
[ new Map ( [ [ 1 , 2 ] ] ) . keys ( ) , '[Map Iterator] { 1 }' ] ,
1948
1948
[ new Date ( 2000 ) , '1970-01-01T00:00:02.000Z' ] ,
1949
- [ new Uint8Array ( 2 ) , 'Uint8Array [ 0, 0 ]' ] ,
1949
+ [ new Uint8Array ( 2 ) , 'Uint8Array(2) [ 0, 0 ]' ] ,
1950
1950
[ new Promise ( ( resolve ) => setTimeout ( resolve , 10 ) ) , 'Promise { <pending> }' ] ,
1951
1951
[ new WeakSet ( ) , 'WeakSet { <items unknown> }' ] ,
1952
1952
[ new WeakMap ( ) , 'WeakMap { <items unknown> }' ] ,
@@ -1972,23 +1972,23 @@ assert.strictEqual(util.inspect('"\'${a}'), "'\"\\'${a}'");
1972
1972
1973
1973
// Verify that having no prototype still produces nice results.
1974
1974
[
1975
- [ [ 1 , 3 , 4 ] , '[Array: null prototype] [ 1, 3, 4 ]' ] ,
1975
+ [ [ 1 , 3 , 4 ] , '[Array(3) : null prototype] [ 1, 3, 4 ]' ] ,
1976
1976
[ new Set ( [ 1 , 2 ] ) , '[Set: null prototype] { 1, 2 }' ] ,
1977
1977
[ new Map ( [ [ 1 , 2 ] ] ) , '[Map: null prototype] { 1 => 2 }' ] ,
1978
1978
[ new Promise ( ( resolve ) => setTimeout ( resolve , 10 ) ) ,
1979
1979
'[Promise: null prototype] { <pending> }' ] ,
1980
1980
[ new WeakSet ( ) , '[WeakSet: null prototype] { <items unknown> }' ] ,
1981
1981
[ new WeakMap ( ) , '[WeakMap: null prototype] { <items unknown> }' ] ,
1982
- [ new Uint8Array ( 2 ) , '[Uint8Array: null prototype] [ 0, 0 ]' ] ,
1983
- [ new Uint16Array ( 2 ) , '[Uint16Array: null prototype] [ 0, 0 ]' ] ,
1984
- [ new Uint32Array ( 2 ) , '[Uint32Array: null prototype] [ 0, 0 ]' ] ,
1985
- [ new Int8Array ( 2 ) , '[Int8Array: null prototype] [ 0, 0 ]' ] ,
1986
- [ new Int16Array ( 2 ) , '[Int16Array: null prototype] [ 0, 0 ]' ] ,
1987
- [ new Int32Array ( 2 ) , '[Int32Array: null prototype] [ 0, 0 ]' ] ,
1988
- [ new Float32Array ( 2 ) , '[Float32Array: null prototype] [ 0, 0 ]' ] ,
1989
- [ new Float64Array ( 2 ) , '[Float64Array: null prototype] [ 0, 0 ]' ] ,
1990
- [ new BigInt64Array ( 2 ) , '[BigInt64Array: null prototype] [ 0n, 0n ]' ] ,
1991
- [ new BigUint64Array ( 2 ) , '[BigUint64Array: null prototype] [ 0n, 0n ]' ] ,
1982
+ [ new Uint8Array ( 2 ) , '[Uint8Array(2) : null prototype] [ 0, 0 ]' ] ,
1983
+ [ new Uint16Array ( 2 ) , '[Uint16Array(2) : null prototype] [ 0, 0 ]' ] ,
1984
+ [ new Uint32Array ( 2 ) , '[Uint32Array(2) : null prototype] [ 0, 0 ]' ] ,
1985
+ [ new Int8Array ( 2 ) , '[Int8Array(2) : null prototype] [ 0, 0 ]' ] ,
1986
+ [ new Int16Array ( 2 ) , '[Int16Array(2) : null prototype] [ 0, 0 ]' ] ,
1987
+ [ new Int32Array ( 2 ) , '[Int32Array(2) : null prototype] [ 0, 0 ]' ] ,
1988
+ [ new Float32Array ( 2 ) , '[Float32Array(2) : null prototype] [ 0, 0 ]' ] ,
1989
+ [ new Float64Array ( 2 ) , '[Float64Array(2) : null prototype] [ 0, 0 ]' ] ,
1990
+ [ new BigInt64Array ( 2 ) , '[BigInt64Array(2) : null prototype] [ 0n, 0n ]' ] ,
1991
+ [ new BigUint64Array ( 2 ) , '[BigUint64Array(2) : null prototype] [ 0n, 0n ]' ] ,
1992
1992
[ new ArrayBuffer ( 16 ) , '[ArrayBuffer: null prototype] {\n' +
1993
1993
' [Uint8Contents]: <00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00>,\n' +
1994
1994
' byteLength: undefined\n}' ] ,
@@ -2026,8 +2026,10 @@ assert.strictEqual(util.inspect('"\'${a}'), "'\"\\'${a}'");
2026
2026
class Foo extends base { }
2027
2027
const value = new Foo ( ...input ) ;
2028
2028
const symbol = value [ Symbol . toStringTag ] ;
2029
- const expected = `Foo ${ symbol ? `[${ symbol } ] ` : '' } ${ rawExpected } ` ;
2030
- const expectedWithoutProto = `[${ base . name } : null prototype] ${ rawExpected } ` ;
2029
+ const size = base . name . includes ( 'Array' ) ? `(${ input [ 0 ] } )` : '' ;
2030
+ const expected = `Foo${ size } ${ symbol ? `[${ symbol } ] ` : '' } ${ rawExpected } ` ;
2031
+ const expectedWithoutProto =
2032
+ `[${ base . name } ${ size } : null prototype] ${ rawExpected } ` ;
2031
2033
assert . strictEqual ( util . inspect ( value ) , expected ) ;
2032
2034
value . foo = 'bar' ;
2033
2035
assert . notStrictEqual ( util . inspect ( value ) , expected ) ;
@@ -2050,8 +2052,9 @@ assert.strictEqual(util.inspect('"\'${a}'), "'\"\\'${a}'");
2050
2052
assert . strictEqual ( inspect ( 1n ) , '1n' ) ;
2051
2053
assert . strictEqual ( inspect ( Object ( - 1n ) ) , '[BigInt: -1n]' ) ;
2052
2054
assert . strictEqual ( inspect ( Object ( 13n ) ) , '[BigInt: 13n]' ) ;
2053
- assert . strictEqual ( inspect ( new BigInt64Array ( [ 0n ] ) ) , 'BigInt64Array [ 0n ]' ) ;
2054
- assert . strictEqual ( inspect ( new BigUint64Array ( [ 0n ] ) ) , 'BigUint64Array [ 0n ]' ) ;
2055
+ assert . strictEqual ( inspect ( new BigInt64Array ( [ 0n ] ) ) , 'BigInt64Array(1) [ 0n ]' ) ;
2056
+ assert . strictEqual (
2057
+ inspect ( new BigUint64Array ( [ 0n ] ) ) , 'BigUint64Array(1) [ 0n ]' ) ;
2055
2058
2056
2059
// Verify non-enumerable keys get escaped.
2057
2060
{
@@ -2170,7 +2173,7 @@ assert.strictEqual(
2170
2173
Object . setPrototypeOf ( obj , value ) ;
2171
2174
assert . strictEqual (
2172
2175
util . inspect ( obj ) ,
2173
- 'Object <[Array: null prototype] []> { a: true }'
2176
+ 'Object <[Array(0) : null prototype] []> { a: true }'
2174
2177
) ;
2175
2178
2176
2179
function StorageObject ( ) { }
0 commit comments