test: remove apply calls over 65534 arg limit · nodejs/node@78c8491 (original) (raw)
2 files changed
lines changed
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -214,8 +214,9 @@ assert(asciiString.includes('leb', 0)); | ||
214 | 214 | |
215 | 215 | // Search in string containing many non-ASCII chars. |
216 | 216 | const allCodePoints = []; |
217 | -for (let i = 0; i < 65536; i++) allCodePoints[i] = i; | |
218 | -const allCharsString = String.fromCharCode.apply(String, allCodePoints); | |
217 | +for (let i = 0; i < 65534; i++) allCodePoints[i] = i; | |
218 | +const allCharsString = String.fromCharCode.apply(String, allCodePoints) + | |
219 | +String.fromCharCode(65534, 65535); | |
219 | 220 | const allCharsBufferUtf8 = Buffer.from(allCharsString); |
220 | 221 | const allCharsBufferUcs2 = Buffer.from(allCharsString, 'ucs2'); |
221 | 222 |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -276,8 +276,9 @@ assert.strictEqual(asciiString.indexOf('leb', 0), 3); | ||
276 | 276 | |
277 | 277 | // Search in string containing many non-ASCII chars. |
278 | 278 | const allCodePoints = []; |
279 | -for (let i = 0; i < 65536; i++) allCodePoints[i] = i; | |
280 | -const allCharsString = String.fromCharCode.apply(String, allCodePoints); | |
279 | +for (let i = 0; i < 65534; i++) allCodePoints[i] = i; | |
280 | +const allCharsString = String.fromCharCode.apply(String, allCodePoints) + | |
281 | +String.fromCharCode(65534, 65535); | |
281 | 282 | const allCharsBufferUtf8 = Buffer.from(allCharsString); |
282 | 283 | const allCharsBufferUcs2 = Buffer.from(allCharsString, 'ucs2'); |
283 | 284 |