Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FPC Support and Tests #6

Merged
merged 7 commits into from
Apr 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 24 additions & 0 deletions .github/workflows/test-fpc.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
name: Test FPC

on: [push, pull_request]

jobs:
test:
runs-on: ubuntu-22.04

steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Install prerequisites
run: |
export DEBIAN_FRONTEND=noninteractive
sudo apt-get update
sudo apt-get install -y fpc-3.2.2
- name: Build testsuite
run: |
cd Tests
fpc -B -MDelphi "Underscore.Delphi.Springless.Tests.dpr"
- name: Test
run: Tests/Underscore.Delphi.Springless.Tests -a --format=plain
55 changes: 55 additions & 0 deletions Tests/DUnitX.Stub.pas
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
unit DUnitX.Stub;

interface

uses
fpcunit;

type
Assert = class
public
class procedure IsTrue(const Value: Boolean);
class procedure IsFalse(const Value: Boolean);
class procedure AreEqual(const Expected, Value: Integer); overload;
class procedure AreEqual(const Expected, Value: string); overload;
class procedure Pass;
class procedure Fail;
end;

implementation

uses
testutils,
SysUtils;

class procedure Assert.IsTrue(const Value: Boolean);
begin
TAssert.AssertTrue(Value);
end;

class procedure Assert.IsFalse(const Value: Boolean);
begin
TAssert.AssertFalse(Value);
end;

class procedure Assert.AreEqual(const Expected, Value: Integer); overload;
begin
TAssert.AssertEquals(Expected, Value);
end;

class procedure Assert.AreEqual(const Expected, Value: string); overload;
begin
TAssert.AssertEquals(Expected, Value);
end;

class procedure Assert.Pass;
begin
// do nothing
end;

class procedure Assert.Fail;
begin
TAssert.Fail('Failed');
end;

end.
Loading