test: update WPT for wasm/jsapi to 288c467d35 · nodejs/node@8cbd901 · GitHub
Skip to content

Commit 8cbd901

Browse files
nodejs-github-botaduh95
authored andcommitted
test: update WPT for wasm/jsapi to 288c467d35
PR-URL: #63136 Reviewed-By: Filip Skokan <panva.ip@gmail.com> Reviewed-By: Mattias Buelens <mattias@buelens.com> Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
1 parent ba36ab7 commit 8cbd901

8 files changed

Lines changed: 57 additions & 4 deletions

File tree

test/fixtures/wpt/README.md

Lines changed: 1 addition & 1 deletion

test/fixtures/wpt/versions.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@
8484
"path": "user-timing"
8585
},
8686
"wasm/jsapi": {
87-
"commit": "cde25e7e3c3b9d2280eb088a3fb9da988793d255",
87+
"commit": "288c467d350ec4b8e4fbc7f2ccb6119293186611",
8888
"path": "wasm/jsapi"
8989
},
9090
"wasm/webapi": {
Binary file not shown.
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
(module
2+
(import "wasm:js/string-constants" "" (global $empty externref))
3+
(import "wasm:js/string-constants" "\00" (global $null_byte externref))
4+
(import "wasm:js/string-constants" "hello" (global $hello externref))
5+
(import "wasm:js/string-constants" "\f0\9f\98\80" (global $emoji externref))
6+
7+
(export "empty" (global $empty))
8+
(export "nullByte" (global $null_byte))
9+
(export "hello" (global $hello))
10+
(export "emoji" (global $emoji))
11+
)
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
// META: global=window,dedicatedworker,jsshell,shadowrealm
2+
3+
promise_test(async () => {
4+
const wasmModuleSource = await import.source("./resources/js-string-constants.wasm");
5+
6+
const instance = new WebAssembly.Instance(wasmModuleSource, {});
7+
8+
assert_equals(instance.exports.empty.value, "");
9+
assert_equals(instance.exports.nullByte.value, "\0");
10+
assert_equals(instance.exports.hello.value, "hello");
11+
assert_equals(instance.exports.emoji.value, "\u{1F600}");
12+
}, "String constants from wasm:js/string-constants should be supported in source phase imports");
13+
14+
promise_test(async () => {
15+
const wasmModuleSource = await import.source("./resources/js-string-constants.wasm");
16+
17+
const exports = WebAssembly.Module.exports(wasmModuleSource);
18+
const exportNames = exports.map((exp) => exp.name);
19+
20+
assert_true(exportNames.includes("empty"));
21+
assert_true(exportNames.includes("nullByte"));
22+
assert_true(exportNames.includes("hello"));
23+
assert_true(exportNames.includes("emoji"));
24+
}, "Source phase import should properly expose string constants exports");
25+
26+
promise_test(async () => {
27+
const wasmModuleSource = await import.source("./resources/js-string-constants.wasm");
28+
29+
const imports = WebAssembly.Module.imports(wasmModuleSource);
30+
31+
assert_equals(imports.length, 0);
32+
}, "Source phase import should handle string constants import reflection correctly");
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
// META: global=window,dedicatedworker,jsshell,shadowrealm
2+
3+
promise_test(async () => {
4+
const wasmModule = await import("./resources/js-string-constants.wasm");
5+
6+
assert_equals(wasmModule.empty, "");
7+
assert_equals(wasmModule.nullByte, "\0");
8+
assert_equals(wasmModule.hello, "hello");
9+
assert_equals(wasmModule.emoji, "\u{1F600}");
10+
}, "String constants from wasm:js/string-constants should be supported in ESM integration");

test/fixtures/wpt/wasm/jsapi/exception/basic.tentative.any.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
function assert_throws_wasm(fn, message) {
55
try {
66
fn();
7-
assert_not_reached(`expected to throw with ${message}`);
7+
assert_unreached(`expected to throw with ${message}`);
88
} catch (e) {
99
assert_true(e instanceof WebAssembly.Exception, `Error should be a WebAssembly.Exception with ${message}`);
1010
}

test/fixtures/wpt/wasm/jsapi/exception/constructor.tentative.any.js

Lines changed: 1 addition & 1 deletion

0 commit comments

Comments
 (0)