summaryrefslogtreecommitdiff
path: root/cli/tests/workers/test.ts
diff options
context:
space:
mode:
Diffstat (limited to 'cli/tests/workers/test.ts')
-rw-r--r--cli/tests/workers/test.ts28
1 files changed, 28 insertions, 0 deletions
diff --git a/cli/tests/workers/test.ts b/cli/tests/workers/test.ts
index b37b7aeb1..d35dbec82 100644
--- a/cli/tests/workers/test.ts
+++ b/cli/tests/workers/test.ts
@@ -790,6 +790,34 @@ Deno.test({
});
Deno.test({
+ name: "worker SharedArrayBuffer",
+ fn: async function (): Promise<void> {
+ const promise = deferred();
+ const workerOptions: WorkerOptions = { type: "module" };
+ const w = new Worker(
+ new URL("shared_array_buffer.ts", import.meta.url).href,
+ workerOptions,
+ );
+ const sab1 = new SharedArrayBuffer(1);
+ const sab2 = new SharedArrayBuffer(1);
+ const bytes1 = new Uint8Array(sab1);
+ const bytes2 = new Uint8Array(sab2);
+ assertEquals(bytes1[0], 0);
+ assertEquals(bytes2[0], 0);
+ w.onmessage = (): void => {
+ w.postMessage([sab1, sab2]);
+ w.onmessage = (): void => {
+ assertEquals(bytes1[0], 1);
+ assertEquals(bytes2[0], 2);
+ promise.resolve();
+ };
+ };
+ await promise;
+ w.terminate();
+ },
+});
+
+Deno.test({
name: "Send MessagePorts from / to workers",
fn: async function (): Promise<void> {
const result = deferred();