diff options
Diffstat (limited to 'test/binaryen.js/debug-info.js')
-rw-r--r-- | test/binaryen.js/debug-info.js | 72 |
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(); |