* Make too many imports an instantiation error Previously we'd accidentally only take the head of the list when instantiating, but instead this changes the API to require exactly the right number of imports.
14 lines
388 B
Rust
14 lines
388 B
Rust
use anyhow::Result;
|
|
use wasmtime::*;
|
|
|
|
#[test]
|
|
fn wrong_import_numbers() -> Result<()> {
|
|
let store = Store::default();
|
|
let module = Module::new(&store, r#"(module (import "" "" (func)))"#)?;
|
|
|
|
assert!(Instance::new(&module, &[]).is_err());
|
|
let func = Func::wrap(&store, || {});
|
|
assert!(Instance::new(&module, &[func.clone().into(), func.into()]).is_err());
|
|
Ok(())
|
|
}
|