Skip to content

Commit 1030cae

Browse files
dsherretbartlomieju
authored andcommitted
chore(check): add test for Wasm memory and table (#26996)
1 parent 9236786 commit 1030cae

File tree

4 files changed

+29
-3
lines changed

4 files changed

+29
-3
lines changed
Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,13 @@
11
{
2-
"args": "run --check main.js",
3-
"output": "main.out"
2+
"tests": {
3+
"run": {
4+
"args": "run main.js",
5+
"output": "main.out"
6+
},
7+
"check": {
8+
"args": "check check.ts",
9+
"output": "check.out",
10+
"exitCode": 1
11+
}
12+
}
413
}
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
Check file:///[WILDLINE]/check.ts
2+
error: TS2322 [ERROR]: Type 'Function | null' is not assignable to type 'number'.
3+
Type 'null' is not assignable to type 'number'.
4+
const value1: number = table.get(0);
5+
~~~~~~
6+
at file:///[WILDLINE]/check.ts:2:7
7+
8+
TS2322 [ERROR]: Type 'ArrayBuffer | SharedArrayBuffer' is not assignable to type 'number'.
9+
Type 'ArrayBuffer' is not assignable to type 'number'.
10+
const value2: number = memory.buffer;
11+
~~~~~~
12+
at file:///[WILDLINE]/check.ts:3:7
13+
14+
Found 2 errors.
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
import { memory, table } from "./mod.wasm";
2+
const value1: number = table.get(0);
3+
const value2: number = memory.buffer;
4+
console.log(value1, value2);

tests/specs/run/wasm_module/table_global_memory/main.out

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
Check [WILDCARD]
21
[Module: null prototype] {
32
func: [Function: 0],
43
global: Global [WebAssembly.Global] {},

0 commit comments

Comments
 (0)