()
| 11 | |
| 12 | #[test] |
| 13 | fn test_trap_return() -> Result<()> { |
| 14 | let mut store = Store::<()>::default(); |
| 15 | let wat = r#" |
| 16 | (module |
| 17 | (func $hello (import "" "hello")) |
| 18 | (func (export "run") (call $hello)) |
| 19 | ) |
| 20 | "#; |
| 21 | |
| 22 | let module = Module::new(store.engine(), wat)?; |
| 23 | let hello_type = FuncType::new(store.engine(), None, None); |
| 24 | let hello_func = Func::new(&mut store, hello_type, |_, _, _| bail!("test 123")); |
| 25 | |
| 26 | let instance = Instance::new(&mut store, &module, &[hello_func.into()])?; |
| 27 | let run_func = instance.get_typed_func::<(), ()>(&mut store, "run")?; |
| 28 | |
| 29 | let e = run_func.call(&mut store, ()).unwrap_err(); |
| 30 | e.assert_contains("test 123"); |
| 31 | |
| 32 | assert!( |
| 33 | e.downcast_ref::<WasmBacktrace>().is_some(), |
| 34 | "error should contain a WasmBacktrace" |
| 35 | ); |
| 36 | |
| 37 | Ok(()) |
| 38 | } |
| 39 | |
| 40 | #[test] |
| 41 | fn test_format_err_error_return() -> Result<()> { |
nothing calls this directly
no test coverage detected