Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Add a test for an already-fixed issue
Closes #849
  • Loading branch information
alexcrichton committed Mar 19, 2020
commit dca57d94795e962ba69ffa8468e00efc36db988f
10 changes: 10 additions & 0 deletions crates/api/tests/func.rs
Original file line number Diff line number Diff line change
Expand Up @@ -385,3 +385,13 @@ fn caller_memory() -> anyhow::Result<()> {
Instance::new(&module, &[f.into()])?;
Ok(())
}

#[test]
fn func_write_nothing() -> anyhow::Result<()> {
let store = Store::default();
let ty = FuncType::new(Box::new([]), Box::new([ValType::I32]));
let f = Func::new(&store, ty, |_, _, _| Ok(()));
let err = f.call(&[]).unwrap_err();
assert_eq!(err.message(), "function attempted to return an incompatible value");
Ok(())
}