James Testing unit
Closed this issue · 4 comments
mdbs99 commented
Let's create a new unit to do the cross compile between FPC/Lazarus and Delphi.
We should encapsulate units that are used and test registrations.
Please, see this #56 (comment) for more information.
mdbs99 commented
This issue is awaiting resolution of this #62 (comment)
mdbs99 commented
@nunopicado let's think how to resolve the generic syntax issue.
Why not a simple composition like below?
TTest = class sealed(TInterfacedObject, ITest)
private
FTestCase: TTestCase;
public
constructor Create(TestCase: TTestCase);
class function New(TestCase: TTestCase): ITest;
destructor Destroy; override;
function RegisterOn(const SuitePath: string): ITest;
end;
implementation
{ TTest }
constructor TTest.Create(TestCase: TTestCase);
begin
inherited Create;
FTestCase := TestCase
end;
class function TTest.New((TestCase: TTestCase)): ITest;
begin
Result := Create(TestCase);
end;
// fpc ---------------
function TTest.RegisterOn(const SuitePath: string): ITest;
begin
Result := Self;
TestRegistry.RegisterTest(SuitePath, FTestCase);
end;
// delphi ---------------
function TTest.RegisterOn(const SuitePath: string): ITest;
begin
Result := Self;
TestFramework.RegisterTest(SuitePath, FTestCase.Suite);
end;
If you allow me to change your original idea, I can code this.
What you say?
nunopicado commented
Please, do try. I will not be able to work on this today, so if you can, we can advance this issue.
mdbs99 commented
Done.