summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorJackson Tian <shyvo1987@gmail.com>2017-04-10 23:24:47 +0800
committerBenjamin Gruenbaum <benji@tipranks.com>2017-04-16 03:08:11 +0300
commit4a782e12a80bfd8dc2b96b7bf261469971c81682 (patch)
tree5d45bb1418a51acd4d0c0156b8e8b338e9f59009 /test
parentddcd93aaeb1485b2b7ddd35f8e96dba1cc372cea (diff)
downloadandroid-node-v8-4a782e12a80bfd8dc2b96b7bf261469971c81682.tar.gz
android-node-v8-4a782e12a80bfd8dc2b96b7bf261469971c81682.tar.bz2
android-node-v8-4a782e12a80bfd8dc2b96b7bf261469971c81682.zip
test: replace [].join() with ''.repeat()
Replace [].join calls with the more modern .repeat PR-URL: https://github.com/nodejs/node/pull/12305 Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com> Reviewed-By: Gibson Fahnestock <gibfahn@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Daijiro Wachi <daijiro.wachi@gmail.com> Reviewed-By: Alexey Orlenko <eaglexrlnk@gmail.com> Reviewed-By: Vse Mozhet Byt <vsemozhetbyt@gmail.com> Reviewed-By: Yuta Hiroto <hello@about-hiroppy.com>
Diffstat (limited to 'test')
-rw-r--r--test/parallel/test-child-process-send-utf8.js2
-rw-r--r--test/parallel/test-stringbytes-external.js8
2 files changed, 5 insertions, 5 deletions
diff --git a/test/parallel/test-child-process-send-utf8.js b/test/parallel/test-child-process-send-utf8.js
index f49712a677..2609dd0d6d 100644
--- a/test/parallel/test-child-process-send-utf8.js
+++ b/test/parallel/test-child-process-send-utf8.js
@@ -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 {
diff --git a/test/parallel/test-stringbytes-external.js b/test/parallel/test-stringbytes-external.js
index 937c0818e6..35d773da26 100644
--- a/test/parallel/test-stringbytes-external.js
+++ b/test/parallel/test-stringbytes-external.js
@@ -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');
@@ -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');