Source code
Revision control
Copy as Markdown
Other Tools
Test Info:
- This WPT test may be referenced by the following Test IDs:
- /wasm/jsapi/esm-integration/string-builtins.tentative.any.js - WPT Dashboard Interop Dashboard
- /wasm/jsapi/esm-integration/string-builtins.tentative.any.html - WPT Dashboard Interop Dashboard
- /wasm/jsapi/esm-integration/string-builtins.tentative.any.shadowrealm-in-dedicatedworker.html - WPT Dashboard Interop Dashboard
- /wasm/jsapi/esm-integration/string-builtins.tentative.any.shadowrealm-in-shadowrealm.html - WPT Dashboard Interop Dashboard
- /wasm/jsapi/esm-integration/string-builtins.tentative.any.shadowrealm-in-sharedworker.html - WPT Dashboard Interop Dashboard
- /wasm/jsapi/esm-integration/string-builtins.tentative.any.shadowrealm-in-window.html - WPT Dashboard Interop Dashboard
- /wasm/jsapi/esm-integration/string-builtins.tentative.any.worker.html - WPT Dashboard Interop Dashboard
- /wasm/jsapi/esm-integration/string-builtins.tentative.https.any.shadowrealm-in-audioworklet.html - WPT Dashboard Interop Dashboard
- /wasm/jsapi/esm-integration/string-builtins.tentative.https.any.shadowrealm-in-serviceworker.html - WPT Dashboard Interop Dashboard
// META: global=window,dedicatedworker,jsshell,shadowrealm
promise_test(async () => {
const wasmModule = await import("./resources/js-string-builtins.wasm");
assert_equals(wasmModule.getLength("hello"), 5);
assert_equals(wasmModule.concatStrings("hello", " world"), "hello world");
assert_equals(wasmModule.compareStrings("test", "test"), 1);
assert_equals(wasmModule.compareStrings("test", "different"), 0);
assert_equals(wasmModule.testString("hello"), 1);
assert_equals(wasmModule.testString(42), 0);
}, "String builtins should be supported in imports in ESM integration");