From 999f685a69c66856461f2576214bd62fd43e354a Mon Sep 17 00:00:00 2001 From: Rich Trott Date: Tue, 17 Jan 2017 14:22:49 -0800 Subject: [PATCH] test: simplify array initialization PR-URL: https://github.com/nodejs/node/pull/10860 Reviewed-By: Italo A. Casas Reviewed-By: James M Snell Reviewed-By: Gibson Fahnestock Reviewed-By: Luigi Pinca --- test/parallel/test-buffer-alloc.js | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/test/parallel/test-buffer-alloc.js b/test/parallel/test-buffer-alloc.js index 2245c9843a5edd..1426bd80ebc4ab 100644 --- a/test/parallel/test-buffer-alloc.js +++ b/test/parallel/test-buffer-alloc.js @@ -988,9 +988,7 @@ assert.throws(() => Buffer.from('', 'buffer'), TypeError); // Regression test for #6111. Constructing a buffer from another buffer // should a) work, and b) not corrupt the source buffer. { - let a = [0]; - for (let i = 0; i < 7; ++i) a = a.concat(a); - a = a.map((_, i) => { return i; }); + const a = [...Array(128).keys()]; // [0, 1, 2, 3, ... 126, 127] const b = Buffer.from(a); const c = Buffer.from(b); assert.strictEqual(b.length, a.length);