summaryrefslogtreecommitdiff
path: root/test/binaryen.js/debug-info.js
diff options
context:
space:
mode:
Diffstat (limited to 'test/binaryen.js/debug-info.js')
-rw-r--r--test/binaryen.js/debug-info.js68
1 files changed, 36 insertions, 32 deletions
diff --git a/test/binaryen.js/debug-info.js b/test/binaryen.js/debug-info.js
index d1634f10e..a769d8911 100644
--- a/test/binaryen.js/debug-info.js
+++ b/test/binaryen.js/debug-info.js
@@ -11,37 +11,41 @@ var wast = `
)
`;
-// 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();
+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();
+ // 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();
-// 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();
+ // 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();
+}
+
+Binaryen.ready.then(test);