| import Builder from '../Builder.js' |
| import * as assert from '../assert.js' |
| |
| { |
| const b = new Builder(); |
| b.Type().End() |
| .Function().End() |
| .Exception().Signature({ params: [] }).End() |
| .Export().Function("call") |
| .Exception("foo", 0) |
| .End() |
| .Code() |
| .Function("call", { params: [], ret: "i32" }) |
| .Throw(0) |
| .I32Const(1) |
| .End() |
| .End() |
| |
| const bin = b.WebAssembly().get(); |
| const module = new WebAssembly.Module(bin); |
| const instance = new WebAssembly.Instance(module); |
| |
| assert.throws(instance.exports.call, WebAssembly.Exception); |
| } |