()
| 700 | #[tokio::test] |
| 701 | #[cfg_attr(miri, ignore)] |
| 702 | async fn linker_module_command() -> Result<()> { |
| 703 | let mut store = async_store(); |
| 704 | let mut linker = Linker::new(store.engine()); |
| 705 | |
| 706 | let module1 = Module::new( |
| 707 | store.engine(), |
| 708 | r#" |
| 709 | (module |
| 710 | (global $g (mut i32) (i32.const 0)) |
| 711 | |
| 712 | (func (export "_start")) |
| 713 | |
| 714 | (func (export "g") (result i32) |
| 715 | global.get $g |
| 716 | i32.const 1 |
| 717 | global.set $g) |
| 718 | ) |
| 719 | "#, |
| 720 | )?; |
| 721 | |
| 722 | let module2 = Module::new( |
| 723 | store.engine(), |
| 724 | r#" |
| 725 | (module |
| 726 | (import "" "g" (func (result i32))) |
| 727 | |
| 728 | (func (export "get") (result i32) |
| 729 | call 0) |
| 730 | ) |
| 731 | "#, |
| 732 | )?; |
| 733 | |
| 734 | linker.module_async(&mut store, "", &module1).await?; |
| 735 | let instance = linker.instantiate_async(&mut store, &module2).await?; |
| 736 | let f = instance.get_typed_func::<(), i32>(&mut store, "get")?; |
| 737 | assert_eq!(f.call_async(&mut store, ()).await?, 0); |
| 738 | assert_eq!(f.call_async(&mut store, ()).await?, 0); |
| 739 | |
| 740 | Ok(()) |
| 741 | } |
| 742 | |
| 743 | #[tokio::test] |
| 744 | #[cfg_attr(miri, ignore)] |
nothing calls this directly
no test coverage detected