()
| 161 | #[test] |
| 162 | #[cfg_attr(miri, ignore)] |
| 163 | fn module_interposition() -> Result<()> { |
| 164 | let mut store = Store::<()>::default(); |
| 165 | let mut linker = Linker::new(store.engine()); |
| 166 | linker.allow_shadowing(true); |
| 167 | let mut module = Module::new( |
| 168 | store.engine(), |
| 169 | r#"(module (func (export "export") (result i32) (i32.const 7)))"#, |
| 170 | )?; |
| 171 | for _ in 0..4 { |
| 172 | let instance = linker.instantiate(&mut store, &module)?; |
| 173 | linker.instance(&mut store, "instance", instance)?; |
| 174 | module = Module::new( |
| 175 | store.engine(), |
| 176 | r#"(module |
| 177 | (import "instance" "export" (func (result i32))) |
| 178 | (func (export "export") (result i32) (i32.mul (call 0) (i32.const 2))) |
| 179 | )"#, |
| 180 | )?; |
| 181 | } |
| 182 | let instance = linker.instantiate(&mut store, &module)?; |
| 183 | let func = instance |
| 184 | .get_export(&mut store, "export") |
| 185 | .unwrap() |
| 186 | .into_func() |
| 187 | .unwrap(); |
| 188 | let func = func.typed::<(), i32>(&store)?; |
| 189 | assert_eq!(func.call(&mut store, ())?, 112); |
| 190 | Ok(()) |
| 191 | } |
| 192 | |
| 193 | #[test] |
| 194 | #[cfg_attr(miri, ignore)] |
nothing calls this directly
no test coverage detected