summaryrefslogtreecommitdiff
path: root/deps/v8/test/mjsunit/wasm/anyref-table.js
diff options
context:
space:
mode:
Diffstat (limited to 'deps/v8/test/mjsunit/wasm/anyref-table.js')
-rw-r--r--deps/v8/test/mjsunit/wasm/anyref-table.js16
1 files changed, 16 insertions, 0 deletions
diff --git a/deps/v8/test/mjsunit/wasm/anyref-table.js b/deps/v8/test/mjsunit/wasm/anyref-table.js
index f9248199a2..f4e82d32c8 100644
--- a/deps/v8/test/mjsunit/wasm/anyref-table.js
+++ b/deps/v8/test/mjsunit/wasm/anyref-table.js
@@ -29,3 +29,19 @@ load("test/mjsunit/wasm/wasm-module-builder.js");
assertThrows(() => table.set(12), RangeError);
})();
+
+(function TestImportAnyRefTable() {
+ print(arguments.callee.name);
+
+ const builder = new WasmModuleBuilder();
+ const table_index = builder.addImportedTable("imp", "table", 3, 10, kWasmAnyRef);
+ builder.addFunction('get', kSig_r_v)
+ .addBody([kExprI32Const, 0, kExprGetTable, table_index]);
+
+ let table_ref = new WebAssembly.Table({element: "anyref", initial: 3, maximum: 10});
+ builder.instantiate({imp:{table: table_ref}});
+
+ let table_func = new WebAssembly.Table({ element: "anyfunc", initial: 3, maximum: 10 });
+ assertThrows(() => builder.instantiate({ imp: { table: table_func } }),
+ WebAssembly.LinkError, /imported table does not match the expected type/);
+})();