Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 999f685

Browse filesBrowse files
TrottItalo A. Casas
authored andcommitted
test: simplify array initialization
PR-URL: #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>
1 parent c77078f commit 999f685
Copy full SHA for 999f685

File tree

Expand file treeCollapse file tree

1 file changed

+1
-3
lines changed
Open diff view settings
Filter options
Expand file treeCollapse file tree

1 file changed

+1
-3
lines changed
Open diff view settings
Collapse file

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

Copy file name to clipboardExpand all lines: test/parallel/test-buffer-alloc.js
+1-3Lines changed: 1 addition & 3 deletions
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 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.