File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -1310,4 +1310,31 @@ mod tests {
13101310 "invalid offset or size"
13111311 ) ;
13121312 }
1313+
1314+ #[ test]
1315+ fn execute_host_function ( ) {
1316+ /* wat2wasm
1317+ (module
1318+ (func $adler32 (import "env" "adler32") (param i32 i32) (result i32))
1319+ (memory (export "memory") 1)
1320+ (data (i32.const 0) "abcd")
1321+ (func (export "test") (result i32)
1322+ i32.const 0
1323+ i32.const 4
1324+ call $adler32
1325+ )
1326+ )
1327+ */
1328+ let input = hex:: decode (
1329+ "0061736d01000000010b0260027f7f017f6000017f020f0103656e760761646c657233320000030201010503010001071102066d656d6f72790200047465737400010a0a0108004100410410000b0b0a010041000b0461626364" ) . unwrap ( ) ;
1330+
1331+ let module = parse ( & input) ;
1332+ assert ! ( module. is_ok( ) ) ;
1333+ let instance = module. unwrap ( ) . instantiate ( ) ;
1334+ assert ! ( instance. is_err( ) ) ;
1335+ assert_eq ! (
1336+ instance. err( ) . unwrap( ) ,
1337+ "module requires 1 imported functions, 0 provided"
1338+ ) ;
1339+ }
13131340}
You can’t perform that action at this time.
0 commit comments