summaryrefslogtreecommitdiff
path: root/test/binaryen.js/debug-info.js
diff options
context:
space:
mode:
authorDaniel Wirtz <dcode@dcode.io>2020-01-15 01:00:08 +0100
committerAlon Zakai <azakai@google.com>2020-01-14 16:00:08 -0800
commit5ca79a71b2a2379083093d4d9136b2ae4095dfe8 (patch)
tree80263fb09290b896362a36d3ae062ee6cb64fb8c /test/binaryen.js/debug-info.js
parenta43b533b0778a1daf47178a3d3d9e559f3d390ed (diff)
downloadbinaryen-5ca79a71b2a2379083093d4d9136b2ae4095dfe8.tar.gz
binaryen-5ca79a71b2a2379083093d4d9136b2ae4095dfe8.tar.bz2
binaryen-5ca79a71b2a2379083093d4d9136b2ae4095dfe8.zip
Align binaryen.js with the npm package (#2551)
Binaryen.js now uses binaryen (was Binaryen) as its global name to align with the npm package. Also fixes issues with emitting and testing both the JS and Wasm builds.
Diffstat (limited to 'test/binaryen.js/debug-info.js')
-rw-r--r--test/binaryen.js/debug-info.js72
1 files changed, 32 insertions, 40 deletions
diff --git a/test/binaryen.js/debug-info.js b/test/binaryen.js/debug-info.js
index a769d8911..44eca1b07 100644
--- a/test/binaryen.js/debug-info.js
+++ b/test/binaryen.js/debug-info.js
@@ -1,7 +1,3 @@
-function assert(x) {
- if (!x) throw 'error!';
-}
-
var wast = `
(module
(type $v (func))
@@ -11,41 +7,37 @@ var wast = `
)
`;
-function test() {
- // Use defaults (should not emit debug info)
- console.log("=== default ===");
- console.log("debugInfo=" + Binaryen.getDebugInfo());
- var module = Binaryen.parseText(wast);
- var binary = module.emitBinary();
- module.dispose();
- module = Binaryen.readBinary(binary);
- console.log(module.emitText());
- assert(module.validate());
- module.dispose();
-
- // With debug info
- console.log("=== with debug info ===");
- Binaryen.setDebugInfo(true);
- console.log("debugInfo=" + Binaryen.getDebugInfo());
- module = Binaryen.parseText(wast);
- binary = module.emitBinary();
- module.dispose();
- module = Binaryen.readBinary(binary);
- console.log(module.emitText());
- assert(module.validate());
- module.dispose();
+// Use defaults (should not emit debug info)
+console.log("=== default ===");
+console.log("debugInfo=" + binaryen.getDebugInfo());
+var module = binaryen.parseText(wast);
+var binary = module.emitBinary();
+module.dispose();
+module = binaryen.readBinary(binary);
+console.log(module.emitText());
+assert(module.validate());
+module.dispose();
- // Without debug info
- console.log("=== without debug info ===");
- Binaryen.setDebugInfo(false);
- console.log("debugInfo=" + Binaryen.getDebugInfo());
- module = Binaryen.parseText(wast);
- binary = module.emitBinary();
- module.dispose();
- module = Binaryen.readBinary(binary);
- console.log(module.emitText());
- assert(module.validate());
- module.dispose();
-}
+// With debug info
+console.log("=== with debug info ===");
+binaryen.setDebugInfo(true);
+console.log("debugInfo=" + binaryen.getDebugInfo());
+module = binaryen.parseText(wast);
+binary = module.emitBinary();
+module.dispose();
+module = binaryen.readBinary(binary);
+console.log(module.emitText());
+assert(module.validate());
+module.dispose();
-Binaryen.ready.then(test);
+// Without debug info
+console.log("=== without debug info ===");
+binaryen.setDebugInfo(false);
+console.log("debugInfo=" + binaryen.getDebugInfo());
+module = binaryen.parseText(wast);
+binary = module.emitBinary();
+module.dispose();
+module = binaryen.readBinary(binary);
+console.log(module.emitText());
+assert(module.validate());
+module.dispose();