Skip to content

Commit

Permalink
add large string test
Browse files Browse the repository at this point in the history
  • Loading branch information
samthor committed Mar 6, 2020
1 parent 151f09f commit 2bb3030
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions suite.js
Original file line number Diff line number Diff line change
Expand Up @@ -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', () => {
Expand Down

0 comments on commit 2bb3030

Please sign in to comment.