From 5ca79a71b2a2379083093d4d9136b2ae4095dfe8 Mon Sep 17 00:00:00 2001 From: Daniel Wirtz Date: Wed, 15 Jan 2020 01:00:08 +0100 Subject: 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. --- test/binaryen.js/debug-info.js | 72 +++++++++++++++++++----------------------- 1 file changed, 32 insertions(+), 40 deletions(-) (limited to 'test/binaryen.js/debug-info.js') 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(); -- cgit v1.2.3