Skip to content

Commit 4a19062

Browse files
JacksonTianevanlucas
authored andcommitted
test: replace [].join() with ''.repeat()
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]>
1 parent 4ce58bd commit 4a19062

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

‎test/parallel/test-child-process-send-utf8.js‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ const common = require('../common');
33
constassert=require('assert');
44
constfork=require('child_process').fork;
55

6-
constexpected=Array(1e5).join('ßßßß');
6+
constexpected='ßßßß'.repeat(1e5-1);
77
if(process.argv[2]==='child'){
88
process.send(expected);
99
}else{

‎test/parallel/test-stringbytes-external.js‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,9 @@ assert.strictEqual(b[1], 0);
2323
assert.strictEqual(ucs2_control,c);
2424

2525
// now create big strings
26-
constsize=1+(1<<20);
27-
write_str=Array(size).join(write_str);
28-
ucs2_control=Array(size).join(ucs2_control);
26+
constsize=1<<20;
27+
write_str=write_str.repeat(size);
28+
ucs2_control=ucs2_control.repeat(size);
2929

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

111111
// https://github.com/nodejs/node/issues/1024
112112
{
113-
consta=Array(1<<20).join('x');
113+
consta='x'.repeat(1<<20-1);
114114
constb=Buffer.from(a,'ucs2').toString('ucs2');
115115
constc=Buffer.from(b,'utf8').toString('utf8');
116116

0 commit comments

Comments
(0)