Skip to content

Commit

Permalink
add another resumable call test
Browse files Browse the repository at this point in the history
  • Loading branch information
Robbepop committed Jan 4, 2023
1 parent 2f5f563 commit 7ed70a7
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions crates/wasmi/tests/e2e/v1/resumable_call.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,26 @@ fn test_setup() -> Store<()> {
Store::new(&engine, ())
}

#[test]
fn resumable_call_host() {
let mut store = test_setup();
let host_fn = Func::wrap(&mut store, || -> Result<(), Trap> {
Err(Trap::i32_exit(100))
});
// Even though the called host function traps we expect a normal error
// since the host function is the root function of the call and therefore
// it would not make sense to resume it.
match host_fn.call_resumable(&mut store, &[], &mut []) {
Ok(_) => panic!("expected an error since the called host function is root"),
Err(trap) => match trap {
Error::Trap(trap) => {
assert_eq!(trap.i32_exit_status(), Some(100));
}
_ => panic!("expected Wasm trap"),
},
}
}

#[test]
fn resumable_call() {
let mut store = test_setup();
Expand Down

0 comments on commit 7ed70a7

Please sign in to comment.