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

Function components_importing_modules

tests/all/component_model.rs:100–156  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

98#[test]
99#[cfg_attr(miri, ignore)]
100fn components_importing_modules() -> Result<()> {
101 let engine = engine();
102
103 // FIXME: these components should actually get instantiated in `*.wast`
104 // tests once supplying imports has actually been implemented.
105
106 Component::new(
107 &engine,
108 r#"
109 (component
110 (import "a" (core module))
111 )
112 "#,
113 )?;
114
115 Component::new(
116 &engine,
117 r#"
118 (component
119 (import "a" (core module $m1
120 (import "" "" (func))
121 (import "" "x" (global i32))
122
123 (export "a" (table 1 funcref))
124 (export "b" (memory 1))
125 (export "c" (func (result f32)))
126 (export "d" (global i64))
127 ))
128
129 (core module $m2
130 (func (export ""))
131 (global (export "x") i32 i32.const 0)
132 )
133 (core instance $i2 (instantiate (module $m2)))
134 (core instance $i1 (instantiate (module $m1) (with "" (instance $i2))))
135
136 (core module $m3
137 (import "mod" "1" (memory 1))
138 (import "mod" "2" (table 1 funcref))
139 (import "mod" "3" (global i64))
140 (import "mod" "4" (func (result f32)))
141 )
142
143 (core instance $i3 (instantiate (module $m3)
144 (with "mod" (instance
145 (export "1" (memory $i1 "b"))
146 (export "2" (table $i1 "a"))
147 (export "3" (global $i1 "d"))
148 (export "4" (func $i1 "c"))
149 ))
150 ))
151 )
152 "#,
153 )?;
154
155 Ok(())
156}
157

Callers

nothing calls this directly

Calls 3

OkFunction · 0.85
engineFunction · 0.70
newFunction · 0.50

Tested by

no test coverage detected