()
| 295 | |
| 296 | #[test] |
| 297 | fn trap_display_pretty() -> Result<()> { |
| 298 | let mut store = Store::<()>::default(); |
| 299 | let wat = r#" |
| 300 | (module $m |
| 301 | (func $die unreachable) |
| 302 | (func call $die) |
| 303 | (func $foo call 1) |
| 304 | (func (export "bar") call $foo) |
| 305 | ) |
| 306 | "#; |
| 307 | |
| 308 | let module = Module::new(store.engine(), wat)?; |
| 309 | let instance = Instance::new(&mut store, &module, &[])?; |
| 310 | let run_func = instance.get_typed_func::<(), ()>(&mut store, "bar")?; |
| 311 | |
| 312 | let e = run_func.call(&mut store, ()).unwrap_err(); |
| 313 | e.assert_contains( |
| 314 | "\ |
| 315 | error while executing at wasm backtrace: |
| 316 | 0: 0x23 - m!die |
| 317 | 1: 0x27 - m!<wasm function 1> |
| 318 | 2: 0x2c - m!foo |
| 319 | 3: 0x31 - m!<wasm function 3>", |
| 320 | ); |
| 321 | |
| 322 | e.assert_contains("wasm trap: wasm `unreachable` instruction executed"); |
| 323 | Ok(()) |
| 324 | } |
| 325 | |
| 326 | #[test] |
| 327 | fn trap_display_multi_module() -> Result<()> { |
nothing calls this directly
no test coverage detected