Chromium Code Reviews| Index: test/mjsunit/wasm/indirect-tables.js |
| diff --git a/test/mjsunit/wasm/indirect-tables.js b/test/mjsunit/wasm/indirect-tables.js |
| index 057d0f3661f044879a28dc6015484182a8ee1f19..33f5da6a2bcc64308bfba14f0b6ba09c433acb37 100644 |
| --- a/test/mjsunit/wasm/indirect-tables.js |
| +++ b/test/mjsunit/wasm/indirect-tables.js |
| @@ -199,7 +199,8 @@ function js_div(a, b) { return (a / b) | 0; } |
| for (let i = 0; i < 5; i++) { |
| print(" base = " + i); |
| let table = new WebAssembly.Table({element: "anyfunc", |
| - initial: kTableSize}); |
| + initial: kTableSize, |
| + maximum: kTableSize}); |
| assertEquals(10, table.length); |
| let i2 = new WebAssembly.Instance(m2, {q: {base: i, table: table, |
| js_div: js_div}}); |
| @@ -242,7 +243,7 @@ function js_div(a, b) { return (a / b) | 0; } |
| print("CumulativeTest..."); |
| let kTableSize = 10; |
| - let table = new WebAssembly.Table({element: "anyfunc", initial: 10}); |
| + let table = new WebAssembly.Table({element: "anyfunc", initial: kTableSize, maximum: kTableSize}); |
|
rossberg
2017/01/17 14:22:06
Nit: line length
titzer
2017/01/17 16:47:18
Done.
|
| var builder = new WasmModuleBuilder(); |
| @@ -457,3 +458,22 @@ function js_div(a, b) { return (a / b) | 0; } |
| } |
| assertThrows(() => table.grow(11)); |
| })(); |
| + |
| + |
| +(function TestImportTooLarge() { |
| + print("TestImportTooLarge..."); |
| + let builder = new WasmModuleBuilder(); |
| + builder.addImportedTable("t", "t", 1, 2); |
| + |
| + // initial size is too large |
| + assertThrows(() => builder.instantiate({t: {t: new WebAssembly.Table( |
| + {element: "anyfunc", initial: 3, maximum: 3})}})); |
| + |
| + // maximum size is too large |
| + assertThrows(() => builder.instantiate({t: {t: new WebAssembly.Table( |
| + {element: "anyfunc", initial: 1, maximum: 4})}})); |
| + |
| + // no maximum |
| + assertThrows(() => builder.instantiate({t: {t: new WebAssembly.Table( |
| + {element: "anyfunc", initial: 1})}})); |
| +})(); |