Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
bytecodealliance
GitHub Repository: bytecodealliance/wasmtime
Path: blob/main/tests/all/name.rs
1691 views
1
#![cfg(not(miri))]
2
3
use wasmtime::*;
4
5
#[test]
6
fn test_module_no_name() -> anyhow::Result<()> {
7
let engine = Engine::default();
8
let wat = r#"
9
(module
10
(func (export "run") (nop))
11
)
12
"#;
13
14
let module = Module::new(&engine, wat)?;
15
assert_eq!(module.name(), None);
16
17
Ok(())
18
}
19
20
#[test]
21
fn test_module_name() -> anyhow::Result<()> {
22
let engine = Engine::default();
23
let wat = r#"
24
(module $from_name_section
25
(func (export "run") (nop))
26
)
27
"#;
28
29
let module = Module::new(&engine, wat)?;
30
assert_eq!(module.name(), Some("from_name_section"));
31
32
Ok(())
33
}
34
35