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

Function smoke_host_func

tests/all/async_functions.rs:40–72  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

38
39#[tokio::test]
40async fn smoke_host_func() -> Result<()> {
41 let mut store = async_store();
42 let mut linker = Linker::new(store.engine());
43
44 linker.func_new_async(
45 "",
46 "first",
47 FuncType::new(store.engine(), None, None),
48 move |_caller, _params, _results| Box::new(async { Ok(()) }),
49 )?;
50
51 linker.func_wrap_async("", "second", move |_caller, _: ()| {
52 Box::new(async { Ok(()) })
53 })?;
54
55 let func = linker
56 .get(&mut store, "", "first")
57 .unwrap()
58 .into_func()
59 .unwrap();
60 run_smoke_test(&mut store, func).await;
61 run_smoke_typed_test(&mut store, func).await;
62
63 let func = linker
64 .get(&mut store, "", "second")
65 .unwrap()
66 .into_func()
67 .unwrap();
68 run_smoke_test(&mut store, func).await;
69 run_smoke_typed_test(&mut store, func).await;
70
71 Ok(())
72}
73
74#[tokio::test]
75async fn smoke_with_suspension() {

Callers

nothing calls this directly

Calls 11

OkFunction · 0.85
run_smoke_testFunction · 0.85
run_smoke_typed_testFunction · 0.85
async_storeFunction · 0.70
newFunction · 0.50
engineMethod · 0.45
func_new_asyncMethod · 0.45
func_wrap_asyncMethod · 0.45
unwrapMethod · 0.45
into_funcMethod · 0.45
getMethod · 0.45

Tested by

no test coverage detected