Skip to content

Commit

Permalink
test: replace [].join() with ''.repeat()
Browse files Browse the repository at this point in the history
Replace [].join calls with the more modern .repeat

PR-URL: #12305
Reviewed-By: Benjamin Gruenbaum <[email protected]>
Reviewed-By: Gibson Fahnestock <[email protected]>
Reviewed-By: James M Snell <[email protected]>
Reviewed-By: Luigi Pinca <[email protected]>
Reviewed-By: Daijiro Wachi <[email protected]>
Reviewed-By: Alexey Orlenko <[email protected]>
Reviewed-By: Vse Mozhet Byt <[email protected]>
Reviewed-By: Yuta Hiroto <[email protected]>
  • Loading branch information
JacksonTian authored and Benjamin Gruenbaum committed Apr 16, 2017
1 parent ddcd93a commit 4a782e1
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion test/parallel/test-child-process-send-utf8.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ const common = require('../common');
const assert = require('assert');
const fork = require('child_process').fork;

const expected = Array(1e5).join('ßßßß');
const expected = 'ßßßß'.repeat(1e5 - 1);
if (process.argv[2] === 'child') {
process.send(expected);
} else {
Expand Down
8 changes: 4 additions & 4 deletions test/parallel/test-stringbytes-external.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,9 @@ assert.strictEqual(b[1], 0);
assert.strictEqual(ucs2_control, c);

// now create big strings
const size = 1 + (1 << 20);
write_str = Array(size).join(write_str);
ucs2_control = Array(size).join(ucs2_control);
const size = 1 << 20;
write_str = write_str.repeat(size);
ucs2_control = ucs2_control.repeat(size);

// check resultant buffer and output string
b = Buffer.from(write_str, 'ucs2');
Expand Down Expand Up @@ -131,7 +131,7 @@ const PRE_3OF4_APEX = Math.ceil((EXTERN_APEX / 4) * 3) - RADIOS;

// https://github.com/nodejs/node/issues/1024
{
const a = Array(1 << 20).join('x');
const a = 'x'.repeat(1 << 20 - 1);
const b = Buffer.from(a, 'ucs2').toString('ucs2');
const c = Buffer.from(b, 'utf8').toString('utf8');

Expand Down

0 comments on commit 4a782e1

Please sign in to comment.