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

Function trap_start_function_import

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

Source from the content-addressed store, hash-verified

367
368#[test]
369fn trap_start_function_import() -> Result<()> {
370 let mut store = Store::<()>::default();
371 let binary = wat::parse_str(
372 r#"
373 (module $a
374 (import "" "" (func $foo))
375 (start $foo)
376 )
377 "#,
378 )?;
379
380 let module = Module::new(store.engine(), &binary)?;
381 let sig = FuncType::new(store.engine(), None, None);
382 let func = Func::new(&mut store, sig, |_, _, _| bail!("user trap"));
383 let err = Instance::new(&mut store, &module, &[func.into()]).unwrap_err();
384 err.assert_contains("user trap");
385 Ok(())
386}
387
388#[test]
389fn rust_panic_import() -> Result<()> {

Callers

nothing calls this directly

Calls 4

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

Tested by

no test coverage detected