MCPcopy Create free account
hub / github.com/bytecodealliance/wasmtime / loops_interruptible

Function loops_interruptible

tests/all/iloop.rs:30–39  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

28
29#[test]
30fn loops_interruptible() -> wasmtime::Result<()> {
31 let mut store = interruptible_store();
32 let module = Module::new(store.engine(), r#"(func (export "loop") (loop br 0))"#)?;
33 let instance = Instance::new(&mut store, &module, &[])?;
34 let iloop = instance.get_typed_func::<(), ()>(&mut store, "loop")?;
35 store.engine().increment_epoch();
36 let trap = iloop.call(&mut store, ()).unwrap_err().downcast::<Trap>()?;
37 assert_eq!(trap, Trap::Interrupt);
38 Ok(())
39}
40
41#[test]
42fn functions_interruptible() -> wasmtime::Result<()> {

Callers

nothing calls this directly

Calls 6

interruptible_storeFunction · 0.85
OkFunction · 0.85
newFunction · 0.50
engineMethod · 0.45
increment_epochMethod · 0.45
callMethod · 0.45

Tested by

no test coverage detected