From: Ben Noordhuis Date: Tue, 3 Mar 2015 15:07:26 +0000 (+0100) Subject: test: simplify parallel/test-stringbytes-external X-Git-Tag: v1.5.0~11 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=e2fb733a951a51821c03cf83400607522da52e44;p=platform%2Fupstream%2Fnodejs.git test: simplify parallel/test-stringbytes-external Make the algorithm that creates the big input strings a little easier to comprehend. No functional changes, the string lengths are unchanged. PR-URL: https://github.com/iojs/io.js/pull/1042 Reviewed-By: Trevor Norris --- diff --git a/test/parallel/test-stringbytes-external.js b/test/parallel/test-stringbytes-external.js index 3318972..e4e3f36 100644 --- a/test/parallel/test-stringbytes-external.js +++ b/test/parallel/test-stringbytes-external.js @@ -15,15 +15,10 @@ assert.equal(b[0], 0x61); assert.equal(b[1], 0); assert.equal(ucs2_control, c); - -// grow the strings to proper length -while (write_str.length <= EXTERN_APEX) { - write_str += write_str; - ucs2_control += ucs2_control; -} -write_str += write_str.substr(0, EXTERN_APEX - write_str.length); -ucs2_control += ucs2_control.substr(0, EXTERN_APEX * 2 - ucs2_control.length); - +// now create big strings +var size = 1 + (1 << 20); +write_str = Array(size).join(write_str); +ucs2_control = Array(size).join(ucs2_control); // check resultant buffer and output string var b = new Buffer(write_str, 'ucs2');