@@ -86,3 +86,45 @@ async fn component_func_call_async() -> Result<()> {
8686 } )
8787 . await
8888}
89+
90+ #[ tokio:: test]
91+ async fn component_typed_func_call_async ( ) -> Result < ( ) > {
92+ let component_bytes = {
93+ let mut config = Config :: new ( ) ;
94+ config. concurrency_support ( false ) ;
95+ let engine = Engine :: new ( & config) ?;
96+ Component :: new (
97+ & engine,
98+ r#"
99+ (component
100+ (core module $m
101+ (func (export "id") (param i32) (result i32) (local.get 0))
102+ )
103+ (core instance $i (instantiate $m))
104+ (func (export "id") (param "x" s32) (result s32)
105+ (canon lift (core func $i "id"))
106+ )
107+ )
108+ "# ,
109+ ) ?
110+ . serialize ( ) ?
111+ } ;
112+ let mut config = Config :: new ( ) ;
113+ config. enable_compiler ( false ) ;
114+ config. concurrency_support ( false ) ;
115+ let engine = Engine :: new ( & config) ?;
116+ let component = unsafe { Component :: deserialize ( & engine, & component_bytes) ? } ;
117+ let linker = Linker :: < ( ) > :: new ( & engine) ;
118+ let instance_pre = linker. instantiate_pre ( & component) ?;
119+
120+ OomTest :: new ( )
121+ . test_async ( || async {
122+ let mut store = Store :: try_new ( & engine, ( ) ) ?;
123+ let instance = instance_pre. instantiate_async ( & mut store) . await ?;
124+ let id = instance. get_typed_func :: < ( i32 , ) , ( i32 , ) > ( & mut store, "id" ) ?;
125+ let result = id. call_async ( & mut store, ( 42 , ) ) . await ?;
126+ assert_eq ! ( result, ( 42 , ) ) ;
127+ Ok ( ( ) )
128+ } )
129+ . await
130+ }
0 commit comments