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

Function panic_in_memory_limiter

tests/all/limits.rs:978–991  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

976#[test]
977#[should_panic(expected = "resource limiter memory growing")]
978fn panic_in_memory_limiter() {
979 let engine = Engine::default();
980 let linker = Linker::new(&engine);
981
982 let module = Module::new(&engine, r#"(module (memory (export "m") 0))"#).unwrap();
983
984 let mut store = Store::new(&engine, Panic);
985 store.limiter(|s| s as &mut dyn ResourceLimiter);
986 let instance = linker.instantiate(&mut store, &module).unwrap();
987 let memory = instance.get_memory(&mut store, "m").unwrap();
988
989 // Grow the memory, which should panic
990 memory.grow(&mut store, 3).unwrap();
991}
992
993#[test]
994#[should_panic(expected = "resource limiter memory growing")]

Callers

nothing calls this directly

Calls 6

newFunction · 0.50
unwrapMethod · 0.45
limiterMethod · 0.45
instantiateMethod · 0.45
get_memoryMethod · 0.45
growMethod · 0.45

Tested by

no test coverage detected