()
| 260 | |
| 261 | #[test] |
| 262 | fn instance_get_global() -> Result<()> { |
| 263 | let module_bytes = { |
| 264 | let mut config = Config::new(); |
| 265 | config.concurrency_support(false); |
| 266 | let engine = Engine::new(&config)?; |
| 267 | Module::new( |
| 268 | &engine, |
| 269 | "(module (global (export \"g\") i32 (i32.const 42)))", |
| 270 | )? |
| 271 | .serialize()? |
| 272 | }; |
| 273 | let mut config = Config::new(); |
| 274 | config.enable_compiler(false); |
| 275 | config.concurrency_support(false); |
| 276 | let engine = Engine::new(&config)?; |
| 277 | let module = unsafe { Module::deserialize(&engine, &module_bytes)? }; |
| 278 | let linker = Linker::<()>::new(&engine); |
| 279 | let instance_pre = linker.instantiate_pre(&module)?; |
| 280 | |
| 281 | OomTest::new().test(|| { |
| 282 | let mut store = Store::try_new(&engine, ())?; |
| 283 | let instance = instance_pre.instantiate(&mut store)?; |
| 284 | let g = instance.get_global(&mut store, "g"); |
| 285 | assert!(g.is_some()); |
| 286 | Ok(()) |
| 287 | }) |
| 288 | } |
| 289 | |
| 290 | #[test] |
| 291 | fn instance_global_init_with_imported_global() -> Result<()> { |
nothing calls this directly
no test coverage detected