summaryrefslogtreecommitdiff
path: root/test/binaryen.js
diff options
context:
space:
mode:
Diffstat (limited to 'test/binaryen.js')
-rw-r--r--test/binaryen.js/call_import_error.js13
-rw-r--r--test/binaryen.js/call_import_error.js.txt22
2 files changed, 35 insertions, 0 deletions
diff --git a/test/binaryen.js/call_import_error.js b/test/binaryen.js/call_import_error.js
new file mode 100644
index 000000000..4434584b5
--- /dev/null
+++ b/test/binaryen.js/call_import_error.js
@@ -0,0 +1,13 @@
+var module = new Binaryen.Module();
+
+var signature = module.addFunctionType("v", Binaryen.none, []);
+module.addImport("fn", "env", "fn", signature);
+
+module.addFunction("main", signature, [], module.block("", [
+ module.call("fn", [], Binaryen.none) // should be callImport
+]));
+module.addExport("main", "main");
+
+console.log(module.emitText());
+
+module.validate(); // fails
diff --git a/test/binaryen.js/call_import_error.js.txt b/test/binaryen.js/call_import_error.js.txt
new file mode 100644
index 000000000..61e3f9339
--- /dev/null
+++ b/test/binaryen.js/call_import_error.js.txt
@@ -0,0 +1,22 @@
+(module
+ (type $v (func))
+ (import "env" "fn" (func $fn))
+ (memory $0 0)
+ (export "main" (func $main))
+ (func $main (type $v)
+ (call $fn)
+ )
+)
+
+[wasm-validator error in function $main] unexpected false: call target must exist, on
+(call $fn)
+(perhaps it should be a CallImport instead of Call?)
+(module
+ (type $v (func))
+ (import "env" "fn" (func $fn))
+ (memory $0 0)
+ (export "main" (func $main))
+ (func $main (type $v)
+ (call $fn)
+ )
+)