@@ -117,70 +117,86 @@ assert(!/Object/.test(
117117 util . inspect ( { a : { a : { a : { a : { } } } } } , undefined , null , true )
118118) ) ;
119119
120- for ( const showHidden of [ true , false ] ) {
121- const ab = new ArrayBuffer ( 4 ) ;
120+ {
121+ const showHidden = true ;
122+ const ab = new Uint8Array ( [ 1 , 2 , 3 , 4 ] ) . buffer ;
122123 const dv = new DataView ( ab , 1 , 2 ) ;
123124 assert . strictEqual (
124125 util . inspect ( ab , showHidden ) ,
125- 'ArrayBuffer { byteLength: 4 }'
126+ 'ArrayBuffer { [Uint8Contents]: <01 02 03 04>, byteLength: 4 }'
126127 ) ;
127128 assert . strictEqual ( util . inspect ( new DataView ( ab , 1 , 2 ) , showHidden ) ,
128129 'DataView {\n' +
129130 ' byteLength: 2,\n' +
130131 ' byteOffset: 1,\n' +
131- ' buffer: ArrayBuffer { byteLength: 4 } }' ) ;
132+ ' buffer:\n' +
133+ ' ArrayBuffer { [Uint8Contents]: ' +
134+ '<01 02 03 04>, byteLength: 4 } }' ) ;
132135 assert . strictEqual (
133136 util . inspect ( ab , showHidden ) ,
134- 'ArrayBuffer { byteLength: 4 }'
137+ 'ArrayBuffer { [Uint8Contents]: <01 02 03 04>, byteLength: 4 }'
135138 ) ;
136139 assert . strictEqual ( util . inspect ( dv , showHidden ) ,
137140 'DataView {\n' +
138141 ' byteLength: 2,\n' +
139142 ' byteOffset: 1,\n' +
140- ' buffer: ArrayBuffer { byteLength: 4 } }' ) ;
143+ ' buffer:\n' +
144+ ' ArrayBuffer { [Uint8Contents]: ' +
145+ '<01 02 03 04>, byteLength: 4 } }' ) ;
141146 ab . x = 42 ;
142147 dv . y = 1337 ;
143148 assert . strictEqual ( util . inspect ( ab , showHidden ) ,
144- 'ArrayBuffer { byteLength: 4, x: 42 }' ) ;
149+ 'ArrayBuffer { [Uint8Contents]: <01 02 03 04>, ' +
150+ 'byteLength: 4, x: 42 }' ) ;
145151 assert . strictEqual ( util . inspect ( dv , showHidden ) ,
146152 'DataView {\n' +
147153 ' byteLength: 2,\n' +
148154 ' byteOffset: 1,\n' +
149- ' buffer: ArrayBuffer { byteLength: 4, x: 42 },\n' +
155+ ' buffer:\n' +
156+ ' ArrayBuffer { [Uint8Contents]: <01 02 03 04>, ' +
157+ 'byteLength: 4, x: 42 },\n' +
150158 ' y: 1337 }' ) ;
151159}
152160
153161// Now do the same checks but from a different context.
154- for ( const showHidden of [ true , false ] ) {
162+ {
163+ const showHidden = false ;
155164 const ab = vm . runInNewContext ( 'new ArrayBuffer(4)' ) ;
156165 const dv = vm . runInNewContext ( 'new DataView(ab, 1, 2)' , { ab } ) ;
157166 assert . strictEqual (
158167 util . inspect ( ab , showHidden ) ,
159- 'ArrayBuffer { byteLength: 4 }'
168+ 'ArrayBuffer { [Uint8Contents]: <00 00 00 00>, byteLength: 4 }'
160169 ) ;
161170 assert . strictEqual ( util . inspect ( new DataView ( ab , 1 , 2 ) , showHidden ) ,
162171 'DataView {\n' +
163172 ' byteLength: 2,\n' +
164173 ' byteOffset: 1,\n' +
165- ' buffer: ArrayBuffer { byteLength: 4 } }' ) ;
174+ ' buffer:\n' +
175+ ' ArrayBuffer { [Uint8Contents]: <00 00 00 00>, ' +
176+ 'byteLength: 4 } }' ) ;
166177 assert . strictEqual (
167178 util . inspect ( ab , showHidden ) ,
168- 'ArrayBuffer { byteLength: 4 }'
179+ 'ArrayBuffer { [Uint8Contents]: <00 00 00 00>, byteLength: 4 }'
169180 ) ;
170181 assert . strictEqual ( util . inspect ( dv , showHidden ) ,
171182 'DataView {\n' +
172183 ' byteLength: 2,\n' +
173184 ' byteOffset: 1,\n' +
174- ' buffer: ArrayBuffer { byteLength: 4 } }' ) ;
185+ ' buffer:\n' +
186+ ' ArrayBuffer { [Uint8Contents]: <00 00 00 00>, ' +
187+ 'byteLength: 4 } }' ) ;
175188 ab . x = 42 ;
176189 dv . y = 1337 ;
177190 assert . strictEqual ( util . inspect ( ab , showHidden ) ,
178- 'ArrayBuffer { byteLength: 4, x: 42 }' ) ;
191+ 'ArrayBuffer { [Uint8Contents]: <00 00 00 00>, ' +
192+ 'byteLength: 4, x: 42 }' ) ;
179193 assert . strictEqual ( util . inspect ( dv , showHidden ) ,
180194 'DataView {\n' +
181195 ' byteLength: 2,\n' +
182196 ' byteOffset: 1,\n' +
183- ' buffer: ArrayBuffer { byteLength: 4, x: 42 },\n' +
197+ ' buffer:\n' +
198+ ' ArrayBuffer { [Uint8Contents]: <00 00 00 00>,' +
199+ ' byteLength: 4, x: 42 },\n' +
184200 ' y: 1337 }' ) ;
185201}
186202
@@ -1640,13 +1656,14 @@ assert.strictEqual(util.inspect('"\'${a}'), "'\"\\'${a}'");
16401656 [ new Float64Array ( 2 ) , '[Float64Array: null prototype] [ 0, 0 ]' ] ,
16411657 [ new BigInt64Array ( 2 ) , '[BigInt64Array: null prototype] [ 0n, 0n ]' ] ,
16421658 [ new BigUint64Array ( 2 ) , '[BigUint64Array: null prototype] [ 0n, 0n ]' ] ,
1643- [ new ArrayBuffer ( 16 ) , '[ArrayBuffer: null prototype] ' +
1644- '{ byteLength: undefined }' ] ,
1659+ [ new ArrayBuffer ( 16 ) , '[ArrayBuffer: null prototype] {\n' +
1660+ ' [Uint8Contents]: <00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00>,\n' +
1661+ ' byteLength: undefined }' ] ,
16451662 [ new DataView ( new ArrayBuffer ( 16 ) ) ,
16461663 '[DataView: null prototype] {\n byteLength: undefined,\n ' +
1647- 'byteOffset: undefined,\n buffer: undefined }' ] ,
1664+ 'byteOffset: undefined,\n buffer: undefined }' ] ,
16481665 [ new SharedArrayBuffer ( 2 ) , '[SharedArrayBuffer: null prototype] ' +
1649- '{ byteLength: undefined }'] ,
1666+ '{ [Uint8Contents]: <00 00>, byteLength: undefined }'] ,
16501667 [ / f o o b a r / , '[RegExp: null prototype] /foobar/' ]
16511668] . forEach ( ( [ value , expected ] ) => {
16521669 assert . strictEqual (
0 commit comments