Skip to content

Commit 999f685

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 c77078f commit 999f685

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
@@ -988,9 +988,7 @@ assert.throws(() => Buffer.from('', 'buffer'), TypeError);
988988
// Regression test for #6111. Constructing a buffer from another buffer
989989
// should a) work, and b) not corrupt the source buffer.
990990
{
991-
let a = [0];
992-
for (let i = 0; i < 7; ++i) a = a.concat(a);
993-
a = a.map((_, i) => { return i; });
991+
const a = [...Array(128).keys()]; // [0, 1, 2, 3, ... 126, 127]
994992
const b = Buffer.from(a);
995993
const c = Buffer.from(b);
996994
assert.strictEqual(b.length, a.length);

0 commit comments

Comments
 (0)