Browse Source

+ some basic tests for WebAssembly funcref types added

Nikolay Nikolov 2 years ago
parent
commit
fcd5ecfcce
2 changed files with 68 additions and 0 deletions
  1. 34 0
      tests/test/wasm/twasmfuncref1.pp
  2. 34 0
      tests/test/wasm/twasmfuncref1a.pp

+ 34 - 0
tests/test/wasm/twasmfuncref1.pp

@@ -0,0 +1,34 @@
+{ %cpu=wasm32 }
+{ %norun }
+
+program twasmfuncref1;
+
+{$MODE fpc}
+
+type
+  TWasmFuncRef = function(a: longint; b: int64): longint; WasmFuncRef;
+
+procedure testproc;
+var
+  p: TWasmFuncRef;
+begin
+end;
+
+procedure testproc2(q: TWasmFuncRef);
+begin
+end;
+
+function testproc3: TWasmFuncRef;
+begin
+end;
+
+function testproc4(a, b, c: longint; d: TWasmFuncRef; e: int64): TWasmFuncRef;
+var
+  q: TWasmFuncRef;
+begin
+  q := d;
+  testproc4 := q;
+end;
+
+begin
+end.

+ 34 - 0
tests/test/wasm/twasmfuncref1a.pp

@@ -0,0 +1,34 @@
+{ %cpu=wasm32 }
+{ %norun }
+
+program twasmfuncref1;
+
+{$MODE tp}
+
+type
+  TWasmFuncRef = function(a: longint; b: int64): longint; WasmFuncRef;
+
+procedure testproc;
+var
+  p: TWasmFuncRef;
+begin
+end;
+
+procedure testproc2(q: TWasmFuncRef);
+begin
+end;
+
+function testproc3: TWasmFuncRef;
+begin
+end;
+
+function testproc4(a, b, c: longint; d: TWasmFuncRef; e: int64): TWasmFuncRef;
+var
+  q: TWasmFuncRef;
+begin
+  q := d;
+  testproc4 := q;
+end;
+
+begin
+end.