@@ -115,70 +115,86 @@ assert(!/Object/.test(
115115 util . inspect ( { a : { a : { a : { a : { } } } } } , undefined , null , true )
116116) ) ;
117117
118- for ( const showHidden of [ true , false ] ) {
119- const ab = new ArrayBuffer ( 4 ) ;
118+ {
119+ const showHidden = true ;
120+ const ab = new Uint8Array ( [ 1 , 2 , 3 , 4 ] ) . buffer ;
120121 const dv = new DataView ( ab , 1 , 2 ) ;
121122 assert . strictEqual (
122123 util . inspect ( ab , showHidden ) ,
123- 'ArrayBuffer { byteLength: 4 }'
124+ 'ArrayBuffer { [Uint8Contents]: <01 02 03 04>, byteLength: 4 }'
124125 ) ;
125126 assert . strictEqual ( util . inspect ( new DataView ( ab , 1 , 2 ) , showHidden ) ,
126127 'DataView {\n' +
127128 ' byteLength: 2,\n' +
128129 ' byteOffset: 1,\n' +
129- ' buffer: ArrayBuffer { byteLength: 4 } }' ) ;
130+ ' buffer:\n' +
131+ ' ArrayBuffer { [Uint8Contents]: ' +
132+ '<01 02 03 04>, byteLength: 4 } }' ) ;
130133 assert . strictEqual (
131134 util . inspect ( ab , showHidden ) ,
132- 'ArrayBuffer { byteLength: 4 }'
135+ 'ArrayBuffer { [Uint8Contents]: <01 02 03 04>, byteLength: 4 }'
133136 ) ;
134137 assert . strictEqual ( util . inspect ( dv , showHidden ) ,
135138 'DataView {\n' +
136139 ' byteLength: 2,\n' +
137140 ' byteOffset: 1,\n' +
138- ' buffer: ArrayBuffer { byteLength: 4 } }' ) ;
141+ ' buffer:\n' +
142+ ' ArrayBuffer { [Uint8Contents]: ' +
143+ '<01 02 03 04>, byteLength: 4 } }' ) ;
139144 ab . x = 42 ;
140145 dv . y = 1337 ;
141146 assert . strictEqual ( util . inspect ( ab , showHidden ) ,
142- 'ArrayBuffer { byteLength: 4, x: 42 }' ) ;
147+ 'ArrayBuffer { [Uint8Contents]: <01 02 03 04>, ' +
148+ 'byteLength: 4, x: 42 }' ) ;
143149 assert . strictEqual ( util . inspect ( dv , showHidden ) ,
144150 'DataView {\n' +
145151 ' byteLength: 2,\n' +
146152 ' byteOffset: 1,\n' +
147- ' buffer: ArrayBuffer { byteLength: 4, x: 42 },\n' +
153+ ' buffer:\n' +
154+ ' ArrayBuffer { [Uint8Contents]: <01 02 03 04>, ' +
155+ 'byteLength: 4, x: 42 },\n' +
148156 ' y: 1337 }' ) ;
149157}
150158
151159// Now do the same checks but from a different context.
152- for ( const showHidden of [ true , false ] ) {
160+ {
161+ const showHidden = false ;
153162 const ab = vm . runInNewContext ( 'new ArrayBuffer(4)' ) ;
154163 const dv = vm . runInNewContext ( 'new DataView(ab, 1, 2)' , { ab } ) ;
155164 assert . strictEqual (
156165 util . inspect ( ab , showHidden ) ,
157- 'ArrayBuffer { byteLength: 4 }'
166+ 'ArrayBuffer { [Uint8Contents]: <00 00 00 00>, byteLength: 4 }'
158167 ) ;
159168 assert . strictEqual ( util . inspect ( new DataView ( ab , 1 , 2 ) , showHidden ) ,
160169 'DataView {\n' +
161170 ' byteLength: 2,\n' +
162171 ' byteOffset: 1,\n' +
163- ' buffer: ArrayBuffer { byteLength: 4 } }' ) ;
172+ ' buffer:\n' +
173+ ' ArrayBuffer { [Uint8Contents]: <00 00 00 00>, ' +
174+ 'byteLength: 4 } }' ) ;
164175 assert . strictEqual (
165176 util . inspect ( ab , showHidden ) ,
166- 'ArrayBuffer { byteLength: 4 }'
177+ 'ArrayBuffer { [Uint8Contents]: <00 00 00 00>, byteLength: 4 }'
167178 ) ;
168179 assert . strictEqual ( util . inspect ( dv , showHidden ) ,
169180 'DataView {\n' +
170181 ' byteLength: 2,\n' +
171182 ' byteOffset: 1,\n' +
172- ' buffer: ArrayBuffer { byteLength: 4 } }' ) ;
183+ ' buffer:\n' +
184+ ' ArrayBuffer { [Uint8Contents]: <00 00 00 00>, ' +
185+ 'byteLength: 4 } }' ) ;
173186 ab . x = 42 ;
174187 dv . y = 1337 ;
175188 assert . strictEqual ( util . inspect ( ab , showHidden ) ,
176- 'ArrayBuffer { byteLength: 4, x: 42 }' ) ;
189+ 'ArrayBuffer { [Uint8Contents]: <00 00 00 00>, ' +
190+ 'byteLength: 4, x: 42 }' ) ;
177191 assert . strictEqual ( util . inspect ( dv , showHidden ) ,
178192 'DataView {\n' +
179193 ' byteLength: 2,\n' +
180194 ' byteOffset: 1,\n' +
181- ' buffer: ArrayBuffer { byteLength: 4, x: 42 },\n' +
195+ ' buffer:\n' +
196+ ' ArrayBuffer { [Uint8Contents]: <00 00 00 00>,' +
197+ ' byteLength: 4, x: 42 },\n' +
182198 ' y: 1337 }' ) ;
183199}
184200
@@ -1639,13 +1655,14 @@ assert.strictEqual(util.inspect('"\'${a}'), "'\"\\'${a}'");
16391655 [ new Float64Array ( 2 ) , '[Float64Array: null prototype] [ 0, 0 ]' ] ,
16401656 [ new BigInt64Array ( 2 ) , '[BigInt64Array: null prototype] [ 0n, 0n ]' ] ,
16411657 [ new BigUint64Array ( 2 ) , '[BigUint64Array: null prototype] [ 0n, 0n ]' ] ,
1642- [ new ArrayBuffer ( 16 ) , '[ArrayBuffer: null prototype] ' +
1643- '{ byteLength: undefined }' ] ,
1658+ [ new ArrayBuffer ( 16 ) , '[ArrayBuffer: null prototype] {\n' +
1659+ ' [Uint8Contents]: <00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00>,\n' +
1660+ ' byteLength: undefined }' ] ,
16441661 [ new DataView ( new ArrayBuffer ( 16 ) ) ,
16451662 '[DataView: null prototype] {\n byteLength: undefined,\n ' +
1646- 'byteOffset: undefined,\n buffer: undefined }' ] ,
1663+ 'byteOffset: undefined,\n buffer: undefined }' ] ,
16471664 [ new SharedArrayBuffer ( 2 ) , '[SharedArrayBuffer: null prototype] ' +
1648- '{ byteLength: undefined }'] ,
1665+ '{ [Uint8Contents]: <00 00>, byteLength: undefined }'] ,
16491666 [ / f o o b a r / , '[RegExp: null prototype] /foobar/' ]
16501667] . forEach ( ( [ value , expected ] ) => {
16511668 assert . strictEqual (
0 commit comments