Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1156)

Unified Diff: test/mjsunit/wasm/js-api.js

Issue 2624853002: [wasm] JS API tests for `WebAssembly.validate` (Closed)
Patch Set: addressed feedback Created 3 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/wasm/wasm-module.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/mjsunit/wasm/js-api.js
diff --git a/test/mjsunit/wasm/js-api.js b/test/mjsunit/wasm/js-api.js
index 60ed7474211db3d64f60d42f472f064616811bc0..259754018b828ed00d81cd73df1e2188510eed9d 100644
--- a/test/mjsunit/wasm/js-api.js
+++ b/test/mjsunit/wasm/js-api.js
@@ -41,6 +41,13 @@ let importingModuleBinary = (() => {
return new Int8Array(builder.toBuffer());
})();
+let moduleBinaryImporting2Memories = (() => {
+ var builder = new WasmModuleBuilder();
+ builder.addImportedMemory("", "memory1");
+ builder.addImportedMemory("", "memory2");
+ return new Int8Array(builder.toBuffer());
+})();
+
// 'WebAssembly' data property on global object
let wasmDesc = Object.getOwnPropertyDescriptor(this, 'WebAssembly');
assertEq(typeof wasmDesc.value, "object");
@@ -478,6 +485,13 @@ assertEq(tbl.length, 2);
assertErrorMessage(() => tbl.grow(1), Error, /failed to grow table/);
}
+// 'WebAssembly.validate' function
+assertErrorMessage(() => WebAssembly.validate(), TypeError);
+assertErrorMessage(() => WebAssembly.validate("hi"), TypeError);
+assertEq(WebAssembly.validate(emptyModuleBinary), true);
+// TODO: other ways for validate to return false.
+assertEq(WebAssembly.validate(moduleBinaryImporting2Memories), false);
+
// 'WebAssembly.compile' data property
let compileDesc = Object.getOwnPropertyDescriptor(WebAssembly, 'compile');
assertEq(typeof compileDesc.value, "function");
« no previous file with comments | « src/wasm/wasm-module.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698