From fcd5ecfcce4968f96c2fa38880d5dcdbbf7a55e3 Mon Sep 17 00:00:00 2001 From: Nikolay Nikolov Date: Sun, 11 Jun 2023 04:27:05 +0300 Subject: [PATCH] + some basic tests for WebAssembly funcref types added --- tests/test/wasm/twasmfuncref1.pp | 34 +++++++++++++++++++++++++++++++ tests/test/wasm/twasmfuncref1a.pp | 34 +++++++++++++++++++++++++++++++ 2 files changed, 68 insertions(+) create mode 100644 tests/test/wasm/twasmfuncref1.pp create mode 100644 tests/test/wasm/twasmfuncref1a.pp diff --git a/tests/test/wasm/twasmfuncref1.pp b/tests/test/wasm/twasmfuncref1.pp new file mode 100644 index 0000000000..8426fbb6c8 --- /dev/null +++ b/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. diff --git a/tests/test/wasm/twasmfuncref1a.pp b/tests/test/wasm/twasmfuncref1a.pp new file mode 100644 index 0000000000..cdc25c1c93 --- /dev/null +++ b/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.