MCPcopy Create free account
hub / github.com/bytecodealliance/wasmtime / trap_display_pretty

Function trap_display_pretty

tests/all/traps.rs:297–324  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

295
296#[test]
297fn 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 "\
315error 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]
327fn trap_display_multi_module() -> Result<()> {

Callers

nothing calls this directly

Calls 5

OkFunction · 0.85
assert_containsMethod · 0.80
newFunction · 0.50
engineMethod · 0.45
callMethod · 0.45

Tested by

no test coverage detected