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

Function test_unknown_import_error

tests/all/linker.rs:28–43  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

26#[test]
27#[cfg_attr(miri, ignore)]
28fn test_unknown_import_error() -> Result<()> {
29 let mut store = Store::<()>::default();
30 let linker = Linker::new(store.engine());
31 let module = Module::new(
32 store.engine(),
33 r#"(module (import "unknown-module" "unknown-name" (func)))"#,
34 )?;
35 let err = linker
36 .instantiate(&mut store, &module)
37 .expect_err("should fail");
38 let unknown_import: UnknownImportError = err.downcast()?;
39 assert_eq!(unknown_import.module(), "unknown-module");
40 assert_eq!(unknown_import.name(), "unknown-name");
41 unknown_import.ty().unwrap_func();
42 Ok(())
43}
44
45#[test]
46fn link_twice_bad() -> Result<()> {

Callers

nothing calls this directly

Calls 7

OkFunction · 0.85
newFunction · 0.50
engineMethod · 0.45
instantiateMethod · 0.45
downcastMethod · 0.45
unwrap_funcMethod · 0.45
tyMethod · 0.45

Tested by

no test coverage detected