Index: test/mjsunit/wasm/instantiate-module-basic.js |
diff --git a/test/mjsunit/wasm/instantiate-module-basic.js b/test/mjsunit/wasm/instantiate-module-basic.js |
index 72a3425c906de342f569d108b40871c6fae6807b..d9712e66af5a0e531add7ed83a2cd30a9422e61b 100644 |
--- a/test/mjsunit/wasm/instantiate-module-basic.js |
+++ b/test/mjsunit/wasm/instantiate-module-basic.js |
@@ -58,3 +58,17 @@ CheckInstance(new WebAssembly.Instance(module)); |
let promise = WebAssembly.compile(buffer); |
promise.then(module => CheckInstance(new WebAssembly.Instance(module))); |
+ |
+// Negative tests. |
rossberg
2016/07/04 10:04:00
We should probably have a few new positive tests,
Mircea Trofin
2016/07/05 06:02:43
True - actually, for that to work, we'll have to c
|
+(function InvalidModules() { |
+ let invalid_cases = [undefined, 1, "", "a", {some:1, obj: "b"}]; |
+ let len = invalid_cases.length; |
+ for (var i = 0; i < len; ++i) { |
+ try { |
+ let instance = new WebAssembly.Instance(1); |
+ assertUnreachable("should not be able to instantiate invalid modules."); |
+ } catch (e) { |
+ assertContains("Argument 0", e.toString()); |
+ } |
+ } |
+})(); |