@@ -126,7 +126,7 @@ assert.strictEqual(util.inspect({'a':{'b':{'c': 2 } } }, false, 1),
126126'{a:{b: [Object] } }' ) ;
127127assert . strictEqual ( util . inspect ( { 'a' : { 'b' : [ 'c' ] } } , false , 1 ) ,
128128'{a:{b: [Array] } }' ) ;
129- assert . strictEqual ( util . inspect ( new Uint8Array ( 0 ) ) , 'Uint8Array []' ) ;
129+ assert . strictEqual ( util . inspect ( new Uint8Array ( 0 ) ) , 'Uint8Array(0) []' ) ;
130130assert ( inspect ( new Uint8Array ( 0 ) , { showHidden : true } ) . includes ( '[buffer]' ) ) ;
131131assert . strictEqual (
132132util . inspect (
@@ -263,7 +263,7 @@ assert(!/Object/.test(
263263array [ 1 ] = 97 ;
264264assert . strictEqual (
265265util . inspect ( array , { showHidden : true } ) ,
266- `${ constructor . name } [\n` +
266+ `${ constructor . name } ( ${ length } ) [\n` +
267267' 65,\n' +
268268' 97,\n' +
269269` [BYTES_PER_ELEMENT]: ${ constructor . BYTES_PER_ELEMENT } ,\n` +
@@ -273,7 +273,7 @@ assert(!/Object/.test(
273273` [buffer]: ArrayBuffer{byteLength: ${ byteLength } }\n]` ) ;
274274assert . strictEqual (
275275util . inspect ( array , false ) ,
276- `${ constructor . name } [ 65, 97 ]`
276+ `${ constructor . name } ( ${ length } ) [ 65, 97 ]`
277277) ;
278278} ) ;
279279
@@ -297,7 +297,7 @@ assert(!/Object/.test(
297297array [ 1 ] = 97 ;
298298assert . strictEqual (
299299util . inspect ( array , true ) ,
300- `${ constructor . name } [\n` +
300+ `${ constructor . name } ( ${ length } ) [\n` +
301301' 65,\n' +
302302' 97,\n' +
303303` [BYTES_PER_ELEMENT]: ${ constructor . BYTES_PER_ELEMENT } ,\n` +
@@ -307,7 +307,7 @@ assert(!/Object/.test(
307307` [buffer]: ArrayBuffer{byteLength: ${ byteLength } }\n]` ) ;
308308assert . strictEqual (
309309util . inspect ( array , false ) ,
310- `${ constructor . name } [ 65, 97 ]`
310+ `${ constructor . name } ( ${ length } ) [ 65, 97 ]`
311311) ;
312312} ) ;
313313
@@ -397,11 +397,11 @@ assert.strictEqual(
397397arr [ 49 ] = 'I win' ;
398398assert . strictEqual (
399399util . inspect ( arr ) ,
400- "CustomArray [ <49 empty items>, 'I win' ]"
400+ "CustomArray(50) [ <49 empty items>, 'I win' ]"
401401) ;
402402assert . strictEqual (
403403util . inspect ( arr , { showHidden : true } ) ,
404- 'CustomArray [\n' +
404+ 'CustomArray(50) [\n' +
405405' <49 empty items>,\n' +
406406" 'I win',\n" +
407407' [length]: 50,\n' +
@@ -1291,7 +1291,7 @@ if (typeof Symbol !== 'undefined'){
12911291assert . strictEqual ( util . inspect ( x ) ,
12921292'ObjectSubclass{foo: 42 }' ) ;
12931293assert . strictEqual ( util . inspect ( new ArraySubclass ( 1 , 2 , 3 ) ) ,
1294- 'ArraySubclass [ 1, 2, 3 ]' ) ;
1294+ 'ArraySubclass(3) [ 1, 2, 3 ]' ) ;
12951295assert . strictEqual ( util . inspect ( new SetSubclass ( [ 1 , 2 , 3 ] ) ) ,
12961296'SetSubclass [Set]{1, 2, 3 }' ) ;
12971297assert . strictEqual ( util . inspect ( new MapSubclass ( [ [ 'foo' , 42 ] ] ) ) ,
@@ -1387,7 +1387,7 @@ if (typeof Symbol !== 'undefined'){
13871387assert ( util . inspect ( x ) . endsWith ( '1 more item\n]' ) ) ;
13881388assert ( ! util . inspect ( x , { maxArrayLength : 101 } ) . includes ( '1 more item' ) ) ;
13891389assert . strictEqual ( util . inspect ( x , { maxArrayLength : 0 } ) ,
1390- 'Uint8Array [ ... 101 more items ]' ) ;
1390+ 'Uint8Array(101) [ ... 101 more items ]' ) ;
13911391assert ( ! util . inspect ( x , { maxArrayLength : null } ) . includes ( '1 more item' ) ) ;
13921392assert ( util . inspect ( x , { maxArrayLength : Infinity } ) . endsWith ( ' 0, 0\n]' ) ) ;
13931393}
@@ -1672,7 +1672,7 @@ util.inspect(process);
16721672' ],' ,
16731673' [length]: 1' ,
16741674' ]' ,
1675- ' } => Uint8Array [' ,
1675+ ' } => Uint8Array(0) [' ,
16761676' [BYTES_PER_ELEMENT]: 1,' ,
16771677' [length]: 0,' ,
16781678' [byteLength]: 0,' ,
@@ -1689,7 +1689,7 @@ util.inspect(process);
16891689' [length]: 2' ,
16901690' ]' ,
16911691'} => [Map Iterator]{' ,
1692- ' Uint8Array [' ,
1692+ ' Uint8Array(0) [' ,
16931693' [BYTES_PER_ELEMENT]: 1,' ,
16941694' [length]: 0,' ,
16951695' [byteLength]: 0,' ,
@@ -1720,15 +1720,15 @@ util.inspect(process);
17201720' ],' ,
17211721' [length]: 1' ,
17221722' ]' ,
1723- ' } => Uint8Array [' ,
1723+ ' } => Uint8Array(0) [' ,
17241724' [BYTES_PER_ELEMENT]: 1,' ,
17251725' [length]: 0,' ,
17261726' [byteLength]: 0,' ,
17271727' [byteOffset]: 0,' ,
17281728' [buffer]: ArrayBuffer{byteLength: 0, foo: true }' ,
17291729' ],' ,
17301730' [Set Iterator]{[ 1, 2, [length]: 2 ] } => [Map Iterator]{' ,
1731- ' Uint8Array [' ,
1731+ ' Uint8Array(0) [' ,
17321732' [BYTES_PER_ELEMENT]: 1,' ,
17331733' [length]: 0,' ,
17341734' [byteLength]: 0,' ,
@@ -1756,7 +1756,7 @@ util.inspect(process);
17561756' [length]: 2 ],' ,
17571757' [size]: 1 },' ,
17581758' [length]: 2 ],' ,
1759- ' [length]: 1 ] } => Uint8Array [' ,
1759+ ' [length]: 1 ] } => Uint8Array(0) [' ,
17601760' [BYTES_PER_ELEMENT]: 1,' ,
17611761' [length]: 0,' ,
17621762' [byteLength]: 0,' ,
@@ -1768,7 +1768,7 @@ util.inspect(process);
17681768' [ 1,' ,
17691769' 2,' ,
17701770' [length]: 2 ] } => [Map Iterator]{' ,
1771- ' Uint8Array [' ,
1771+ ' Uint8Array(0) [' ,
17721772' [BYTES_PER_ELEMENT]: 1,' ,
17731773' [length]: 0,' ,
17741774' [byteLength]: 0,' ,
@@ -1946,7 +1946,7 @@ assert.strictEqual(util.inspect('"\'${a}'), "'\"\\'${a}'");
19461946[ new Set ( [ 1 , 2 ] ) . entries ( ) , '[Set Entries]{[ 1, 1 ], [ 2, 2 ] }' ] ,
19471947[ new Map ( [ [ 1 , 2 ] ] ) . keys ( ) , '[Map Iterator]{1 }' ] ,
19481948[ new Date ( 2000 ) , '1970-01-01T00:00:02.000Z' ] ,
1949- [ new Uint8Array ( 2 ) , 'Uint8Array [ 0, 0 ]' ] ,
1949+ [ new Uint8Array ( 2 ) , 'Uint8Array(2) [ 0, 0 ]' ] ,
19501950[ new Promise ( ( resolve ) => setTimeout ( resolve , 10 ) ) , 'Promise{<pending>}' ] ,
19511951[ new WeakSet ( ) , 'WeakSet{<items unknown>}' ] ,
19521952[ new WeakMap ( ) , 'WeakMap{<items unknown>}' ] ,
@@ -1972,23 +1972,23 @@ assert.strictEqual(util.inspect('"\'${a}'), "'\"\\'${a}'");
19721972
19731973// Verify that having no prototype still produces nice results.
19741974[
1975- [ [ 1 , 3 , 4 ] , '[Array: null prototype] [ 1, 3, 4 ]' ] ,
1975+ [ [ 1 , 3 , 4 ] , '[Array(3) : null prototype] [ 1, 3, 4 ]' ] ,
19761976[ new Set ( [ 1 , 2 ] ) , '[Set: null prototype]{1, 2 }' ] ,
19771977[ new Map ( [ [ 1 , 2 ] ] ) , '[Map: null prototype]{1 => 2 }' ] ,
19781978[ new Promise ( ( resolve ) => setTimeout ( resolve , 10 ) ) ,
19791979'[Promise: null prototype]{<pending>}' ] ,
19801980[ new WeakSet ( ) , '[WeakSet: null prototype]{<items unknown>}' ] ,
19811981[ 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 ]' ] ,
19921992[ new ArrayBuffer ( 16 ) , '[ArrayBuffer: null prototype]{\n' +
19931993' [Uint8Contents]: <00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00>,\n' +
19941994' byteLength: undefined\n}' ] ,
@@ -2026,8 +2026,10 @@ assert.strictEqual(util.inspect('"\'${a}'), "'\"\\'${a}'");
20262026class Foo extends base { }
20272027const value = new Foo ( ...input ) ;
20282028const 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 } ` ;
20312033assert . strictEqual ( util . inspect ( value ) , expected ) ;
20322034value . foo = 'bar' ;
20332035assert . notStrictEqual ( util . inspect ( value ) , expected ) ;
@@ -2050,8 +2052,9 @@ assert.strictEqual(util.inspect('"\'${a}'), "'\"\\'${a}'");
20502052assert . strictEqual ( inspect ( 1n ) , '1n' ) ;
20512053assert . strictEqual ( inspect ( Object ( - 1n ) ) , '[BigInt: -1n]' ) ;
20522054assert . 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 ]' ) ;
20552058
20562059// Verify non-enumerable keys get escaped.
20572060{
@@ -2170,7 +2173,7 @@ assert.strictEqual(
21702173Object . setPrototypeOf ( obj , value ) ;
21712174assert . strictEqual (
21722175util . inspect ( obj ) ,
2173- 'Object <[Array: null prototype] []>{a: true }'
2176+ 'Object <[Array(0) : null prototype] []>{a: true }'
21742177) ;
21752178
21762179function StorageObject ( ) { }
0 commit comments