| 326 | |
| 327 | #[tokio::test] |
| 328 | async fn instantiate_async() -> Result<(), Error> { |
| 329 | let engine = Engine::default(); |
| 330 | let mut store = Store::new(&engine, State::default()); |
| 331 | store.call_hook(sync_call_hook); |
| 332 | |
| 333 | let m = Module::new(store.engine(), "(module)")?; |
| 334 | Instance::new_async(&mut store, &m, &[]).await?; |
| 335 | assert_eq!(store.data().calls_into_wasm, 0); |
| 336 | assert_eq!(store.data().calls_into_host, 0); |
| 337 | |
| 338 | let m = Module::new(store.engine(), "(module (func) (start 0))")?; |
| 339 | Instance::new_async(&mut store, &m, &[]).await?; |
| 340 | assert_eq!(store.data().calls_into_wasm, 1); |
| 341 | assert_eq!(store.data().calls_into_host, 0); |
| 342 | |
| 343 | Ok(()) |
| 344 | } |
| 345 | |
| 346 | #[test] |
| 347 | fn recursion() -> Result<(), Error> { |