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

Function instantiate

tests/all/call_hook.rs:310–325  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

308
309#[test]
310fn instantiate() -> Result<(), Error> {
311 let mut store = Store::<State>::default();
312 store.call_hook(sync_call_hook);
313
314 let m = Module::new(store.engine(), "(module)")?;
315 Instance::new(&mut store, &m, &[])?;
316 assert_eq!(store.data().calls_into_wasm, 0);
317 assert_eq!(store.data().calls_into_host, 0);
318
319 let m = Module::new(store.engine(), "(module (func) (start 0))")?;
320 Instance::new(&mut store, &m, &[])?;
321 assert_eq!(store.data().calls_into_wasm, 1);
322 assert_eq!(store.data().calls_into_host, 0);
323
324 Ok(())
325}
326
327#[tokio::test]
328async fn instantiate_async() -> Result<(), Error> {

Callers 9

runFunction · 0.50
run_with_optionsFunction · 0.50
ids_are_threaded_throughFunction · 0.50
owningFunction · 0.50
borrowing_no_duplicationFunction · 0.50
runFunction · 0.50

Calls 4

OkFunction · 0.85
newFunction · 0.50
call_hookMethod · 0.45
engineMethod · 0.45

Tested by

no test coverage detected