implement table _async methods, test passes now

This commit is contained in:
Pat Hickey
2021-10-21 14:15:53 -07:00
parent 5aef8f47c8
commit 252ba39c27
2 changed files with 58 additions and 6 deletions

View File

@@ -134,19 +134,21 @@ async fn test_limits_async() -> Result<()> {
// Test instance exports and host objects hitting the limit
for table in std::array::IntoIter::new([
instance.get_table(&mut store, "t").unwrap(),
Table::new(
Table::new_async(
&mut store,
TableType::new(ValType::FuncRef, 0, None),
Val::FuncRef(None),
)?,
)
.await?,
]) {
table.grow(&mut store, 2, Val::FuncRef(None))?;
table.grow(&mut store, 1, Val::FuncRef(None))?;
table.grow(&mut store, 2, Val::FuncRef(None))?;
table.grow_async(&mut store, 2, Val::FuncRef(None)).await?;
table.grow_async(&mut store, 1, Val::FuncRef(None)).await?;
table.grow_async(&mut store, 2, Val::FuncRef(None)).await?;
assert_eq!(
table
.grow(&mut store, 1, Val::FuncRef(None))
.grow_async(&mut store, 1, Val::FuncRef(None))
.await
.map_err(|e| e.to_string())
.unwrap_err(),
"failed to grow table by `1`"