diff options
author | Rich Trott <rtrott@gmail.com> | 2017-01-17 14:22:49 -0800 |
---|---|---|
committer | Italo A. Casas <me@italoacasas.com> | 2017-01-19 11:10:45 -0800 |
commit | 44c6b6b22a6ea92b3307bfcfab933b75b9b70639 (patch) | |
tree | cafcd10408f8b7f13d9d9047364cf7599aab2fcf /test/parallel/test-buffer-alloc.js | |
parent | 295bd11468c99434ce8d8ca77af5b076bca7feb0 (diff) | |
download | android-node-v8-44c6b6b22a6ea92b3307bfcfab933b75b9b70639.tar.gz android-node-v8-44c6b6b22a6ea92b3307bfcfab933b75b9b70639.tar.bz2 android-node-v8-44c6b6b22a6ea92b3307bfcfab933b75b9b70639.zip |
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>
Diffstat (limited to 'test/parallel/test-buffer-alloc.js')
-rw-r--r-- | test/parallel/test-buffer-alloc.js | 4 |
1 files changed, 1 insertions, 3 deletions
diff --git a/test/parallel/test-buffer-alloc.js b/test/parallel/test-buffer-alloc.js index f769db0862..3486bb90a6 100644 --- a/test/parallel/test-buffer-alloc.js +++ b/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); |