This commit builds on bytecodealliance/wasm-tools#690 to add support to testing of the component model to execute functions when running `*.wast` files. This support is all built on #4442 as functions are invoked through a "dynamic" API. Right now the testing and integration is fairly crude but I'm hoping that we can try to improve it over time as necessary. For now this should provide a hopefully more convenient syntax for unit tests and the like.
43 lines
780 B
Plaintext
43 lines
780 B
Plaintext
(component)
|
|
|
|
(component
|
|
(core module)
|
|
)
|
|
|
|
(component
|
|
(core module)
|
|
(core module)
|
|
(core module)
|
|
)
|
|
|
|
(component
|
|
(core module
|
|
(func (export "a") (result i32) i32.const 0)
|
|
(func (export "b") (result i64) i64.const 0)
|
|
)
|
|
(core module
|
|
(func (export "c") (result f32) f32.const 0)
|
|
(func (export "d") (result f64) f64.const 0)
|
|
)
|
|
)
|
|
|
|
(assert_invalid
|
|
(component
|
|
(import "" (component))
|
|
)
|
|
"root-level component imports are not supported")
|
|
|
|
(assert_invalid
|
|
(component
|
|
(component (export ""))
|
|
)
|
|
"exporting a component from the root component is not supported")
|
|
|
|
(component
|
|
(core module $m (func (export "")))
|
|
(core instance $m (instantiate $m))
|
|
(func (export "") (canon lift (core func $m "")))
|
|
)
|
|
|
|
(assert_return (invoke "") (unit.const))
|