(style: ApiStyle)
| 3125 | } |
| 3126 | |
| 3127 | async fn thread_index_via_call(style: ApiStyle) -> Result<()> { |
| 3128 | let component = r#" |
| 3129 | (component |
| 3130 | (core module $m |
| 3131 | (import "" "thread.index" (func $thread-index (result i32))) |
| 3132 | (func (export "run") |
| 3133 | (if (i32.eqz (call $thread-index)) (then unreachable)) |
| 3134 | ) |
| 3135 | ) |
| 3136 | (core func $thread-index (canon thread.index)) |
| 3137 | (core instance $m (instantiate $m (with "" (instance |
| 3138 | (export "thread.index" (func $thread-index)) |
| 3139 | )))) |
| 3140 | (func (export "run") (canon lift (core func $m "run"))) |
| 3141 | ) |
| 3142 | "#; |
| 3143 | let engine = Engine::new(&style.config())?; |
| 3144 | let component = Component::new(&engine, component)?; |
| 3145 | let mut store = Store::new(&engine, ()); |
| 3146 | let linker = Linker::new(&engine); |
| 3147 | let instance = style.instantiate(&mut store, &linker, &component).await?; |
| 3148 | let run = instance.get_typed_func::<(), ()>(&mut store, "run")?; |
| 3149 | style.call(&mut store, run, ()).await?; |
| 3150 | Ok(()) |
| 3151 | } |
| 3152 | |
| 3153 | #[tokio::test] |
| 3154 | async fn thread_index_via_post_return_sync() -> Result<()> { |
no test coverage detected