Skip to content

Commit 44c6b6b

Browse files
Trottitaloacasas
authored andcommitted
test: simplify array initialization
PR-URL: #10860 Reviewed-By: Italo A. Casas <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Gibson Fahnestock <[email protected]> Reviewed-By: Luigi Pinca <[email protected]>
1 parent 295bd11 commit 44c6b6b

File tree

1 file changed

+1
-3
lines changed

1 file changed

+1
-3
lines changed

test/parallel/test-buffer-alloc.js

+1-3
Original file line numberDiff line numberDiff line change
@@ -986,9 +986,7 @@ assert.throws(() => Buffer.from('', 'buffer'), TypeError);
986986
// Regression test for #6111. Constructing a buffer from another buffer
987987
// should a) work, and b) not corrupt the source buffer.
988988
{
989-
let a = [0];
990-
for (let i = 0; i < 7; ++i) a = a.concat(a);
991-
a = a.map((_, i) => { return i; });
989+
const a = [...Array(128).keys()]; // [0, 1, 2, 3, ... 126, 127]
992990
const b = Buffer.from(a);
993991
const c = Buffer.from(b);
994992
assert.strictEqual(b.length, a.length);

0 commit comments

Comments
 (0)