Re: [fpc-pascal] The testcase example doesn't generate plain text report
Graeme, Between my message and yours, I found your TestFramework. It worked imediately, I liked, so I changed from FPCUnit to TestFramework. In examples, I used check, checkequals, fail... Excelent! The single feature I couldn't understand is "CheckException". I have this code: procedure TGroupTest.InsertRecord; begin FGroup.name = 'Geography'; FMapper.add(FGroup); FMapper.apply; end; An exception can be raised in "FMapper.apply", but I could understand the usage of CheckException. The TestFramework, running only with this code, says that no errors were found, but alerts to the fact that no tests were done in this method of the Testcase. 2016-11-15 7:06 GMT-02:00, luciano de souza : > Hello all, > I am trying to run testcases. > For testing the idea, I compile the example contained in: > > ./fpc-3.0.0/packages/fcl-fpcunit > > The compilation was successful. > > As I am blind, the XML format is very unpleasant becose the output is > too verbose. > > So I runned the test with the following commandline: > > ./testrunner -a --format=plain > > However, the output produced was in XML. > > What am I doing wrong. > > See the output: > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > 62 > 0 > 0 > > > > > -- > Luciano de Souza > -- Luciano de Souza ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] The testcase example doesn't generate plain text report
On 2016-11-16 11:38, luciano de souza wrote: > Between my message and yours, I found your TestFramework. It worked > imediately, I liked, so I changed from FPCUnit to TestFramework. Excellent. It works many times faster than FPCUnit, and has many more features too. It even has a FPCUnit compatibility API, in case you need to share your test code with FPCUnit and FPTest frameworks. > feature I couldn't understand is "CheckException". CheckException takes a method pointer, Exception class and optional error message as parameters. So to use CheckException, you need to define a method in your test class that will cause the exception you want to test. Then pass that method as the first parameter. The second parameter is the exception class you expected to occur. For example: procedure TGroupTest.RaiseApplyException; begin // Do whatever you need to cause the exception you want to // test. eg: FMapper.Apply(); // I'm simply raising an exception as a simple example. raise EDivByZero.Create('Forced EDivByZero'); end; procedure TGroupTest.InsertRecord; begin FGroup.Name := 'Geography'; FMapper.Add(FGroup); CheckException(RaiseApplyException, EDivByZero, 'failed on 1'); end; Using CheckException is optional though. Alternatively you could use a try..except block in the test method. Whichever one is easier to read and code. Here is the alternative example: procedure TGroupTest.InsertRecord; begin FGroup.Name := 'Geography'; FMapper.Add(FGroup); try FMapper.Apply; // this should raise an exception Fail('Failed on 1 - we should never have reached here'); except on E: Exception do CheckEquals('EDivByZero', E.ClassName, 'failed on 2'); end; end; I hope that helps. On a side note: The FPTest testing framework has a dedicated support newsgroup. Articles also never expire, so you can easily search past messages for any questions you might have. To connect to the support newsgroup you can use any NNTP news client (eg: Thunderbird, XanaNews, tin, Alpine etc) and the connections details are: Server name: geldenhuys.co.uk Newsgroup:fptest.support Regards, Graeme -- fpGUI Toolkit - a cross-platform GUI toolkit using Free Pascal http://fpgui.sourceforge.net/ My public PGP key: http://tinyurl.com/graeme-pgp ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
[fpc-pascal] can a class implement both a CORBA interface and an COM interface at the same time?
I have a class implementing a Com interface. Now I want it to also implement a CORBA interface. Is it dangerous? Dennis ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
[fpc-pascal] docs for TStringList.CaseSensitive seem incomplete
Hi, I did some testing and it seems the CaseSensitive property also has an affect on the Sort() method. Yet the documentation only lists that the property affects locating of strings. http://www.freepascal.org/docs-html/current/rtl/classes/tstringlist.casesensitive.html ...versus the Delphi help, which explicitly mentions actions like locate, sort and identify (eg: duplicates). http://docwiki.embarcadero.com/Libraries/Berlin/en/System.Classes.TStringList.CaseSensitive Here is the results of my test application: With CaseSensitive = True == $ ./project1 GSUB OS/2 cmap cvt fpgm glyf head hhea loca prep With CaseSensitive = False == $ ./project1 cmap cvt fpgm glyf GSUB head hhea loca OS/2 prep So CaseSensitive = True definitely affects sorting too, not just locating strings. But will this always be true for TStringList, or could the implementation change (hence some details omitted from the documentation). The complete test application: program project1; {$mode objfpc}{$H+} uses Classes, Sysutils; var sl: TStringList; i: integer; begin sl := TStringList.Create; sl.Add('fpgm'); sl.Add('cvt '); sl.Add('head'); sl.Add('glyf'); sl.Add('cmap'); sl.Add('hhea'); sl.Add('OS/2'); sl.Add('prep'); sl.Add('GSUB'); sl.Add('loca'); // sl.CaseSensitive := True; sl.Sort; for i := 0 to sl.Count-1 do writeln(sl[i]); sl.Free; end. Regards, Graeme -- fpGUI Toolkit - a cross-platform GUI toolkit using Free Pascal http://fpgui.sourceforge.net/ My public PGP key: http://tinyurl.com/graeme-pgp ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal