blob: 5b44b14b2b44ed227d65a09b46b42c5ef8c0af62 [file] [edit]
import { instantiate } from "../wabt-wrapper.js"
import * as assert from "../assert.js"
/*
(module
(tag $e0 (param i32))
(func $throwif (export "throwif") (param i32)
(if (i32.eqz (local.get 0)) (then
(throw $e0 (i32.const 5))
) (else))
)
(func (export "catch_call") (param i32) (result i32)
(block $b (result i32)
(try_table (result i32) (catch $e0 $b)
(call $throwif (local.get 0))
(i32.const 0)
)
(return)
)
)
)
*/
var wasm_module = new WebAssembly.Module(new Uint8Array([
0x00,0x61,0x73,0x6d,0x01,0x00,0x00,0x00,0x01,0x8a,0x80,0x80,0x80,0x00,0x02,0x60,0x01,0x7f,0x00,0x60,0x01,0x7f,0x01,0x7f,0x03,0x83,0x80,0x80,0x80,0x00,0x02,0x00,0x01,0x0d,0x83,0x80,0x80,0x80,0x00,0x01,0x00,0x00,0x07,0x98,0x80,0x80,0x80,0x00,0x02,0x07,0x74,0x68,0x72,0x6f,0x77,0x69,0x66,0x00,0x00,0x0a,0x63,0x61,0x74,0x63,0x68,0x5f,0x63,0x61,0x6c,0x6c,0x00,0x01,0x0a,0xaa,0x80,0x80,0x80,0x00,0x02,0x8c,0x80,0x80,0x80,0x00,0x00,0x20,0x00,0x45,0x04,0x40,0x41,0x05,0x08,0x00,0x0b,0x0b,0x93,0x80,0x80,0x80,0x00,0x00,0x02,0x7f,0x1f,0x7f,0x01,0x00,0x00,0x00,0x20,0x00,0x10,0x00,0x41,0x00,0x0b,0x0f,0x0b,0x0b,
]));
var instance = new WebAssembly.Instance(wasm_module);
const { catch_call } = instance.exports
for (let i = 0; i < wasmTestLoopCount; ++i) {
assert.eq(catch_call(0), 5)
assert.eq(catch_call(1), 0)
}