diff options
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/projects/pascal/console/src/main.pas | 4 | ||||
| -rw-r--r-- | tests/projects/pascal/console/xmake.lua | 5 | ||||
| -rw-r--r-- | tests/projects/pascal/shared/src/foo.pas | 23 | ||||
| -rw-r--r-- | tests/projects/pascal/shared/src/main.pas | 14 | ||||
| -rw-r--r-- | tests/projects/pascal/shared/xmake.lua | 9 |
5 files changed, 55 insertions, 0 deletions
diff --git a/tests/projects/pascal/console/src/main.pas b/tests/projects/pascal/console/src/main.pas new file mode 100644 index 000000000..a908ffab7 --- /dev/null +++ b/tests/projects/pascal/console/src/main.pas @@ -0,0 +1,4 @@ +program Hello; +begin + writeln ('Hello, world.'); +end. diff --git a/tests/projects/pascal/console/xmake.lua b/tests/projects/pascal/console/xmake.lua new file mode 100644 index 000000000..32fd531a2 --- /dev/null +++ b/tests/projects/pascal/console/xmake.lua @@ -0,0 +1,5 @@ +add_rules("mode.debug", "mode.release") +target("test") + set_kind("binary") + add_files("src/*.pas") + diff --git a/tests/projects/pascal/shared/src/foo.pas b/tests/projects/pascal/shared/src/foo.pas new file mode 100644 index 000000000..d1952cf21 --- /dev/null +++ b/tests/projects/pascal/shared/src/foo.pas @@ -0,0 +1,23 @@ +library foo; + +function SubStr(CString: PChar;FromPos,ToPos: Longint): PChar; cdecl; + +var + Length: Integer; + +begin + Length := StrLen(CString); + SubStr := CString + Length; + if (FromPos > 0) and (ToPos >= FromPos) then + begin + if Length >= FromPos then + SubStr := CString + FromPos; + if Length > ToPos then + CString[ToPos+1] := #0; + end; +end; + +exports + SubStr; + +end. diff --git a/tests/projects/pascal/shared/src/main.pas b/tests/projects/pascal/shared/src/main.pas new file mode 100644 index 000000000..ccf2e179b --- /dev/null +++ b/tests/projects/pascal/shared/src/main.pas @@ -0,0 +1,14 @@ +uses strings; + +function SubStr(const CString: PChar; FromPos, ToPos: longint): PChar; + cdecl; external 'foo'; + +var + s: PChar; + FromPos, ToPos: Integer; +begin + s := strnew('TestMe'); + FromPos := 2; + ToPos := 3; + WriteLn(SubStr(s, FromPos, ToPos)); +end. diff --git a/tests/projects/pascal/shared/xmake.lua b/tests/projects/pascal/shared/xmake.lua new file mode 100644 index 000000000..d96c29d5f --- /dev/null +++ b/tests/projects/pascal/shared/xmake.lua @@ -0,0 +1,9 @@ +add_rules("mode.debug", "mode.release") +target("foo") + set_kind("shared") + add_files("src/foo.pas") + +target("test") + set_kind("binary") + add_deps("foo") + add_files("src/main.pas") |
