Discussion:
[fpc-pascal] Running tests with FPC units only
luciano de souza
2018-11-11 17:29:31 UTC
Permalink
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
_______________________________________________
fpc-pascal maillist - fpc-***@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo
leledumbo via fpc-pascal
2018-11-11 18:57:00 UTC
Permalink
Post by luciano de souza
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 - fpc-***@lists.freepascal.org
http://lists.freepascal.or
luciano de souza
2018-11-11 20:49:03 UTC
Permalink
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
Post by leledumbo via fpc-pascal
Post by luciano de souza
acording example I found in FPC examples directory,
$(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/
_______________________________________________
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
--
Luciano de Souza
_______________________________________________
fpc-pascal maillist - fpc-***@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/l
Loading...