()
| 43 | |
| 44 | #[test] |
| 45 | fn mutability() -> wasmtime::Result<()> { |
| 46 | let mut store = Store::<()>::default(); |
| 47 | let g = Global::new( |
| 48 | &mut store, |
| 49 | GlobalType::new(ValType::I32, Mutability::Var), |
| 50 | 0.into(), |
| 51 | )?; |
| 52 | assert_eq!(g.get(&mut store).i32(), Some(0)); |
| 53 | g.set(&mut store, 1.into())?; |
| 54 | assert_eq!(g.get(&mut store).i32(), Some(1)); |
| 55 | Ok(()) |
| 56 | } |
| 57 | |
| 58 | // Make sure that a global is still usable after its original instance is |
| 59 | // dropped. This is a bit of a weird test and really only fails depending on the |