-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex (2).html
57 lines (51 loc) · 1.35 KB
/
index (2).html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
<p>Check DevTools for more info</p>
<pre id="pre"></pre>
<script type="module">
const tests = [];
const test = (name, fn) => tests.push({ name, fn });
setTimeout(async () => {
for (const { name, fn } of tests) {
try {
await fn();
console.log(`%c✔ ${name}`, "color: green");
pre.append(`✔ ${name}\n`);
} catch (error) {
console.log(`%c✘ ${name}`, "color: red");
pre.append(`✘ ${name}\n`);
console.error(error);
pre.append(`${error}\n`);
}
}
}, 100);
import assert from "node:assert";
import * as hello_world_rust_wasm_component_lib from "./dist/hello_world_rust_wasm_component_lib.js";
import {
greet,
greetMany,
run,
getReport,
computeArea,
} from "./dist/hello_world_rust_wasm_component_lib.js";
console.log(hello_world_rust_wasm_component_lib);
test("greet() works", () => {
console.log(greet("Alan Turing"));
});
test("greetMany() works", () => {
console.log(greetMany(["Alan Turing", "Ada Lovelace"]));
});
test("run() works", () => {
run();
});
test("getReport() works", () => {
console.log(getReport());
});
test("computeArea() works", () => {
console.log(
computeArea({
center: { x: 0, y: 0 },
radius: 6,
})
);
console.log("from JS", Math.PI * 6 * 6);
});
</script>