@@ -115,70 +115,86 @@ assert(!/Object/.test(
115
115
util . inspect ( { a : { a : { a : { a : { } } } } } , undefined , null , true )
116
116
) ) ;
117
117
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 ;
120
121
const dv = new DataView ( ab , 1 , 2 ) ;
121
122
assert . strictEqual (
122
123
util . inspect ( ab , showHidden ) ,
123
- 'ArrayBuffer { byteLength: 4 }'
124
+ 'ArrayBuffer { [Uint8Contents]: <01 02 03 04>, byteLength: 4 }'
124
125
) ;
125
126
assert . strictEqual ( util . inspect ( new DataView ( ab , 1 , 2 ) , showHidden ) ,
126
127
'DataView {\n' +
127
128
' byteLength: 2,\n' +
128
129
' byteOffset: 1,\n' +
129
- ' buffer: ArrayBuffer { byteLength: 4 } }' ) ;
130
+ ' buffer:\n' +
131
+ ' ArrayBuffer { [Uint8Contents]: ' +
132
+ '<01 02 03 04>, byteLength: 4 } }' ) ;
130
133
assert . strictEqual (
131
134
util . inspect ( ab , showHidden ) ,
132
- 'ArrayBuffer { byteLength: 4 }'
135
+ 'ArrayBuffer { [Uint8Contents]: <01 02 03 04>, byteLength: 4 }'
133
136
) ;
134
137
assert . strictEqual ( util . inspect ( dv , showHidden ) ,
135
138
'DataView {\n' +
136
139
' byteLength: 2,\n' +
137
140
' byteOffset: 1,\n' +
138
- ' buffer: ArrayBuffer { byteLength: 4 } }' ) ;
141
+ ' buffer:\n' +
142
+ ' ArrayBuffer { [Uint8Contents]: ' +
143
+ '<01 02 03 04>, byteLength: 4 } }' ) ;
139
144
ab . x = 42 ;
140
145
dv . y = 1337 ;
141
146
assert . strictEqual ( util . inspect ( ab , showHidden ) ,
142
- 'ArrayBuffer { byteLength: 4, x: 42 }' ) ;
147
+ 'ArrayBuffer { [Uint8Contents]: <01 02 03 04>, ' +
148
+ 'byteLength: 4, x: 42 }' ) ;
143
149
assert . strictEqual ( util . inspect ( dv , showHidden ) ,
144
150
'DataView {\n' +
145
151
' byteLength: 2,\n' +
146
152
' 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' +
148
156
' y: 1337 }' ) ;
149
157
}
150
158
151
159
// Now do the same checks but from a different context.
152
- for ( const showHidden of [ true , false ] ) {
160
+ {
161
+ const showHidden = false ;
153
162
const ab = vm . runInNewContext ( 'new ArrayBuffer(4)' ) ;
154
163
const dv = vm . runInNewContext ( 'new DataView(ab, 1, 2)' , { ab } ) ;
155
164
assert . strictEqual (
156
165
util . inspect ( ab , showHidden ) ,
157
- 'ArrayBuffer { byteLength: 4 }'
166
+ 'ArrayBuffer { [Uint8Contents]: <00 00 00 00>, byteLength: 4 }'
158
167
) ;
159
168
assert . strictEqual ( util . inspect ( new DataView ( ab , 1 , 2 ) , showHidden ) ,
160
169
'DataView {\n' +
161
170
' byteLength: 2,\n' +
162
171
' byteOffset: 1,\n' +
163
- ' buffer: ArrayBuffer { byteLength: 4 } }' ) ;
172
+ ' buffer:\n' +
173
+ ' ArrayBuffer { [Uint8Contents]: <00 00 00 00>, ' +
174
+ 'byteLength: 4 } }' ) ;
164
175
assert . strictEqual (
165
176
util . inspect ( ab , showHidden ) ,
166
- 'ArrayBuffer { byteLength: 4 }'
177
+ 'ArrayBuffer { [Uint8Contents]: <00 00 00 00>, byteLength: 4 }'
167
178
) ;
168
179
assert . strictEqual ( util . inspect ( dv , showHidden ) ,
169
180
'DataView {\n' +
170
181
' byteLength: 2,\n' +
171
182
' byteOffset: 1,\n' +
172
- ' buffer: ArrayBuffer { byteLength: 4 } }' ) ;
183
+ ' buffer:\n' +
184
+ ' ArrayBuffer { [Uint8Contents]: <00 00 00 00>, ' +
185
+ 'byteLength: 4 } }' ) ;
173
186
ab . x = 42 ;
174
187
dv . y = 1337 ;
175
188
assert . strictEqual ( util . inspect ( ab , showHidden ) ,
176
- 'ArrayBuffer { byteLength: 4, x: 42 }' ) ;
189
+ 'ArrayBuffer { [Uint8Contents]: <00 00 00 00>, ' +
190
+ 'byteLength: 4, x: 42 }' ) ;
177
191
assert . strictEqual ( util . inspect ( dv , showHidden ) ,
178
192
'DataView {\n' +
179
193
' byteLength: 2,\n' +
180
194
' 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' +
182
198
' y: 1337 }' ) ;
183
199
}
184
200
@@ -1639,13 +1655,14 @@ assert.strictEqual(util.inspect('"\'${a}'), "'\"\\'${a}'");
1639
1655
[ new Float64Array ( 2 ) , '[Float64Array: null prototype] [ 0, 0 ]' ] ,
1640
1656
[ new BigInt64Array ( 2 ) , '[BigInt64Array: null prototype] [ 0n, 0n ]' ] ,
1641
1657
[ 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 }' ] ,
1644
1661
[ new DataView ( new ArrayBuffer ( 16 ) ) ,
1645
1662
'[DataView: null prototype] {\n byteLength: undefined,\n ' +
1646
- 'byteOffset: undefined,\n buffer: undefined }' ] ,
1663
+ 'byteOffset: undefined,\n buffer: undefined }' ] ,
1647
1664
[ new SharedArrayBuffer ( 2 ) , '[SharedArrayBuffer: null prototype] ' +
1648
- '{ byteLength: undefined }'] ,
1665
+ '{ [Uint8Contents]: <00 00>, byteLength: undefined }'] ,
1649
1666
[ / f o o b a r / , '[RegExp: null prototype] /foobar/' ]
1650
1667
] . forEach ( ( [ value , expected ] ) => {
1651
1668
assert . strictEqual (
0 commit comments