mirror of
https://github.com/nodejs/node.git
synced 2024-11-21 10:59:27 +00:00
test: avoid apply()
calls with large amount of elements
PR-URL: https://github.com/nodejs/node/pull/55501 Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com> Reviewed-By: Chemi Atlow <chemi@atlow.co.il>
This commit is contained in:
parent
f0e5b6a34a
commit
5e27e595fb
@ -213,10 +213,7 @@ assert(!asciiString.includes('\x2061'));
|
||||
assert(asciiString.includes('leb', 0));
|
||||
|
||||
// Search in string containing many non-ASCII chars.
|
||||
const allCodePoints = [];
|
||||
for (let i = 0; i < 65534; i++) allCodePoints[i] = i;
|
||||
const allCharsString = String.fromCharCode.apply(String, allCodePoints) +
|
||||
String.fromCharCode(65534, 65535);
|
||||
const allCharsString = Array.from({ length: 65536 }, (_, i) => String.fromCharCode(i)).join('');
|
||||
const allCharsBufferUtf8 = Buffer.from(allCharsString);
|
||||
const allCharsBufferUcs2 = Buffer.from(allCharsString, 'ucs2');
|
||||
|
||||
|
@ -285,10 +285,7 @@ assert.strictEqual(-1, asciiString.indexOf('\x2061'));
|
||||
assert.strictEqual(asciiString.indexOf('leb', 0), 3);
|
||||
|
||||
// Search in string containing many non-ASCII chars.
|
||||
const allCodePoints = [];
|
||||
for (let i = 0; i < 65534; i++) allCodePoints[i] = i;
|
||||
const allCharsString = String.fromCharCode.apply(String, allCodePoints) +
|
||||
String.fromCharCode(65534, 65535);
|
||||
const allCharsString = Array.from({ length: 65536 }, (_, i) => String.fromCharCode(i)).join('');
|
||||
const allCharsBufferUtf8 = Buffer.from(allCharsString);
|
||||
const allCharsBufferUcs2 = Buffer.from(allCharsString, 'ucs2');
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user