@@ -21,11 +21,15 @@ let harness =
21
21
" function is_funcref(x) {\n " ^
22
22
" return typeof x === \" function\" ? 1 : 0;\n " ^
23
23
" }\n " ^
24
+ " function eq_ref(x, y) {\n " ^
25
+ " return x === y ? 1 : 0;\n " ^
26
+ " }\n " ^
24
27
" \n " ^
25
28
" let spectest = {\n " ^
26
29
" hostref: hostref,\n " ^
27
30
" is_hostref: is_hostref,\n " ^
28
31
" is_funcref: is_funcref,\n " ^
32
+ " eq_ref: eq_ref,\n " ^
29
33
" print: console.log.bind(console),\n " ^
30
34
" print_i32: console.log.bind(console),\n " ^
31
35
" print_i32_f32: console.log.bind(console),\n " ^
@@ -83,7 +87,7 @@ let harness =
83
87
" }\n " ^
84
88
" \n " ^
85
89
" function exports(instance) {\n " ^
86
- " return {module: instance.exports, host: {ref: hostref} };\n " ^
90
+ " return {module: instance.exports, spectest: spectest };\n " ^
87
91
" }\n " ^
88
92
" \n " ^
89
93
" function run(action) {\n " ^
@@ -327,7 +331,6 @@ let assert_return_func ts at =
327
331
let wrap item_name wrap_action wrap_assertion at =
328
332
let itypes, idesc, action = wrap_action at in
329
333
let locals, assertion = wrap_assertion at in
330
- let item = Lib.List32. length itypes @@ at in
331
334
let types =
332
335
(FuncType ([] , [] ) @@ at) ::
333
336
(FuncType ([NumType I32Type ], [RefType AnyRefType ]) @@ at) ::
@@ -347,6 +350,12 @@ let wrap item_name wrap_action wrap_assertion at =
347
350
{module_name = Utf8. decode " spectest" ; item_name = Utf8. decode " eq_ref" ;
348
351
idesc = FuncImport (4l @@ at) @@ at} @@ at ]
349
352
in
353
+ let item =
354
+ List. fold_left
355
+ (fun i im ->
356
+ match im.it.idesc.it with FuncImport _ -> Int32. add i 1l | _ -> i
357
+ ) 0l imports @@ at
358
+ in
350
359
let edesc = FuncExport item @@ at in
351
360
let exports = [{name = Utf8. decode " run" ; edesc} @@ at] in
352
361
let body =
0 commit comments