diff options
Diffstat (limited to 'test/bun.js/text-decoder.test.js')
-rw-r--r-- | test/bun.js/text-decoder.test.js | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/test/bun.js/text-decoder.test.js b/test/bun.js/text-decoder.test.js index f132fa7da..4459c2dd0 100644 --- a/test/bun.js/text-decoder.test.js +++ b/test/bun.js/text-decoder.test.js @@ -49,6 +49,30 @@ describe("TextDecoder", () => { gcTrace(true); }); + describe("typedArrays", () => { + var text = `ABC DEF GHI JKL MNO PQR STU VWX YZ ABC DEF GHI JKL MNO PQR STU V`; + var bytes = new TextEncoder().encode(text); + var decoder = new TextDecoder(); + for (let TypedArray of [ + Uint8Array, + Uint16Array, + Uint32Array, + Int8Array, + Int16Array, + Int32Array, + Float32Array, + Float64Array, + DataView, + BigInt64Array, + BigUint64Array, + ]) { + it(`should decode ${TypedArray.name}`, () => { + const decoded = decoder.decode(new TypedArray(bytes.buffer)); + expect(decoded).toBe(text); + }); + } + }); + it("should decode unicode text with multiple consecutive emoji", () => { const decoder = new TextDecoder(); const encoder = new TextEncoder(); |