diff options
Diffstat (limited to 'test/binaryen.js/event.js')
-rw-r--r-- | test/binaryen.js/event.js | 34 |
1 files changed, 19 insertions, 15 deletions
diff --git a/test/binaryen.js/event.js b/test/binaryen.js/event.js index 3931b3440..f728e9228 100644 --- a/test/binaryen.js/event.js +++ b/test/binaryen.js/event.js @@ -10,26 +10,30 @@ function cleanInfo(info) { return ret; } -var module = new Binaryen.Module(); -module.setFeatures(Binaryen.Features.ExceptionHandling); +function test() { + var module = new Binaryen.Module(); + module.setFeatures(Binaryen.Features.ExceptionHandling); -var pairType = Binaryen.createType([Binaryen.i32, Binaryen.f32]); + var pairType = Binaryen.createType([Binaryen.i32, Binaryen.f32]); -var event_ = module.addEvent("a-event", 0, Binaryen.i32, Binaryen.none); + var event_ = module.addEvent("a-event", 0, Binaryen.i32, Binaryen.none); -console.log("GetEvent is equal: " + (event_ === module.getEvent("a-event"))); + console.log("GetEvent is equal: " + (event_ === module.getEvent("a-event"))); -var eventInfo = Binaryen.getEventInfo(event_); -console.log("getEventInfo=" + JSON.stringify(cleanInfo(eventInfo))); + var eventInfo = Binaryen.getEventInfo(event_); + console.log("getEventInfo=" + JSON.stringify(cleanInfo(eventInfo))); -module.addEventExport("a-event", "a-event-exp"); -module.addEventImport("a-event-imp", "module", "base", 0, pairType, Binaryen.none); + module.addEventExport("a-event", "a-event-exp"); + module.addEventImport("a-event-imp", "module", "base", 0, pairType, Binaryen.none); -assert(module.validate()); -console.log(module.emitText()); + assert(module.validate()); + console.log(module.emitText()); -module.removeExport("a-event-exp"); -module.removeEvent("a-event"); + module.removeExport("a-event-exp"); + module.removeEvent("a-event"); -assert(module.validate()); -console.log(module.emitText()); + assert(module.validate()); + console.log(module.emitText()); +} + +Binaryen.ready.then(test); |