mirror of
https://github.com/fluencelabs/wasmer
synced 2025-04-01 15:31:04 +00:00
27 lines
715 B
Rust
27 lines
715 B
Rust
mod runtime_core_tests;
|
|
|
|
pub mod runtime_core_exception_handling {
|
|
use super::runtime_core_tests::{get_compiler, wat2wasm};
|
|
use wasmer::compiler::compile_with;
|
|
use wasmer::imports;
|
|
|
|
#[test]
|
|
fn exception_handling_works() {
|
|
const MODULE: &str = r#"
|
|
(module
|
|
(func (export "throw_trap")
|
|
unreachable
|
|
))
|
|
"#;
|
|
|
|
let wasm_binary = wat2wasm(MODULE.as_bytes()).expect("WAST not valid or malformed");
|
|
let module = compile_with(&wasm_binary, &get_compiler()).unwrap();
|
|
|
|
let imports = imports! {};
|
|
for _ in 0..2 {
|
|
let instance = module.instantiate(&imports).unwrap();
|
|
assert!(instance.call("throw_trap", &[]).is_err());
|
|
}
|
|
}
|
|
}
|