This continues #788 and literally removes the type from the public API of the `wasmtime` crate, making it inaccessible to the outside world. Now it's purely an implementation detail, yay!
39 lines
836 B
Rust
39 lines
836 B
Rust
use wasmtime::*;
|
|
|
|
#[test]
|
|
fn test_module_no_name() -> anyhow::Result<()> {
|
|
let store = Store::default();
|
|
let binary = wat::parse_str(
|
|
r#"
|
|
(module
|
|
(func (export "run") (nop))
|
|
)
|
|
"#,
|
|
)?;
|
|
|
|
let module = Module::new(&store, &binary)?;
|
|
assert_eq!(module.name(), None);
|
|
|
|
Ok(())
|
|
}
|
|
|
|
#[test]
|
|
fn test_module_name() -> anyhow::Result<()> {
|
|
let store = Store::default();
|
|
let binary = wat::parse_str(
|
|
r#"
|
|
(module $from_name_section
|
|
(func (export "run") (nop))
|
|
)
|
|
"#,
|
|
)?;
|
|
|
|
let module = Module::new(&store, &binary)?;
|
|
assert_eq!(module.name(), Some("from_name_section"));
|
|
|
|
let module = Module::new_with_name(&store, &binary, "override")?;
|
|
assert_eq!(module.name(), Some("override"));
|
|
|
|
Ok(())
|
|
}
|