Index: test/mjsunit/wasm/import-memory.js |
diff --git a/test/mjsunit/wasm/import-memory.js b/test/mjsunit/wasm/import-memory.js |
index fd91dc0f7292ba93cf697315d5b0d15b39e4a3f3..96317b7f640c7ae6d34ef82cc16169465fcb745a 100644 |
--- a/test/mjsunit/wasm/import-memory.js |
+++ b/test/mjsunit/wasm/import-memory.js |
@@ -382,3 +382,18 @@ load("test/mjsunit/wasm/wasm-module-builder.js"); |
assertEquals(3, instance.exports.mem_size()); |
assertEquals(3*kPageSize, instance.exports.exported_mem.buffer.byteLength); |
})(); |
+ |
+(function TestImportTooLarge() { |
+ print("TestImportTooLarge"); |
+ let builder = new WasmModuleBuilder(); |
+ builder.addImportedMemory("m", "m", 1, 2); |
+ |
+ // initial size is too large |
+ assertThrows(() => builder.instantiate({m: {m: new WebAssembly.Memory({initial: 3, maximum: 3})}})); |
+ |
+ // maximum size is too large |
+ assertThrows(() => builder.instantiate({m: {m: new WebAssembly.Memory({initial: 1, maximum: 4})}})); |
+ |
+ // no maximum |
+ assertThrows(() => builder.instantiate({m: {m: new WebAssembly.Memory({initial: 1})}})); |
+})(); |