()
| 325 | |
| 326 | #[test] |
| 327 | fn trap_display_multi_module() -> Result<()> { |
| 328 | let mut store = Store::<()>::default(); |
| 329 | let wat = r#" |
| 330 | (module $a |
| 331 | (func $die unreachable) |
| 332 | (func call $die) |
| 333 | (func $foo call 1) |
| 334 | (func (export "bar") call $foo) |
| 335 | ) |
| 336 | "#; |
| 337 | |
| 338 | let module = Module::new(store.engine(), wat)?; |
| 339 | let instance = Instance::new(&mut store, &module, &[])?; |
| 340 | let bar = instance.get_export(&mut store, "bar").unwrap(); |
| 341 | |
| 342 | let wat = r#" |
| 343 | (module $b |
| 344 | (import "" "" (func $bar)) |
| 345 | (func $middle call $bar) |
| 346 | (func (export "bar2") call $middle) |
| 347 | ) |
| 348 | "#; |
| 349 | let module = Module::new(store.engine(), wat)?; |
| 350 | let instance = Instance::new(&mut store, &module, &[bar])?; |
| 351 | let bar2 = instance.get_typed_func::<(), ()>(&mut store, "bar2")?; |
| 352 | |
| 353 | let e = bar2.call(&mut store, ()).unwrap_err(); |
| 354 | e.assert_contains( |
| 355 | "\ |
| 356 | error while executing at wasm backtrace: |
| 357 | 0: 0x23 - a!die |
| 358 | 1: 0x27 - a!<wasm function 1> |
| 359 | 2: 0x2c - a!foo |
| 360 | 3: 0x31 - a!<wasm function 3> |
| 361 | 4: 0x29 - b!middle |
| 362 | 5: 0x2e - b!<wasm function 2>", |
| 363 | ); |
| 364 | e.assert_contains("wasm trap: wasm `unreachable` instruction executed"); |
| 365 | Ok(()) |
| 366 | } |
| 367 | |
| 368 | #[test] |
| 369 | fn trap_start_function_import() -> Result<()> { |
nothing calls this directly
no test coverage detected