From 2bb303008b78cfe5a657c690cfe2a27ed1f7a78f Mon Sep 17 00:00:00 2001 From: Sam Thorogood Date: Fri, 6 Mar 2020 15:38:57 +1100 Subject: [PATCH] add large string test --- suite.js | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/suite.js b/suite.js index e2a8b34..95d45db 100644 --- a/suite.js +++ b/suite.js @@ -4,6 +4,21 @@ function tests(isNative, TextEncoder, TextDecoder) { suite(isNative ? 'native' : 'polyfill', () => { + test('really large string', () => { + const chunks = new Array(64); + for (let i = 0; i < chunks.length; ++i) { + const s = new Array(65535).fill('x'.charCodeAt(0)); + chunks[i] = s; + } + const s = chunks.join(''); + + const buffer = enc.encode(s); + const out = dec.decode(buffer); + + assert.equal(out, s); + + }); + suite('decoder', () => { test('basic', () => {