Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / fpc-pascal / 2018-11

Running tests with FPC units only

3 messages · 2 people ·

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

luciano de souza

Hello hall,
I am blind, so I don't use Lazarus. In pure Freepascal, I tried to run an example test:

program tester;
{$mode objfpc}{$H+}
uses
fpcunit, testregistry;
type
TMyTest = class(TTestCase)
published
procedure TestSomething;
end;
procedure TMyTest.TestSomething;
begin
AssertEquals(1, 1);
end;
BEGIN
RegisterTest(TMyTest);
END.

This code compiles, but doesn't do anything. Here tests were only registered, not run.
For this purpose, acording example I found in FPC examples directory, I need the class TTestRunner.

BEGIN
with TTestRunner.create(nil) do
begin
try
initialize;
run;
finally
free;
end;
end;
END.

However, TTestRunner belongs to consoletestrunner, a non Freepascal unit. I imagine there is a way to run tests only with Freepascal units. But how to do this without consoletestrunner, a unit found in Lazarus? Best regards,

Luciano de Souza
luciano de souza
to leledumbo

What a shame! I shouldn't be so inattentive! Sorry, you are completely right!

2018-11-11 16:57 GMT-02:00, leledumbo via fpc-pascal :

Show quoted text 14 lines
> acording example I found in FPC examples directory, Check the one here instead: $(fpcsrcdir)/packages/fcl-fpcunit/src/demo/consolerunner/testrunner.pp It depends only on FPC units. I guess you're looking at examples from Lazarus directory instead of FPC. -- Sent from: http://free-pascal-general.1045716.n5.nabble.com/ _______________________________________________ fpc-pascal maillist - http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Luciano de Souza