summaryrefslogtreecommitdiff
path: root/test/binaryen.js/emit_asmjs.js
diff options
context:
space:
mode:
authorHeejin Ahn <aheejin@gmail.com>2019-07-29 14:50:20 -0700
committerGitHub <noreply@github.com>2019-07-29 14:50:20 -0700
commitff9bd3acecc2e1a8a7e73cf2fa186598197395e3 (patch)
treeb548f24b3719128fa123d2cd8fdeca7cf6271b3d /test/binaryen.js/emit_asmjs.js
parentbe6f7c4795ab3bc135e10162b0d7a1063e5d65ba (diff)
downloadbinaryen-ff9bd3acecc2e1a8a7e73cf2fa186598197395e3.tar.gz
binaryen-ff9bd3acecc2e1a8a7e73cf2fa186598197395e3.tar.bz2
binaryen-ff9bd3acecc2e1a8a7e73cf2fa186598197395e3.zip
Make sure binaryen.js tests validate (#2269)
Without `assert`, even if a test does not validate, the errors will only show up in its corresponding `.txt` file while the test will succeed. This makes sure it errors out when a test fails to validate. This also adds validation checks if there is none.
Diffstat (limited to 'test/binaryen.js/emit_asmjs.js')
-rw-r--r--test/binaryen.js/emit_asmjs.js6
1 files changed, 5 insertions, 1 deletions
diff --git a/test/binaryen.js/emit_asmjs.js b/test/binaryen.js/emit_asmjs.js
index 1faf58308..19b2f7b2c 100644
--- a/test/binaryen.js/emit_asmjs.js
+++ b/test/binaryen.js/emit_asmjs.js
@@ -1,3 +1,7 @@
+function assert(x) {
+ if (!x) throw 'error!';
+}
+
var module = new Binaryen.Module();
var signature = module.addFunctionType("ii", Binaryen.i32, [ Binaryen.i32 ]);
@@ -6,6 +10,6 @@ module.addFunction("main", signature, [], module.local.get(0, Binaryen.i32));
module.addFunctionExport("main", "main");
-module.validate(); // should validate before calling emitAsmjs
+assert(module.validate()); // should validate before calling emitAsmjs
console.log(module.emitAsmjs());