<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
<title></title>
</head>
<body text="#000000" bgcolor="#ffffff">
Michael,<br>
<br>
I have a meaningful peculiarity: I am blind and I use Freepascal
only in the console interface, reading all the output by means of my
screen reader. Lazarus and Freepascal console IDE are both
inaccessible. But, fortunately, for me, it's easy to call the
compiler passing parameters at the command line.<br>
<br>
I can compile using callings like:<br>
fpc test.pas<br>
fpc -XX test.pas<br>
fpc test.pas -Fu./pas -FE./exe<br>
<br>
I really thank Freepascal developers. The reachness of its command
line allow me to access the features of the compiler.<br>
<br>
For these reasons, it's not possible to open Lazarus and compile the
project using its interface. My screen reader has an awful response
in this environment.<br>
<br>
After reading your message, I ask for a help. A friend told me
fpcunit depends on FPCUnitConsole... Well, I don't remember exactly
the name, but it's a Lazarus package.<br>
<br>
Observe I need to compile in the console. If it's possible to run
the executable, but it's not possible to compile in the command
line, I won't be able to use FPCUnit.<br>
<br>
You said that I need to use '--format=plain' '--all'. I tried:<br>
fpc apptest.pas --format=plain -all<br>
And also:<br>
fpc apptest<br>
apptest --format=plain -alll<br>
But, in both cases, I got no result.<br>
I don't know how to embody this parameters in my compilation tasks.<br>
<br>
So I ask you: Is it possible to use FPCUnit only in the command
line, it means, compiling and executing in console?<br>
<br>
The idea of FPCUnit is really wonderful. I really would like to use
it, but Lazarus dependences can complicate a lot.<br>
<br>
Em 17/12/2011 11:02, Michael Van Canneyt escreveu:
<blockquote
cite="mid:alpine.DEB.2.00.1112171357040.11198@home.telenet.be"
type="cite">
<br>
You see no test results, because the program file of your test
application is missing some essential things.
<br>
<br>
If you are using lazarus, simply create a new testing application:
<br>
<br>
First, make sure that package fpcunitide is installed.
<br>
<br>
Then, in the 'File-New' dialog, your testproject should be of type
<br>
<br>
'FPCUNit console test application'
<br>
or
<br>
'FPCUnit test application'
<br>
<br>
This will install a test decorator which prints out the result.
<br>
Then add your test unit to this application.
<br>
<br>
If you run the console test application on the command-line,
<br>
specify options '--format=plain' and '--all'
<br>
<br>
The graphical application will show test results in a tree.
<br>
<br>
Michael.
<br>
<br>
On Sat, 17 Dec 2011, Luciano de Souza wrote:
<br>
<br>
<blockquote type="cite">The article is very good, but it does not
focuse on all aspects.
<br>
<br>
I have tried to create my first test example, but it didn't
work. The compilation is successful and the program is executed
without errors. However, I
<br>
received no messages, informing the test has failed. Actually,
the test should be failed.
<br>
<br>
This example is seemingly equivalent the minimum example
supplied by the article.
<br>
<br>
As recommended, I only add the unit "test" in the clause "uses",
so the test was expected to run. Does someone know what is
wrong?
<br>
<br>
First of all, a unit with a routine to be tested:
<br>
<br>
unit numbers;
<br>
{$mode objfpc}{$h+}
<br>
<br>
interface
<br>
uses
<br>
Sysutils;
<br>
<br>
function calculate(a, b: integer):integer;
<br>
implementation
<br>
<br>
function calculate(a, b: integer):integer;
<br>
begin
<br>
result := a + b;
<br>
end;
<br>
<br>
INITIALIZATION
<br>
END.
<br>
<br>
Now, my testcase class:
<br>
<br>
unit test;
<br>
{$mode objfpc}{$h+}
<br>
<br>
interface
<br>
numbers, fpcunit, testregistry;
<br>
uses
<br>
<br>
type
<br>
TBugTest = class(TTestCase)
<br>
published
<br>
procedure calculate;
<br>
end;
<br>
<br>
implementation
<br>
procedure TBugTest.calculate;
<br>
begin
<br>
AssertEquals('The calculation is not done', 8,
numbers.calculate(5, 4));
<br>
end;
<br>
<br>
INITIALIZATION
<br>
RegisterTest(TBugTest);
<br>
END.
<br>
<br>
Now, the runer:
<br>
<br>
program apptest;
<br>
{$mode objfpc}{$h+}
<br>
<br>
uses
<br>
test;
<br>
<br>
begin
<br>
end.
<br>
<br>
Em 16/12/2011 11:44, Michael Van Canneyt escreveu:
<br>
<br>
<br>
On Fri, 16 Dec 2011, Vincent Snijders wrote:
<br>
<br>
2011/12/16 luciano de souza
<a class="moz-txt-link-rfc2396E" href="mailto:luchyanus@gmail.com"><luchyanus@gmail.com></a>:
<br>
Hello listers,
<br>
<br>
Navigating in FPC source codes, I found
fpcunit. It's really
<br>
wonderful. With the tTestCase class, we can
generate a report with
<br>
the success or the failure of our tests.
<br>
<br>
Is there documentation on the usage of
fpcunit? What is the best way
<br>
to study it?
<br>
<br>
<br>
Google found this (old) article:
<br>
<a class="moz-txt-link-freetext" href="http://www.freepascal.org/olddocs-html/fpcunit.pdf">http://www.freepascal.org/olddocs-html/fpcunit.pdf</a>
<br>
<br>
<br>
It is old, but still correct.
<br>
<br>
I will see about refreshing it, and adding it in the FPC
documentation.
<br>
<br>
Michael.
<br>
<br>
<br>
_______________________________________________
<br>
fpc-pascal maillist - <a class="moz-txt-link-abbreviated" href="mailto:fpc-pascal@lists.freepascal.org">fpc-pascal@lists.freepascal.org</a>
<br>
<a class="moz-txt-link-freetext" href="http://lists.freepascal.org/mailman/listinfo/fpc-pascal">http://lists.freepascal.org/mailman/listinfo/fpc-pascal</a>
<br>
<br>
<br>
<br>
--
<br>
Luciano de Souza
<br>
<br>
<br>
</blockquote>
<pre wrap="">
<fieldset class="mimeAttachmentHeader"></fieldset>
_______________________________________________
fpc-pascal maillist - <a class="moz-txt-link-abbreviated" href="mailto:fpc-pascal@lists.freepascal.org">fpc-pascal@lists.freepascal.org</a>
<a class="moz-txt-link-freetext" href="http://lists.freepascal.org/mailman/listinfo/fpc-pascal">http://lists.freepascal.org/mailman/listinfo/fpc-pascal</a></pre>
</blockquote>
<br>
<br>
<div class="moz-signature">-- <br>
Luciano de Souza</div>
</body>
</html>