1
0
Fork 0
mirror of https://github.com/denoland/deno.git synced 2024-11-04 08:54:20 -05:00
denoland-deno/cli/tests/051_wasm_import.ts
Kevin (Kun) "Kassimo" Qian 4189cc1ab5 Loader: support .wasm imports (#3328)
* loader: support .wasm imports

* http_server: true

* Support named exports

* Clippy
2019-11-14 08:31:39 -05:00

22 lines
659 B
TypeScript

import { add, addImported, addRemote } from "./051_wasm_import/simple.wasm";
import { state } from "./051_wasm_import/wasm-dep.js";
function assertEquals(actual: unknown, expected: unknown, msg?: string): void {
if (actual !== expected) {
throw new Error(msg);
}
}
assertEquals(state, "WASM Start Executed", "Incorrect state");
assertEquals(add(10, 20), 30, "Incorrect add");
assertEquals(addImported(0), 42, "Incorrect addImported");
assertEquals(state, "WASM JS Function Executed", "Incorrect state");
assertEquals(addImported(1), 43, "Incorrect addImported");
assertEquals(addRemote(1), 2020, "Incorrect addRemote");
console.log("Passed");