Browse Source

test: simplify array initialization

PR-URL: https://github.com/nodejs/node/pull/10860
Reviewed-By: Italo A. Casas <me@italoacasas.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Gibson Fahnestock <gibfahn@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
v6
Rich Trott 8 years ago
committed by Italo A. Casas
parent
commit
44c6b6b22a
No known key found for this signature in database GPG Key ID: 9005F0A51D1636DA
  1. 4
      test/parallel/test-buffer-alloc.js

4
test/parallel/test-buffer-alloc.js

@ -986,9 +986,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);

Loading…
Cancel
Save