Implement API support for v128-globals (#3147)

Found via fuzzing, and looks like these were accidentally left out along
the way SIMD was taking shape.
This commit is contained in:
Alex Crichton
2021-08-05 13:02:34 -05:00
committed by GitHub
parent 79638791fd
commit 4cfa031c5f
5 changed files with 29 additions and 3 deletions

View File

@@ -89,3 +89,17 @@ fn use_after_drop() -> anyhow::Result<()> {
assert_eq!(g.get(&mut store).i32(), Some(101));
Ok(())
}
#[test]
fn v128() -> anyhow::Result<()> {
let mut store = Store::<()>::default();
let g = Global::new(
&mut store,
GlobalType::new(ValType::V128, Mutability::Var),
0u128.into(),
)?;
assert_eq!(g.get(&mut store).v128(), Some(0));
g.set(&mut store, 1u128.into())?;
assert_eq!(g.get(&mut store).v128(), Some(1));
Ok(())
}