-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Make too many imports an instantiation error (#1478)
* 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.
- Loading branch information
1 parent
6a68130
commit 1a2eccc
Showing
2 changed files
with
21 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
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(()) | ||
} |