aboutsummaryrefslogtreecommitdiff
path: root/test/bun.js/text-decoder.test.js
diff options
context:
space:
mode:
authorGravatar Jarred Sumner <jarred@jarredsumner.com> 2022-08-27 23:46:05 -0700
committerGravatar GitHub <noreply@github.com> 2022-08-27 23:46:05 -0700
commitaf5c4dedca550a856486ec8bbc9f6da76396496e (patch)
tree618a42aed0eb46e9a726fc58731358b3bb7cbc27 /test/bun.js/text-decoder.test.js
parent8b3afa5831b7ac5fcabb47138c67d60e86247cd3 (diff)
downloadbun-af5c4dedca550a856486ec8bbc9f6da76396496e.tar.gz
bun-af5c4dedca550a856486ec8bbc9f6da76396496e.tar.zst
bun-af5c4dedca550a856486ec8bbc9f6da76396496e.zip
Update WebKit (#1165)
* Update WebKit * Fix `DataView` and non-8 bit sized typed arrays with TextDecoder * New WebKit Co-authored-by: Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com>
Diffstat (limited to 'test/bun.js/text-decoder.test.js')
-rw-r--r--test/bun.js/text-decoder.test.js24
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();