1
0
Fork 0
mirror of https://github.com/denoland/deno.git synced 2024-11-27 16:10:57 -05:00

chore(check): add test for Wasm memory and table (#26996)

This commit is contained in:
David Sherret 2024-11-22 10:59:19 -05:00 committed by GitHub
parent 5ca47ee97a
commit 9c0e6369b2
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 29 additions and 3 deletions

View file

@ -1,4 +1,13 @@
{ {
"args": "run --check main.js", "tests": {
"output": "main.out" "run": {
"args": "run main.js",
"output": "main.out"
},
"check": {
"args": "check check.ts",
"output": "check.out",
"exitCode": 1
}
}
} }

View file

@ -0,0 +1,14 @@
Check file:///[WILDLINE]/check.ts
error: TS2322 [ERROR]: Type 'Function | null' is not assignable to type 'number'.
Type 'null' is not assignable to type 'number'.
const value1: number = table.get(0);
~~~~~~
at file:///[WILDLINE]/check.ts:2:7
TS2322 [ERROR]: Type 'ArrayBuffer | SharedArrayBuffer' is not assignable to type 'number'.
Type 'ArrayBuffer' is not assignable to type 'number'.
const value2: number = memory.buffer;
~~~~~~
at file:///[WILDLINE]/check.ts:3:7
Found 2 errors.

View file

@ -0,0 +1,4 @@
import { memory, table } from "./mod.wasm";
const value1: number = table.get(0);
const value2: number = memory.buffer;
console.log(value1, value2);

View file

@ -1,4 +1,3 @@
Check [WILDCARD]
[Module: null prototype] { [Module: null prototype] {
func: [Function: 0], func: [Function: 0],
global: Global [WebAssembly.Global] {}, global: Global [WebAssembly.Global] {},