Browse Source

* Moved fpcunit to inc, added testresult writers from Dean Zobec

git-svn-id: trunk@6190 -
michael 18 years ago
parent
commit
fe8a3dbfe7

+ 9 - 3
.gitattributes

@@ -787,12 +787,13 @@ fcl/dbtests/testbasics.pas svneol=native#text/plain
 fcl/dbtests/testdbbasics.pas -text
 fcl/dbtests/testsqlfieldtypes.pas -text
 fcl/dbtests/toolsunit.pas -text
-fcl/fpcunit/DUnitCompatibleInterface.inc svneol=native#text/plain
 fcl/fpcunit/Makefile svneol=native#text/plain
 fcl/fpcunit/Makefile.fpc svneol=native#text/plain
 fcl/fpcunit/README.txt svneol=native#text/plain
 fcl/fpcunit/demo/consolerunner/suiteconfig.pp svneol=native#text/plain
 fcl/fpcunit/demo/consolerunner/testrunner.pp svneol=native#text/plain
+fcl/fpcunit/example_output/results.pdf -text
+fcl/fpcunit/example_output/results.txt svneol=native#text/plain
 fcl/fpcunit/example_xsl/fpcunit.css svneol=native#text/plain
 fcl/fpcunit/example_xsl/fpcunit.xsl svneol=native#text/plain
 fcl/fpcunit/example_xsl/readme.txt svneol=native#text/plain
@@ -802,9 +803,11 @@ fcl/fpcunit/exampletests/fpcunittests.pp svneol=native#text/plain
 fcl/fpcunit/exampletests/money.pp svneol=native#text/plain
 fcl/fpcunit/exampletests/moneytest.pp svneol=native#text/plain
 fcl/fpcunit/exampletests/testmockobject.pp svneol=native#text/plain
-fcl/fpcunit/fpcunit.pp svneol=native#text/plain
+fcl/fpcunit/fpcunitreport.pp svneol=native#text/plain
 fcl/fpcunit/fpmake.inc svneol=native#text/plain
 fcl/fpcunit/fpmake.pp svneol=native#text/plain
+fcl/fpcunit/latextestreport.pp svneol=native#text/plain
+fcl/fpcunit/plaintestreport.pp svneol=native#text/plain
 fcl/fpcunit/testdecorator.pp svneol=native#text/plain
 fcl/fpcunit/testregistry.pp svneol=native#text/plain
 fcl/fpcunit/testreport.pp svneol=native#text/plain
@@ -813,9 +816,9 @@ fcl/fpcunit/tests/Makefile.fpc svneol=native#text/plain
 fcl/fpcunit/tests/asserttest.pp svneol=native#text/plain
 fcl/fpcunit/tests/frameworktest.pp svneol=native#text/plain
 fcl/fpcunit/tests/suitetest.pp svneol=native#text/plain
-fcl/fpcunit/testutils.pp svneol=native#text/plain
 fcl/fpcunit/ubmockobject.pp svneol=native#text/plain
 fcl/fpcunit/xmlreporter.pas svneol=native#text/plain
+fcl/fpcunit/xmltestreport.pp svneol=native#text/plain
 fcl/fpmake.pp svneol=native#text/plain
 fcl/go32v2/custapp.inc svneol=native#text/plain
 fcl/go32v2/eventlog.inc svneol=native#text/plain
@@ -869,6 +872,7 @@ fcl/image/pixtools.pp svneol=native#text/plain
 fcl/image/pngcomn.pp svneol=native#text/plain
 fcl/image/pscanvas.pp svneol=native#text/plain
 fcl/image/targacmn.pp svneol=native#text/plain
+fcl/inc/DUnitCompatibleInterface.inc svneol=native#text/plain
 fcl/inc/avl_tree.pp svneol=native#text/plain
 fcl/inc/base64.pp svneol=native#text/plain
 fcl/inc/blowfish.pp svneol=native#text/plain
@@ -883,6 +887,7 @@ fcl/inc/eventlog.pp svneol=native#text/plain
 fcl/inc/ezcgi.pp svneol=native#text/plain
 fcl/inc/felog.inc svneol=native#text/plain
 fcl/inc/fpasync.pp svneol=native#text/plain
+fcl/inc/fpcunit.pp svneol=native#text/plain
 fcl/inc/fpmake.inc svneol=native#text/plain
 fcl/inc/fpmake.pp svneol=native#text/plain
 fcl/inc/gettext.pp svneol=native#text/plain
@@ -909,6 +914,7 @@ fcl/inc/streamcoll.pp svneol=native#text/plain
 fcl/inc/streamex.pp svneol=native#text/plain
 fcl/inc/streamio.pp svneol=native#text/plain
 fcl/inc/syncobjs.pp svneol=native#text/plain
+fcl/inc/testutils.pp svneol=native#text/plain
 fcl/inc/wformat.pp svneol=native#text/plain
 fcl/inc/whtml.pp svneol=native#text/plain
 fcl/inc/wtex.pp svneol=native#text/plain

File diff suppressed because it is too large
+ 85 - 424
fcl/Makefile


+ 9 - 3
fcl/Makefile.fpc

@@ -22,7 +22,9 @@ packages_emx=netdb
 
 # clean package units
 [clean]
-units=adler gzcrc gzio infblock infcodes inffast inftrees infutil minigzip paszlib trees zbase zcompres zdeflate zinflate zuncompr zutil pthreads streamio blowfish
+units=adler gzcrc gzio infblock infcodes inffast inftrees infutil\
+      minigzip paszlib trees zbase zcompres zdeflate zinflate\
+      zuncompr zutil pthreads streamio blowfish testutils fpcunit
 
 [target]
 dirs=xml image db shedit passrc net fpcunit
@@ -35,10 +37,12 @@ dirs_linux=web
 dirs_win32=web
 dirs_win64=web
 dirs_wince=web
+# Leave xmlreg and registry last, they require xml.
 units=contnrs inifiles ezcgi pipes rtfpars idea base64 gettext \
-      iostream zstream cachecls avl_tree htmldefs xmlreg registry \
+      iostream zstream cachecls avl_tree htmldefs testutils fpcunit \
       eventlog custapp cgiapp wformat whtml wtex rttiutils bufstream \
-      streamex blowfish zipper streamio inicol pooledmm libtar streamcoll
+      streamex blowfish zipper streamio inicol pooledmm libtar streamcoll \
+      xmlreg registry 
 units_freebsd=process ssockets resolve fpasync syncobjs simpleipc dbugmsg dbugintf
 units_darwin=process ssockets resolve fpasync syncobjs simpleipc dbugmsg dbugintf
 units_solaris=process ssockets resolve fpasync syncobjs simpleipc dbugmsg dbugintf
@@ -82,3 +86,5 @@ fpcdir=..
 xmlreg.pp: avl_tree$(PPUEXT) xml inc/xmlreg.pp
 
 dbugintf$(PPUEXT): dbugmsg.pp simpleipc.pp
+
+fpcunit$(PPUEXT): fpcunit.pp testutils.pp

+ 44 - 235
fcl/fpcunit/Makefile

@@ -1,8 +1,8 @@
 #
-# Don't edit, this file is generated by FPCMake Version 2.0.0 [2007/01/18]
+# Don't edit, this file is generated by FPCMake Version 2.0.0 [2006/08/20]
 #
 default: all
-MAKEFILETARGETS=i386-linux i386-go32v2 i386-win32 i386-os2 i386-freebsd i386-beos i386-netbsd i386-solaris i386-qnx i386-netware i386-openbsd i386-wdosx i386-darwin i386-emx i386-watcom i386-netwlibc i386-wince i386-embedded i386-symbian m68k-linux m68k-freebsd m68k-netbsd m68k-amiga m68k-atari m68k-openbsd m68k-palmos m68k-embedded powerpc-linux powerpc-netbsd powerpc-amiga powerpc-macos powerpc-darwin powerpc-morphos powerpc-embedded sparc-linux sparc-netbsd sparc-solaris sparc-embedded x86_64-linux x86_64-freebsd x86_64-win64 x86_64-embedded arm-linux arm-palmos arm-wince arm-gba arm-nds arm-embedded arm-symbian powerpc64-linux powerpc64-embedded
+MAKEFILETARGETS=i386-linux i386-go32v2 i386-win32 i386-os2 i386-freebsd i386-beos i386-netbsd i386-solaris i386-qnx i386-netware i386-openbsd i386-wdosx i386-darwin i386-emx i386-watcom i386-netwlibc i386-wince m68k-linux m68k-freebsd m68k-netbsd m68k-amiga m68k-atari m68k-openbsd m68k-palmos powerpc-linux powerpc-netbsd powerpc-amiga powerpc-macos powerpc-darwin powerpc-morphos sparc-linux sparc-netbsd sparc-solaris x86_64-linux x86_64-freebsd x86_64-win64 arm-linux arm-palmos arm-wince arm-gba powerpc64-linux
 BSDs = freebsd netbsd openbsd darwin
 UNIXs = linux $(BSDs) solaris qnx
 LIMIT83fs = go32v2 os2 emx watcom
@@ -233,157 +233,127 @@ PACKAGESDIR:=$(wildcard $(FPCDIR) $(FPCDIR)/packages/base $(FPCDIR)/packages/ext
 override PACKAGE_NAME=fcl
 PACKAGEDIR_MAIN:=$(firstword $(subst /Makefile.fpc,,$(strip $(wildcard $(addsuffix /fcl/Makefile.fpc,$(PACKAGESDIR))))))
 ifeq ($(FULL_TARGET),i386-linux)
-override TARGET_UNITS+=fpcunit testregistry testreport testutils testdecorator ubmockobject xmlreporter
+override TARGET_UNITS+=testregistry testreport testdecorator ubmockobject xmlreporter fpcunitreport latextestreport xmltestreport plaintestreport
 endif
 ifeq ($(FULL_TARGET),i386-go32v2)
-override TARGET_UNITS+=fpcunit testregistry testreport testutils testdecorator ubmockobject xmlreporter
+override TARGET_UNITS+=testregistry testreport testdecorator ubmockobject xmlreporter fpcunitreport latextestreport xmltestreport plaintestreport
 endif
 ifeq ($(FULL_TARGET),i386-win32)
-override TARGET_UNITS+=fpcunit testregistry testreport testutils testdecorator ubmockobject xmlreporter
+override TARGET_UNITS+=testregistry testreport testdecorator ubmockobject xmlreporter fpcunitreport latextestreport xmltestreport plaintestreport
 endif
 ifeq ($(FULL_TARGET),i386-os2)
-override TARGET_UNITS+=fpcunit testregistry testreport testutils testdecorator ubmockobject xmlreporter
+override TARGET_UNITS+=testregistry testreport testdecorator ubmockobject xmlreporter fpcunitreport latextestreport xmltestreport plaintestreport
 endif
 ifeq ($(FULL_TARGET),i386-freebsd)
-override TARGET_UNITS+=fpcunit testregistry testreport testutils testdecorator ubmockobject xmlreporter
+override TARGET_UNITS+=testregistry testreport testdecorator ubmockobject xmlreporter fpcunitreport latextestreport xmltestreport plaintestreport
 endif
 ifeq ($(FULL_TARGET),i386-beos)
-override TARGET_UNITS+=fpcunit testregistry testreport testutils testdecorator ubmockobject xmlreporter
+override TARGET_UNITS+=testregistry testreport testdecorator ubmockobject xmlreporter fpcunitreport latextestreport xmltestreport plaintestreport
 endif
 ifeq ($(FULL_TARGET),i386-netbsd)
-override TARGET_UNITS+=fpcunit testregistry testreport testutils testdecorator ubmockobject xmlreporter
+override TARGET_UNITS+=testregistry testreport testdecorator ubmockobject xmlreporter fpcunitreport latextestreport xmltestreport plaintestreport
 endif
 ifeq ($(FULL_TARGET),i386-solaris)
-override TARGET_UNITS+=fpcunit testregistry testreport testutils testdecorator ubmockobject xmlreporter
+override TARGET_UNITS+=testregistry testreport testdecorator ubmockobject xmlreporter fpcunitreport latextestreport xmltestreport plaintestreport
 endif
 ifeq ($(FULL_TARGET),i386-qnx)
-override TARGET_UNITS+=fpcunit testregistry testreport testutils testdecorator ubmockobject xmlreporter
+override TARGET_UNITS+=testregistry testreport testdecorator ubmockobject xmlreporter fpcunitreport latextestreport xmltestreport plaintestreport
 endif
 ifeq ($(FULL_TARGET),i386-netware)
-override TARGET_UNITS+=fpcunit testregistry testreport testutils testdecorator ubmockobject xmlreporter
+override TARGET_UNITS+=testregistry testreport testdecorator ubmockobject xmlreporter fpcunitreport latextestreport xmltestreport plaintestreport
 endif
 ifeq ($(FULL_TARGET),i386-openbsd)
-override TARGET_UNITS+=fpcunit testregistry testreport testutils testdecorator ubmockobject xmlreporter
+override TARGET_UNITS+=testregistry testreport testdecorator ubmockobject xmlreporter fpcunitreport latextestreport xmltestreport plaintestreport
 endif
 ifeq ($(FULL_TARGET),i386-wdosx)
-override TARGET_UNITS+=fpcunit testregistry testreport testutils testdecorator ubmockobject xmlreporter
+override TARGET_UNITS+=testregistry testreport testdecorator ubmockobject xmlreporter fpcunitreport latextestreport xmltestreport plaintestreport
 endif
 ifeq ($(FULL_TARGET),i386-darwin)
-override TARGET_UNITS+=fpcunit testregistry testreport testutils testdecorator ubmockobject xmlreporter
+override TARGET_UNITS+=testregistry testreport testdecorator ubmockobject xmlreporter fpcunitreport latextestreport xmltestreport plaintestreport
 endif
 ifeq ($(FULL_TARGET),i386-emx)
-override TARGET_UNITS+=fpcunit testregistry testreport testutils testdecorator ubmockobject xmlreporter
+override TARGET_UNITS+=testregistry testreport testdecorator ubmockobject xmlreporter fpcunitreport latextestreport xmltestreport plaintestreport
 endif
 ifeq ($(FULL_TARGET),i386-watcom)
-override TARGET_UNITS+=fpcunit testregistry testreport testutils testdecorator ubmockobject xmlreporter
+override TARGET_UNITS+=testregistry testreport testdecorator ubmockobject xmlreporter fpcunitreport latextestreport xmltestreport plaintestreport
 endif
 ifeq ($(FULL_TARGET),i386-netwlibc)
-override TARGET_UNITS+=fpcunit testregistry testreport testutils testdecorator ubmockobject xmlreporter
+override TARGET_UNITS+=testregistry testreport testdecorator ubmockobject xmlreporter fpcunitreport latextestreport xmltestreport plaintestreport
 endif
 ifeq ($(FULL_TARGET),i386-wince)
-override TARGET_UNITS+=fpcunit testregistry testreport testutils testdecorator ubmockobject xmlreporter
-endif
-ifeq ($(FULL_TARGET),i386-embedded)
-override TARGET_UNITS+=fpcunit testregistry testreport testutils testdecorator ubmockobject xmlreporter
-endif
-ifeq ($(FULL_TARGET),i386-symbian)
-override TARGET_UNITS+=fpcunit testregistry testreport testutils testdecorator ubmockobject xmlreporter
+override TARGET_UNITS+=testregistry testreport testdecorator ubmockobject xmlreporter fpcunitreport latextestreport xmltestreport plaintestreport
 endif
 ifeq ($(FULL_TARGET),m68k-linux)
-override TARGET_UNITS+=fpcunit testregistry testreport testutils testdecorator ubmockobject xmlreporter
+override TARGET_UNITS+=testregistry testreport testdecorator ubmockobject xmlreporter fpcunitreport latextestreport xmltestreport plaintestreport
 endif
 ifeq ($(FULL_TARGET),m68k-freebsd)
-override TARGET_UNITS+=fpcunit testregistry testreport testutils testdecorator ubmockobject xmlreporter
+override TARGET_UNITS+=testregistry testreport testdecorator ubmockobject xmlreporter fpcunitreport latextestreport xmltestreport plaintestreport
 endif
 ifeq ($(FULL_TARGET),m68k-netbsd)
-override TARGET_UNITS+=fpcunit testregistry testreport testutils testdecorator ubmockobject xmlreporter
+override TARGET_UNITS+=testregistry testreport testdecorator ubmockobject xmlreporter fpcunitreport latextestreport xmltestreport plaintestreport
 endif
 ifeq ($(FULL_TARGET),m68k-amiga)
-override TARGET_UNITS+=fpcunit testregistry testreport testutils testdecorator ubmockobject xmlreporter
+override TARGET_UNITS+=testregistry testreport testdecorator ubmockobject xmlreporter fpcunitreport latextestreport xmltestreport plaintestreport
 endif
 ifeq ($(FULL_TARGET),m68k-atari)
-override TARGET_UNITS+=fpcunit testregistry testreport testutils testdecorator ubmockobject xmlreporter
+override TARGET_UNITS+=testregistry testreport testdecorator ubmockobject xmlreporter fpcunitreport latextestreport xmltestreport plaintestreport
 endif
 ifeq ($(FULL_TARGET),m68k-openbsd)
-override TARGET_UNITS+=fpcunit testregistry testreport testutils testdecorator ubmockobject xmlreporter
+override TARGET_UNITS+=testregistry testreport testdecorator ubmockobject xmlreporter fpcunitreport latextestreport xmltestreport plaintestreport
 endif
 ifeq ($(FULL_TARGET),m68k-palmos)
-override TARGET_UNITS+=fpcunit testregistry testreport testutils testdecorator ubmockobject xmlreporter
-endif
-ifeq ($(FULL_TARGET),m68k-embedded)
-override TARGET_UNITS+=fpcunit testregistry testreport testutils testdecorator ubmockobject xmlreporter
+override TARGET_UNITS+=testregistry testreport testdecorator ubmockobject xmlreporter fpcunitreport latextestreport xmltestreport plaintestreport
 endif
 ifeq ($(FULL_TARGET),powerpc-linux)
-override TARGET_UNITS+=fpcunit testregistry testreport testutils testdecorator ubmockobject xmlreporter
+override TARGET_UNITS+=testregistry testreport testdecorator ubmockobject xmlreporter fpcunitreport latextestreport xmltestreport plaintestreport
 endif
 ifeq ($(FULL_TARGET),powerpc-netbsd)
-override TARGET_UNITS+=fpcunit testregistry testreport testutils testdecorator ubmockobject xmlreporter
+override TARGET_UNITS+=testregistry testreport testdecorator ubmockobject xmlreporter fpcunitreport latextestreport xmltestreport plaintestreport
 endif
 ifeq ($(FULL_TARGET),powerpc-amiga)
-override TARGET_UNITS+=fpcunit testregistry testreport testutils testdecorator ubmockobject xmlreporter
+override TARGET_UNITS+=testregistry testreport testdecorator ubmockobject xmlreporter fpcunitreport latextestreport xmltestreport plaintestreport
 endif
 ifeq ($(FULL_TARGET),powerpc-macos)
-override TARGET_UNITS+=fpcunit testregistry testreport testutils testdecorator ubmockobject xmlreporter
+override TARGET_UNITS+=testregistry testreport testdecorator ubmockobject xmlreporter fpcunitreport latextestreport xmltestreport plaintestreport
 endif
 ifeq ($(FULL_TARGET),powerpc-darwin)
-override TARGET_UNITS+=fpcunit testregistry testreport testutils testdecorator ubmockobject xmlreporter
+override TARGET_UNITS+=testregistry testreport testdecorator ubmockobject xmlreporter fpcunitreport latextestreport xmltestreport plaintestreport
 endif
 ifeq ($(FULL_TARGET),powerpc-morphos)
-override TARGET_UNITS+=fpcunit testregistry testreport testutils testdecorator ubmockobject xmlreporter
-endif
-ifeq ($(FULL_TARGET),powerpc-embedded)
-override TARGET_UNITS+=fpcunit testregistry testreport testutils testdecorator ubmockobject xmlreporter
+override TARGET_UNITS+=testregistry testreport testdecorator ubmockobject xmlreporter fpcunitreport latextestreport xmltestreport plaintestreport
 endif
 ifeq ($(FULL_TARGET),sparc-linux)
-override TARGET_UNITS+=fpcunit testregistry testreport testutils testdecorator ubmockobject xmlreporter
+override TARGET_UNITS+=testregistry testreport testdecorator ubmockobject xmlreporter fpcunitreport latextestreport xmltestreport plaintestreport
 endif
 ifeq ($(FULL_TARGET),sparc-netbsd)
-override TARGET_UNITS+=fpcunit testregistry testreport testutils testdecorator ubmockobject xmlreporter
+override TARGET_UNITS+=testregistry testreport testdecorator ubmockobject xmlreporter fpcunitreport latextestreport xmltestreport plaintestreport
 endif
 ifeq ($(FULL_TARGET),sparc-solaris)
-override TARGET_UNITS+=fpcunit testregistry testreport testutils testdecorator ubmockobject xmlreporter
-endif
-ifeq ($(FULL_TARGET),sparc-embedded)
-override TARGET_UNITS+=fpcunit testregistry testreport testutils testdecorator ubmockobject xmlreporter
+override TARGET_UNITS+=testregistry testreport testdecorator ubmockobject xmlreporter fpcunitreport latextestreport xmltestreport plaintestreport
 endif
 ifeq ($(FULL_TARGET),x86_64-linux)
-override TARGET_UNITS+=fpcunit testregistry testreport testutils testdecorator ubmockobject xmlreporter
+override TARGET_UNITS+=testregistry testreport testdecorator ubmockobject xmlreporter fpcunitreport latextestreport xmltestreport plaintestreport
 endif
 ifeq ($(FULL_TARGET),x86_64-freebsd)
-override TARGET_UNITS+=fpcunit testregistry testreport testutils testdecorator ubmockobject xmlreporter
+override TARGET_UNITS+=testregistry testreport testdecorator ubmockobject xmlreporter fpcunitreport latextestreport xmltestreport plaintestreport
 endif
 ifeq ($(FULL_TARGET),x86_64-win64)
-override TARGET_UNITS+=fpcunit testregistry testreport testutils testdecorator ubmockobject xmlreporter
-endif
-ifeq ($(FULL_TARGET),x86_64-embedded)
-override TARGET_UNITS+=fpcunit testregistry testreport testutils testdecorator ubmockobject xmlreporter
+override TARGET_UNITS+=testregistry testreport testdecorator ubmockobject xmlreporter fpcunitreport latextestreport xmltestreport plaintestreport
 endif
 ifeq ($(FULL_TARGET),arm-linux)
-override TARGET_UNITS+=fpcunit testregistry testreport testutils testdecorator ubmockobject xmlreporter
+override TARGET_UNITS+=testregistry testreport testdecorator ubmockobject xmlreporter fpcunitreport latextestreport xmltestreport plaintestreport
 endif
 ifeq ($(FULL_TARGET),arm-palmos)
-override TARGET_UNITS+=fpcunit testregistry testreport testutils testdecorator ubmockobject xmlreporter
+override TARGET_UNITS+=testregistry testreport testdecorator ubmockobject xmlreporter fpcunitreport latextestreport xmltestreport plaintestreport
 endif
 ifeq ($(FULL_TARGET),arm-wince)
-override TARGET_UNITS+=fpcunit testregistry testreport testutils testdecorator ubmockobject xmlreporter
+override TARGET_UNITS+=testregistry testreport testdecorator ubmockobject xmlreporter fpcunitreport latextestreport xmltestreport plaintestreport
 endif
 ifeq ($(FULL_TARGET),arm-gba)
-override TARGET_UNITS+=fpcunit testregistry testreport testutils testdecorator ubmockobject xmlreporter
-endif
-ifeq ($(FULL_TARGET),arm-nds)
-override TARGET_UNITS+=fpcunit testregistry testreport testutils testdecorator ubmockobject xmlreporter
-endif
-ifeq ($(FULL_TARGET),arm-embedded)
-override TARGET_UNITS+=fpcunit testregistry testreport testutils testdecorator ubmockobject xmlreporter
-endif
-ifeq ($(FULL_TARGET),arm-symbian)
-override TARGET_UNITS+=fpcunit testregistry testreport testutils testdecorator ubmockobject xmlreporter
+override TARGET_UNITS+=testregistry testreport testdecorator ubmockobject xmlreporter fpcunitreport latextestreport xmltestreport plaintestreport
 endif
 ifeq ($(FULL_TARGET),powerpc64-linux)
-override TARGET_UNITS+=fpcunit testregistry testreport testutils testdecorator ubmockobject xmlreporter
-endif
-ifeq ($(FULL_TARGET),powerpc64-embedded)
-override TARGET_UNITS+=fpcunit testregistry testreport testutils testdecorator ubmockobject xmlreporter
+override TARGET_UNITS+=testregistry testreport testdecorator ubmockobject xmlreporter fpcunitreport latextestreport xmltestreport plaintestreport
 endif
 ifeq ($(FULL_TARGET),i386-linux)
 override TARGET_EXAMPLEDIRS+=exampletests
@@ -436,12 +406,6 @@ endif
 ifeq ($(FULL_TARGET),i386-wince)
 override TARGET_EXAMPLEDIRS+=exampletests
 endif
-ifeq ($(FULL_TARGET),i386-embedded)
-override TARGET_EXAMPLEDIRS+=exampletests
-endif
-ifeq ($(FULL_TARGET),i386-symbian)
-override TARGET_EXAMPLEDIRS+=exampletests
-endif
 ifeq ($(FULL_TARGET),m68k-linux)
 override TARGET_EXAMPLEDIRS+=exampletests
 endif
@@ -463,9 +427,6 @@ endif
 ifeq ($(FULL_TARGET),m68k-palmos)
 override TARGET_EXAMPLEDIRS+=exampletests
 endif
-ifeq ($(FULL_TARGET),m68k-embedded)
-override TARGET_EXAMPLEDIRS+=exampletests
-endif
 ifeq ($(FULL_TARGET),powerpc-linux)
 override TARGET_EXAMPLEDIRS+=exampletests
 endif
@@ -484,9 +445,6 @@ endif
 ifeq ($(FULL_TARGET),powerpc-morphos)
 override TARGET_EXAMPLEDIRS+=exampletests
 endif
-ifeq ($(FULL_TARGET),powerpc-embedded)
-override TARGET_EXAMPLEDIRS+=exampletests
-endif
 ifeq ($(FULL_TARGET),sparc-linux)
 override TARGET_EXAMPLEDIRS+=exampletests
 endif
@@ -496,9 +454,6 @@ endif
 ifeq ($(FULL_TARGET),sparc-solaris)
 override TARGET_EXAMPLEDIRS+=exampletests
 endif
-ifeq ($(FULL_TARGET),sparc-embedded)
-override TARGET_EXAMPLEDIRS+=exampletests
-endif
 ifeq ($(FULL_TARGET),x86_64-linux)
 override TARGET_EXAMPLEDIRS+=exampletests
 endif
@@ -508,9 +463,6 @@ endif
 ifeq ($(FULL_TARGET),x86_64-win64)
 override TARGET_EXAMPLEDIRS+=exampletests
 endif
-ifeq ($(FULL_TARGET),x86_64-embedded)
-override TARGET_EXAMPLEDIRS+=exampletests
-endif
 ifeq ($(FULL_TARGET),arm-linux)
 override TARGET_EXAMPLEDIRS+=exampletests
 endif
@@ -523,21 +475,9 @@ endif
 ifeq ($(FULL_TARGET),arm-gba)
 override TARGET_EXAMPLEDIRS+=exampletests
 endif
-ifeq ($(FULL_TARGET),arm-nds)
-override TARGET_EXAMPLEDIRS+=exampletests
-endif
-ifeq ($(FULL_TARGET),arm-embedded)
-override TARGET_EXAMPLEDIRS+=exampletests
-endif
-ifeq ($(FULL_TARGET),arm-symbian)
-override TARGET_EXAMPLEDIRS+=exampletests
-endif
 ifeq ($(FULL_TARGET),powerpc64-linux)
 override TARGET_EXAMPLEDIRS+=exampletests
 endif
-ifeq ($(FULL_TARGET),powerpc64-embedded)
-override TARGET_EXAMPLEDIRS+=exampletests
-endif
 override INSTALL_FPCPACKAGE=y
 ifeq ($(FULL_TARGET),i386-linux)
 override COMPILER_OPTIONS+=-S2h
@@ -590,12 +530,6 @@ endif
 ifeq ($(FULL_TARGET),i386-wince)
 override COMPILER_OPTIONS+=-S2h
 endif
-ifeq ($(FULL_TARGET),i386-embedded)
-override COMPILER_OPTIONS+=-S2h
-endif
-ifeq ($(FULL_TARGET),i386-symbian)
-override COMPILER_OPTIONS+=-S2h
-endif
 ifeq ($(FULL_TARGET),m68k-linux)
 override COMPILER_OPTIONS+=-S2h
 endif
@@ -617,9 +551,6 @@ endif
 ifeq ($(FULL_TARGET),m68k-palmos)
 override COMPILER_OPTIONS+=-S2h
 endif
-ifeq ($(FULL_TARGET),m68k-embedded)
-override COMPILER_OPTIONS+=-S2h
-endif
 ifeq ($(FULL_TARGET),powerpc-linux)
 override COMPILER_OPTIONS+=-S2h
 endif
@@ -638,9 +569,6 @@ endif
 ifeq ($(FULL_TARGET),powerpc-morphos)
 override COMPILER_OPTIONS+=-S2h
 endif
-ifeq ($(FULL_TARGET),powerpc-embedded)
-override COMPILER_OPTIONS+=-S2h
-endif
 ifeq ($(FULL_TARGET),sparc-linux)
 override COMPILER_OPTIONS+=-S2h
 endif
@@ -650,9 +578,6 @@ endif
 ifeq ($(FULL_TARGET),sparc-solaris)
 override COMPILER_OPTIONS+=-S2h
 endif
-ifeq ($(FULL_TARGET),sparc-embedded)
-override COMPILER_OPTIONS+=-S2h
-endif
 ifeq ($(FULL_TARGET),x86_64-linux)
 override COMPILER_OPTIONS+=-S2h
 endif
@@ -662,9 +587,6 @@ endif
 ifeq ($(FULL_TARGET),x86_64-win64)
 override COMPILER_OPTIONS+=-S2h
 endif
-ifeq ($(FULL_TARGET),x86_64-embedded)
-override COMPILER_OPTIONS+=-S2h
-endif
 ifeq ($(FULL_TARGET),arm-linux)
 override COMPILER_OPTIONS+=-S2h
 endif
@@ -677,21 +599,9 @@ endif
 ifeq ($(FULL_TARGET),arm-gba)
 override COMPILER_OPTIONS+=-S2h
 endif
-ifeq ($(FULL_TARGET),arm-nds)
-override COMPILER_OPTIONS+=-S2h
-endif
-ifeq ($(FULL_TARGET),arm-embedded)
-override COMPILER_OPTIONS+=-S2h
-endif
-ifeq ($(FULL_TARGET),arm-symbian)
-override COMPILER_OPTIONS+=-S2h
-endif
 ifeq ($(FULL_TARGET),powerpc64-linux)
 override COMPILER_OPTIONS+=-S2h
 endif
-ifeq ($(FULL_TARGET),powerpc64-embedded)
-override COMPILER_OPTIONS+=-S2h
-endif
 ifeq ($(FULL_TARGET),i386-linux)
 override COMPILER_TARGETDIR+=.
 endif
@@ -743,12 +653,6 @@ endif
 ifeq ($(FULL_TARGET),i386-wince)
 override COMPILER_TARGETDIR+=.
 endif
-ifeq ($(FULL_TARGET),i386-embedded)
-override COMPILER_TARGETDIR+=.
-endif
-ifeq ($(FULL_TARGET),i386-symbian)
-override COMPILER_TARGETDIR+=.
-endif
 ifeq ($(FULL_TARGET),m68k-linux)
 override COMPILER_TARGETDIR+=.
 endif
@@ -770,9 +674,6 @@ endif
 ifeq ($(FULL_TARGET),m68k-palmos)
 override COMPILER_TARGETDIR+=.
 endif
-ifeq ($(FULL_TARGET),m68k-embedded)
-override COMPILER_TARGETDIR+=.
-endif
 ifeq ($(FULL_TARGET),powerpc-linux)
 override COMPILER_TARGETDIR+=.
 endif
@@ -791,9 +692,6 @@ endif
 ifeq ($(FULL_TARGET),powerpc-morphos)
 override COMPILER_TARGETDIR+=.
 endif
-ifeq ($(FULL_TARGET),powerpc-embedded)
-override COMPILER_TARGETDIR+=.
-endif
 ifeq ($(FULL_TARGET),sparc-linux)
 override COMPILER_TARGETDIR+=.
 endif
@@ -803,9 +701,6 @@ endif
 ifeq ($(FULL_TARGET),sparc-solaris)
 override COMPILER_TARGETDIR+=.
 endif
-ifeq ($(FULL_TARGET),sparc-embedded)
-override COMPILER_TARGETDIR+=.
-endif
 ifeq ($(FULL_TARGET),x86_64-linux)
 override COMPILER_TARGETDIR+=.
 endif
@@ -815,9 +710,6 @@ endif
 ifeq ($(FULL_TARGET),x86_64-win64)
 override COMPILER_TARGETDIR+=.
 endif
-ifeq ($(FULL_TARGET),x86_64-embedded)
-override COMPILER_TARGETDIR+=.
-endif
 ifeq ($(FULL_TARGET),arm-linux)
 override COMPILER_TARGETDIR+=.
 endif
@@ -830,21 +722,9 @@ endif
 ifeq ($(FULL_TARGET),arm-gba)
 override COMPILER_TARGETDIR+=.
 endif
-ifeq ($(FULL_TARGET),arm-nds)
-override COMPILER_TARGETDIR+=.
-endif
-ifeq ($(FULL_TARGET),arm-embedded)
-override COMPILER_TARGETDIR+=.
-endif
-ifeq ($(FULL_TARGET),arm-symbian)
-override COMPILER_TARGETDIR+=.
-endif
 ifeq ($(FULL_TARGET),powerpc64-linux)
 override COMPILER_TARGETDIR+=.
 endif
-ifeq ($(FULL_TARGET),powerpc64-embedded)
-override COMPILER_TARGETDIR+=.
-endif
 ifdef REQUIRE_UNITSDIR
 override UNITSDIR+=$(REQUIRE_UNITSDIR)
 endif
@@ -1171,10 +1051,6 @@ EXEEXT=.gba
 SHAREDLIBEXT=.so
 SHORTSUFFIX=gba
 endif
-ifeq ($(OS_TARGET),symbian)
-SHAREDLIBEXT=.dll
-SHORTSUFFIX=symbian
-endif
 else
 ifeq ($(OS_TARGET),go32v1)
 PPUEXT=.pp1
@@ -1644,12 +1520,6 @@ endif
 ifeq ($(FULL_TARGET),i386-wince)
 REQUIRE_PACKAGES_RTL=1
 endif
-ifeq ($(FULL_TARGET),i386-embedded)
-REQUIRE_PACKAGES_RTL=1
-endif
-ifeq ($(FULL_TARGET),i386-symbian)
-REQUIRE_PACKAGES_RTL=1
-endif
 ifeq ($(FULL_TARGET),m68k-linux)
 REQUIRE_PACKAGES_RTL=1
 endif
@@ -1671,9 +1541,6 @@ endif
 ifeq ($(FULL_TARGET),m68k-palmos)
 REQUIRE_PACKAGES_RTL=1
 endif
-ifeq ($(FULL_TARGET),m68k-embedded)
-REQUIRE_PACKAGES_RTL=1
-endif
 ifeq ($(FULL_TARGET),powerpc-linux)
 REQUIRE_PACKAGES_RTL=1
 endif
@@ -1692,9 +1559,6 @@ endif
 ifeq ($(FULL_TARGET),powerpc-morphos)
 REQUIRE_PACKAGES_RTL=1
 endif
-ifeq ($(FULL_TARGET),powerpc-embedded)
-REQUIRE_PACKAGES_RTL=1
-endif
 ifeq ($(FULL_TARGET),sparc-linux)
 REQUIRE_PACKAGES_RTL=1
 endif
@@ -1704,9 +1568,6 @@ endif
 ifeq ($(FULL_TARGET),sparc-solaris)
 REQUIRE_PACKAGES_RTL=1
 endif
-ifeq ($(FULL_TARGET),sparc-embedded)
-REQUIRE_PACKAGES_RTL=1
-endif
 ifeq ($(FULL_TARGET),x86_64-linux)
 REQUIRE_PACKAGES_RTL=1
 endif
@@ -1716,9 +1577,6 @@ endif
 ifeq ($(FULL_TARGET),x86_64-win64)
 REQUIRE_PACKAGES_RTL=1
 endif
-ifeq ($(FULL_TARGET),x86_64-embedded)
-REQUIRE_PACKAGES_RTL=1
-endif
 ifeq ($(FULL_TARGET),arm-linux)
 REQUIRE_PACKAGES_RTL=1
 endif
@@ -1731,21 +1589,9 @@ endif
 ifeq ($(FULL_TARGET),arm-gba)
 REQUIRE_PACKAGES_RTL=1
 endif
-ifeq ($(FULL_TARGET),arm-nds)
-REQUIRE_PACKAGES_RTL=1
-endif
-ifeq ($(FULL_TARGET),arm-embedded)
-REQUIRE_PACKAGES_RTL=1
-endif
-ifeq ($(FULL_TARGET),arm-symbian)
-REQUIRE_PACKAGES_RTL=1
-endif
 ifeq ($(FULL_TARGET),powerpc64-linux)
 REQUIRE_PACKAGES_RTL=1
 endif
-ifeq ($(FULL_TARGET),powerpc64-embedded)
-REQUIRE_PACKAGES_RTL=1
-endif
 ifdef REQUIRE_PACKAGES_RTL
 PACKAGEDIR_RTL:=$(firstword $(subst /Makefile.fpc,,$(strip $(wildcard $(addsuffix /rtl/Makefile.fpc,$(PACKAGESDIR))))))
 ifneq ($(PACKAGEDIR_RTL),)
@@ -1823,7 +1669,7 @@ ifeq ($(CPU_TARGET),powerpc)
 FPCCPUOPT:=-O1r
 endif
 else
-FPCCPUOPT:=-O2
+FPCCPUOPT:=-O1r
 endif
 override FPCOPT+=-Ur -Xs $(FPCCPUOPT) -n
 override FPCOPTDEF+=RELEASE
@@ -1882,13 +1728,6 @@ ifeq ($(CPU_TARGET),i386)
 override FPCOPT+=-Aas
 endif
 endif
-ifeq ($(findstring 2.0.,$(FPC_VERSION)),)
-ifeq ($(OS_TARGET),linux)
-ifeq ($(CPU_TARGET),x86_64)
-override FPCOPT+=-Cg
-endif
-endif
-endif
 ifdef LINKSHARED
 endif
 ifdef OPT
@@ -2319,12 +2158,6 @@ endif
 ifeq ($(FULL_TARGET),i386-wince)
 TARGET_EXAMPLEDIRS_EXAMPLETESTS=1
 endif
-ifeq ($(FULL_TARGET),i386-embedded)
-TARGET_EXAMPLEDIRS_EXAMPLETESTS=1
-endif
-ifeq ($(FULL_TARGET),i386-symbian)
-TARGET_EXAMPLEDIRS_EXAMPLETESTS=1
-endif
 ifeq ($(FULL_TARGET),m68k-linux)
 TARGET_EXAMPLEDIRS_EXAMPLETESTS=1
 endif
@@ -2346,9 +2179,6 @@ endif
 ifeq ($(FULL_TARGET),m68k-palmos)
 TARGET_EXAMPLEDIRS_EXAMPLETESTS=1
 endif
-ifeq ($(FULL_TARGET),m68k-embedded)
-TARGET_EXAMPLEDIRS_EXAMPLETESTS=1
-endif
 ifeq ($(FULL_TARGET),powerpc-linux)
 TARGET_EXAMPLEDIRS_EXAMPLETESTS=1
 endif
@@ -2367,9 +2197,6 @@ endif
 ifeq ($(FULL_TARGET),powerpc-morphos)
 TARGET_EXAMPLEDIRS_EXAMPLETESTS=1
 endif
-ifeq ($(FULL_TARGET),powerpc-embedded)
-TARGET_EXAMPLEDIRS_EXAMPLETESTS=1
-endif
 ifeq ($(FULL_TARGET),sparc-linux)
 TARGET_EXAMPLEDIRS_EXAMPLETESTS=1
 endif
@@ -2379,9 +2206,6 @@ endif
 ifeq ($(FULL_TARGET),sparc-solaris)
 TARGET_EXAMPLEDIRS_EXAMPLETESTS=1
 endif
-ifeq ($(FULL_TARGET),sparc-embedded)
-TARGET_EXAMPLEDIRS_EXAMPLETESTS=1
-endif
 ifeq ($(FULL_TARGET),x86_64-linux)
 TARGET_EXAMPLEDIRS_EXAMPLETESTS=1
 endif
@@ -2391,9 +2215,6 @@ endif
 ifeq ($(FULL_TARGET),x86_64-win64)
 TARGET_EXAMPLEDIRS_EXAMPLETESTS=1
 endif
-ifeq ($(FULL_TARGET),x86_64-embedded)
-TARGET_EXAMPLEDIRS_EXAMPLETESTS=1
-endif
 ifeq ($(FULL_TARGET),arm-linux)
 TARGET_EXAMPLEDIRS_EXAMPLETESTS=1
 endif
@@ -2406,21 +2227,9 @@ endif
 ifeq ($(FULL_TARGET),arm-gba)
 TARGET_EXAMPLEDIRS_EXAMPLETESTS=1
 endif
-ifeq ($(FULL_TARGET),arm-nds)
-TARGET_EXAMPLEDIRS_EXAMPLETESTS=1
-endif
-ifeq ($(FULL_TARGET),arm-embedded)
-TARGET_EXAMPLEDIRS_EXAMPLETESTS=1
-endif
-ifeq ($(FULL_TARGET),arm-symbian)
-TARGET_EXAMPLEDIRS_EXAMPLETESTS=1
-endif
 ifeq ($(FULL_TARGET),powerpc64-linux)
 TARGET_EXAMPLEDIRS_EXAMPLETESTS=1
 endif
-ifeq ($(FULL_TARGET),powerpc64-embedded)
-TARGET_EXAMPLEDIRS_EXAMPLETESTS=1
-endif
 ifdef TARGET_EXAMPLEDIRS_EXAMPLETESTS
 exampletests_all:
 	$(MAKE) -C exampletests all

+ 2 - 1
fcl/fpcunit/Makefile.fpc

@@ -6,7 +6,8 @@
 main=fcl
 
 [target]
-units=fpcunit testregistry testreport testutils testdecorator ubmockobject xmlreporter
+units=testregistry testreport testdecorator ubmockobject xmlreporter \
+      fpcunitreport latextestreport xmltestreport plaintestreport
 exampledirs=exampletests
 
 [compiler]

+ 33 - 153
fcl/fpcunit/README.txt

@@ -1,158 +1,38 @@
-FPCUnit 
-   
-   This is a port to Free Pascal of the JUnit core framework.
-   see http://www.junit.org
-   A great thank you goes to Kent Beck and Erich Gamma:
-   "Never in the field of software development was so much 
-   owed by so many to so few lines of code." (M.Fowler)
-
-   
-In building FPCUnit I've tried to follow as closely as possible the original JUnit code base,so, as a side effect, developers already familiar with JUnit will find themselves at home with this port to Free Pascal. If you are new to unit testing and test driven development, you can find a huge reference to articles and howto's on the JUnit home page:
-http://junit.sourceforge.net/#Documentation
-http://www.junit.org/news/article/index.htm.
-
-THE ASSERTIONS AND TEST CASES
-To construct a test case you have to define your testcase class, inherited from TTestCase or from a descendant of TTestCase.
-You'll tipically inherit from a descendant to add custom made asserts to your test case.
-In fact there is a bunch of basic assertions defined as class methods of TAssert class, but they will never be able to cover all the possible types of assertions that can be necessary, especially when you would like to work with custom types.
-E.g. you could have a class TMoney where you would like to assert whether two instances are equal.
-Suppose you define that two instances of TMoney are equal if they have the same amount and the same
-currency unit ( [10 EUR] = [10 EUR] <> [10 USD] ).
-function TMoney.Equals(aMoney: TMoney): Boolean;
-begin
-  Result := (Amount = aMoney.Amount) and (CurrencyUnit = aMoney.CurrecyUnit); 
-end;
-
-In this case you'll probably like to define your own assertions:
-TMoneyTestCase = class (TTestCase)
-public
-  class procedure AssertEquals(const aMessage: string; Expected, Actual: TMoney); overload;
-  class procedure AssertEquals(Expected, Actual: TMoney); overload;
-end;
-
-class procedure TMoneyTestCase.AssertEquals(const aMessage: string; Expected, Actual: TMoney); 
-begin
-  AssertTrue(aMessage + ': expected <' + Expected.AsString + '> but was <' + Actual.AsString + '>'.
-    Expected.Equals(Actual));
-end;
-
-and you'll inherit all your testcases from TMoneyTestCase;
-
-
-Your testcase class will have a set of published methods, one for each test.
-The framework picks up all the published methods and registers them as tests in the suite.
-It's easy to temporarily disable a test from the suite: just move the declaration to the public section.
-
-
-The fact that all assertions are static (class methods) make's it possible to use them outside of the test case, by simply adding fpcunit to your uses clause: 
-e.g. by calling TAssert.AssertEqual(....)
-It can be usefull when using the Mock Object techniques, the so called "Endo testing".
-
-THE SAMPLE CONSOLE TEST RUNNERS
-A simple example of a console test runner application that was used to write FPCUnit itself is included in the demo directory. The tests are located in fpcunitests.pp, they can be used as
-examples to see how to construct the tests and the test suites.
-
-To be able to trace the line numbers of the test errors (unhandled exceptions) it is required to use the -gl option 
-to compile the project:. 
-eg. $ fpc -Sd -gl testrunner.pp
-If you don't like this additional feature you can disable the {$SHOWLINEINFO} directive
-in the testresults.pp unit.
-
-Usage:
--l or --list to show a list of registered tests
-default format is xml, add --format=latex to output the list as latex source
--a or --all to run all the tests and show the results in xml format
-The results can be redirected to an xml file,
-for example: ./testrunner --all > results.xml
-use --suite=MyTestSuiteName to run only the tests in a single test suite class
-
-To use the simple console test runner in your own project, you can just edit the suiteconfig.pp unit to include your own units containing your tests instead of the unit fpcunittests and register your tests in the RegisterUnitTests procedure like this:
-
-unit suiteconfig;
-
-interface
+This is a new rewrite of the fpcunit test reports to make 
+fpcunit independent of the xml dom library but still provide
+a good sistem of reports.
+The reports are meant to be used to write the results of the tests
+with the new fpc packaging system.
+It produces latex and plain reports. Timing of the 
+executed tests is provided at the testcase and testsuite level.
+Summary of the results of the contained testcases (number of
+run tests, number of errors, failures and ignored tests)
+is provided for each test suite.
+A modified console test runner (consoletestrunner.pp) 
+is included that uses this new reporting classes.
+Of course a separate xmltestreport class is included for those
+that would like to use the xml test report through xslt to produce
+more complex html reports.
+
+
+The console test runner has to be used as always,
+for example:
+
+program runtests;
+
+{$mode objfpc}{$H+}
 
 uses
-  >>> Add the unit(s) containing your tests here;
-
-procedure RegisterUnitTests;
-
-implementation
-
-uses
-  testregistry;
-
-procedure RegisterUnitTests;
-begin
-  //register your tests here
->>>  RegisterTests([TYourFirstTest, TYourSecondTest, TYourThirdTest,... ]);
-end;
-
-end.
-
-There's another, more manual,  approach to construct your test suites.
-Take a look at the TTestRunner constructor in the fpcunit/tests/frameworktest.pp for an example:
-
-you can construct your test suite as in this example:
+  Classes, consoletestrunner, 
+  add here the units containing your testcases;
   
-  FSuite := TTestSuite.Create;
-  FSuite.TestName := 'my tests';
-  FSuite.AddTestSuiteFromClass(TMyTestCase);
-  FSuite.AddTest(TMySuiteTest.Suite());
-
+var
+  App: TTestRunner;
 
-this line uses a class function to construct a TTestSuite manually and adds it to 
-set of tests to be runned:
-
-FSuite.AddTest(TMySuiteTest.Suite());
-
-
-class function TMySuiteTest.Suite: TTestSuite;
 begin
-  Result := TTestSuite.Create('TSuiteTest');
-  Result.AddTest(TSuiteTest.CreateWithName('testOne'));
-  Result.AddTest(TSuiteTest.CreateWithName('testTwo'));
-  Result.AddTest(TSuiteTest.CreateWithName('testThree'));
-end;
-
-TESTING IN ISOLATION: SETUP AND TEARDOWN
-
-All the constructed tests are isolated from each other:
-it's important that the test that was run does not have any influence on the other tests that follow, there should be no cascading errors.
-The tests should succeed in whichever order they are runned.
-That's why the framework constructs each test by making a new instance of your TTestCase for each published method, so that every method runs in a freshly initialized environment.
-You have other means of isolation: the Setup and Teardown method provided by TTestCase that are runned before and after the execution of every test. You can initialize the environment
-in the setup method and finalize it in TearDown. You'll tipically override this two methods and costruct all the instances that are needed to run the test in Setup and destroy them in TearDown.
-Anyway: there's a risk of someone doing initialization in the field, so this is why with Kent Beck and Erich Gamma decided to build a separate instance of TTestcase for each test to run. It's important to understand this concept.
-See this small Martin Fowler's article on the subject:
-http://www.martinfowler.com/bliki/JunitNewInstance.html
-
-FPCUNIT AND LAZARUS
-
-There is a GUI runner for those working with Lazarus and
-Vincent Snijders recently integrated the fpcunit GUI runner in the Lazarus IDE.
-Now it's very simple to set the Lazarus IDE to automatically construct your testing aplication.
-Look under lazarus/components/fpcunit directory in the Lazarus source distribution.
-1) Open and COMPILE the fpcunittestrunner.lpk 
-2) Open and INSTALL the fpcunitide.lpk located in the /ide subdirectory
-
-Now, by chosing File > New... > Project > FPCUnitApplication from the Lazarus menu you'll have a GUI runner and a simple TTestCase stub ready to be runned.
-You can add additional templates for your test units by selecting
-File > New... > File > FPCUnitTestCase
-
-After running the tests a colored bar will show the results: the color of the bar is green when all the tests were successful, fuchsia, when only failures were encountered, red when errors are present (unexpected exceptions were rised). For each error the runner will show the unit and the line number where the exception occurred to make it easier to fix the test.
-
-SUGGESTED READINGS
-for those new to unit testing and for those that would like to improve their unit testing techniques I would suggest the following book:
-Andy Hunt, Dave Thomas: Pragmatic Unit Testing in Java with JUnit (2003 Pragmatic Programmers LLC)
-
-
-
-AKNOWLEDGMENTS
-A big thank you to Michael Van Canneyt for the encouragement to adapt the framework for Free Pascal. He reviewed all the code and made it compatible with objfpc mode.
-A special thank you to Vincent Snijders for his constant patience, encouragement and presence and his usefull advices.
-He proved to be a unit testing expert and the first one to use the framework in his constant hunting for Lazarus bugs. He integrated the FPCUnit GUI test runner into Lazarus, to make it easier to build the tests with Lazarus.
-
-Happy coding,
-Dean Zobec
- 
+  App := TTestRunner.Create(nil);
+  App.Initialize;
+  App.Title := 'FPCUnit Console runner.';
+  App.Run;
+  App.Free;
+end.

BIN
fcl/fpcunit/example_output/results.pdf


+ 150 - 0
fcl/fpcunit/example_output/results.txt

@@ -0,0 +1,150 @@
+FPCUnitTests Time:00.007 N:85 E:1 F:5 I:1
+  TSuiteOne Time:00.001 N:9 E:0 F:3 I:0
+    FirstNestedSuiteOne Time:00.001 N:2 E:0 F:1 I:0
+      00.000  Test11
+      00.000  Test12  Failed: Failed test
+    00.000  Test11
+    00.000  Test11
+    00.000  Test11
+    00.000  Test11
+    00.000  Test12  Failed: Failed test
+    SecondNestedSuiteOne Time:00.000 N:2 E:0 F:1 I:0
+      00.000  Test11
+      00.000  Test12  Failed: Failed test
+  TSuiteTwo Time:00.000 N:2 E:1 F:0 I:0
+    00.000  Test21
+    00.000  Test22  Error: EAccessViolation
+      Exception:   MyError
+      Source unit: exampletestsuites.pp
+      Method name: TSUITETWO__TEST22
+      Line number: 110
+  TSuiteThree Time:00.000 N:1 E:0 F:0 I:0
+    00.000  Test31
+  TSuiteFour Time:00.000 N:2 E:0 F:1 I:1
+    00.000  Test41  Ignored test: This is an ignored test.
+    00.000  Test42  Failed: Failed Test
+  TMoneyTest Time:00.002 N:23 E:0 F:0 I:0
+    00.000  testBagCreate
+    00.000  testBagMultiply
+    00.001  testBagNegate
+    00.000  testBagSimpleAdd
+    00.000  testBagSubtract
+    00.000  testBagSumAdd
+    00.000  testIsZero
+    00.000  testMixedSimpleAdd
+    00.000  testBagNotEquals
+    00.000  testMoneyBagEquals
+    00.000  testMoneyEquals
+    00.000  testSimplify
+    00.000  testNormalize2
+    00.000  testNormalize3
+    00.001  testNormalize4
+    00.000  testPrint
+    00.000  testMoneyBagPrint
+    00.000  testSimpleAdd
+    00.000  testSimpleBagAdd
+    00.000  testSimpleMultiply
+    00.000  testSimpleNegate
+    00.000  testSimpleSubtract
+    00.000  testOperators
+  TTestCaseTest Time:00.000 N:2 E:0 F:0 I:0
+    00.000  TestSetUp
+    00.000  TestAsString
+  TTestSuiteTest Time:00.000 N:2 E:0 F:0 I:0
+    00.000  CheckCountTestCases
+    00.000  TestExtractMethods
+  TAssertTest Time:00.001 N:27 E:0 F:1 I:0
+    00.000  TestEqualsInt
+    00.000  TestEqualsInt64
+    00.001  TestEqualsCurrency
+    00.000  TestEqualsDouble
+    00.000  TestEqualsBoolean
+    00.000  TestEqualsChar
+    00.000  TestEqualsTClass
+    00.000  TestEqualsTObject
+    00.000  TestNull
+    00.000  TestNullInterface
+    00.000  TestNotNull
+    00.000  TestNotNullWithInterface
+    00.000  TestNotNullInterface
+    00.000  TestFailEqualsInt
+    00.000  TestFailEqualsInt64
+    00.000  TestFailEqualsCurrency
+    00.000  TestFailEqualsDouble
+    00.000  TestFailEqualsBoolean  Failed: Wrong failure message: expected < expected: <TRUE> but was: <FALSE>>but was < expected: <-1> but was: <0>>
+    00.000  TestFailEqualsChar
+    00.000  TestFailEqualsTClass
+    00.000  TestFailEqualsTObject
+    00.000  TestFailNull
+    00.000  TestFailNullInterface
+    00.000  TestFailNotNull
+    00.000  TestFailNotNullInterface
+    00.000  TestAssertException
+    00.000  TestComparisonMsg
+  TListenerTest Time:00.002 N:6 E:0 F:0 I:0
+    00.001  TestStartAndEndTest
+    00.000  TestAddError
+    00.000  TestAddFailure
+    00.000  TestSetUpTearDown
+    00.000  TestSetUpException
+    00.001  TestTearDownException
+  TTestDecoratorTest Time:00.000 N:2 E:0 F:0 I:0
+    00.000  TestRun
+    00.000  TestOneTimeSetup
+  TSuiteTest Time:00.000 N:8 E:0 F:0 I:0
+    00.000  testNoTestCaseClass
+    00.000  testNoTestCases
+    00.000  testOneTestCase
+    00.000  testInheritedTests
+    00.000  testNotExistingTestCase
+    00.000  testShadowedTests
+    00.000  testAddTestSuiteFromClass
+    00.000  testCreateTestSuiteFromArray
+  TReportTest Time:00.001 N:1 E:0 F:0 I:0
+    00.001  TestWriteSuite
+
+Number of run tests: 85
+Number of errors:    1
+Number of failures:  5
+
+List of errors:
+  Error: 
+    Message:           TSuiteTwo.Test22: MyError
+    Exception class:   EAccessViolation
+    Exception message: MyError
+    Source unitname:   exampletestsuites.pp
+    Line number:       110
+    Failed methodname: TSUITETWO__TEST22
+
+
+List of failures:
+  Failure: 
+    Message:           FirstNestedSuiteOne.Test12: Failed test
+    Exception class:   EAssertionFailedError
+    Exception message: Failed test
+  Failure: 
+    Message:           TSuiteOne.Test12: Failed test
+    Exception class:   EAssertionFailedError
+    Exception message: Failed test
+  Failure: 
+    Message:           SecondNestedSuiteOne.Test12: Failed test
+    Exception class:   EAssertionFailedError
+    Exception message: Failed test
+  Failure: 
+    Message:           TSuiteFour.Test42: Failed Test
+    Exception class:   EAssertionFailedError
+    Exception message: Failed Test
+  Failure: 
+    Message:           TAssertTest.TestFailEqualsBoolean: Wrong failure message: expected < expected: <TRUE> but was: <FALSE>>but was < expected: <-1> but was: <0>>
+    Exception class:   EAssertionFailedError
+    Exception message: Wrong failure message: expected < expected: <TRUE> but was: <FALSE>>but was < expected: <-1> but was: <0>>
+
+
+List of ignored tests:
+  Ignored test: 
+    Message:           TSuiteFour.Test41: This is an ignored test.
+    Exception class:   EIgnoredTest
+    Exception message: This is an ignored test.
+
+
+

+ 319 - 0
fcl/fpcunit/fpcunitreport.pp

@@ -0,0 +1,319 @@
+{$mode objfpc}
+{$h+}
+{
+    This file is part of the Free Component Library (FCL)
+    Copyright (c) 2006 by Dean Zobec
+
+    common base classes for FPCUnit test reports
+
+    See the file COPYING.FPC, included in this distribution,
+    for details about the copyright.
+
+    This program is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+
+ **********************************************************************}
+unit fpcunitreport;
+
+interface
+
+uses
+  classes, sysutils, fpcunit;
+
+type
+  
+  TWriteTestHeaderEvent = procedure(Sender: TObject; ATest: TTest; 
+    ALevel: integer; ACount: integer) of object;
+  TWriteTestFooterEvent = procedure(Sender: TObject; ATest: TTest; 
+    ALevel: integer; ATiming: TDateTime) of object;
+  TTestNameEvent = procedure(Sender: TObject; const AName: string) of object;
+  TFailureEvent = procedure(Sender: TObject; ATest: TTest; AFailure: TTestFailure) of object;
+  TTestEvent = procedure(Sender: TObject; ATest: TTest) of object;  
+  TWriteTestSuiteHeaderEvent = procedure(Sender: TObject; ATestSuite: TTestSuite; 
+    ALevel: integer) of object;
+  TWriteTestSuiteFooterEvent = procedure(Sender: TObject; ATestSuite: TTestSuite; 
+    ALevel: integer; ATiming: TDateTime; ANumRuns: integer; ANumErrors: integer; 
+    ANumFailures: integer; ANumIgnores: integer) of object;
+
+  TSuiteResults = class(TObject)
+  private
+    FRuns: integer;
+    FErrors: integer;
+    FFailures: integer;
+    FIgnores: integer;
+    FStartTime: TDateTime;
+  public
+    property Runs: integer read FRuns write FRuns;
+    property Ignores: integer read FIgnores write FIgnores;
+    property Errors: integer read FErrors write FErrors;
+    property Failures: integer read FFailures write FFailures;
+    property StartTime: TDateTime read FStartTime write FStartTime;
+  end;
+
+  TSuiteResultsStack = class(TObject)
+  private
+    FResultsList: TFPList;
+  public
+    constructor Create;
+    destructor Destroy; override;
+    function Last: TSuiteResults;
+    procedure RemoveLast;
+    procedure Add;
+    procedure IncrementRuns;
+    procedure IncrementFailures;
+    procedure IncrementErrors;
+    procedure IncrementIgnores;
+  end;
+
+  TCustomResultsWriter = class(TComponent, ITestListener)
+  private
+    FLevel: integer;
+    FCount: integer;
+    FTestTime: TDateTime;
+    FFileName: string;
+    FSuiteResultsStack : TSuiteResultsStack;
+    FOnWriteSuiteHeader: TWriteTestSuiteHeaderEvent;
+    FOnWriteSuiteFooter: TWriteTestSuiteFooterEvent;
+    FOnWriteTestHeader: TWriteTestHeaderEvent;
+    FOnWriteTestFooter: TWriteTestFooterEvent;
+    FOnAddFailure: TFailureEvent;
+    FOnAddError: TFailureEvent;
+    FOnStartTest: TTestEvent;
+    FOnEndTest: TTestEvent;
+    FOnStartTestSuite: TTestEvent;
+    FOnEndTestSuite: TTestEvent;
+  protected
+    procedure WriteTestHeader(ATest: TTest; ALevel: integer; ACount: integer); virtual;
+    procedure WriteTestFooter(ATest: TTest; ALevel: integer; ATiming: TDateTime); virtual;
+    procedure WriteSuiteHeader(ATestSuite: TTestSuite; ALevel: integer); virtual;
+    procedure WriteSuiteFooter(ATestSuite: TTestSuite; ALevel: integer; 
+      ATiming: TDateTime; ANumRuns: integer; ANumErrors: integer; aNumFailures: integer;
+      ANumIgnores: integer); virtual;
+    procedure WriteHeader; virtual; 
+    procedure WriteFooter; virtual;
+  public
+  {ITestListener}
+    procedure AddFailure(ATest: TTest; AFailure: TTestFailure); virtual;
+    procedure AddError(ATest: TTest; AError: TTestFailure); virtual;
+    procedure StartTest(ATest: TTest); virtual;
+    procedure EndTest(ATest: TTest); virtual;
+    procedure StartTestSuite(ATestSuite: TTestSuite); virtual;
+    procedure EndTestSuite(ATestSuite: TTestSuite); virtual;
+
+    constructor Create(AOwner: TComponent); override;
+    destructor Destroy; override;
+    procedure AfterConstruction; override;
+    procedure BeforeDestruction; override;
+    procedure WriteResult(aResult: TTestResult); virtual;
+  published
+    property FileName: string read FFileName write FFileName;
+    property OnWriteSuiteHeader: TWriteTestSuiteHeaderEvent read FOnWriteSuiteHeader 
+      write FOnWriteSuiteHeader;
+    property OnWriteSuiteFooter: TWriteTestSuiteFooterEvent read FOnWriteSuiteFooter 
+      write FOnWriteSuiteFooter;
+    property OnWriteTestHeader: TWriteTestHeaderEvent read FOnWriteTestHeader 
+      write FOnWriteTestHeader;
+    property OnWriteTestFooter: TWriteTestFooterEvent read FOnWriteTestFooter 
+      write FOnWriteTestFooter;
+    property OnAddFailure: TFailureEvent read FOnAddFailure write FOnAddFailure;
+    property OnAddError: TFailureEvent read FOnAddError write FOnAddError;
+    property OnStartTest: TTestEvent read FOnStartTest write FOnStartTest;
+    property OnEndTest: TTestEvent read FOnEndTest write FOnEndTest;
+    property OnStartTestSuite: TTestEvent read FOnStartTestSuite write FOnStartTestSuite;
+    property OnEndTestSuite: TTestEvent read FOnEndTestSuite write FOnEndTestSuite;
+  end; 
+
+implementation
+
+constructor TSuiteResultsStack.Create;
+begin
+  FResultsList := TFPList.Create;
+end;
+
+destructor TSuiteResultsStack.Destroy;
+var
+  i: integer;
+begin
+  for i := 0 to FResultsList.Count -1 do 
+    TObject(FResultsList[i]).Free;
+  FResultsList.Free;
+  inherited Destroy;
+end;
+
+function TSuiteResultsStack.Last: TSuiteResults;
+begin
+  Result := TSuiteResults(FResultsList[FResultsList.Count -1]);
+end;
+
+procedure TSuiteResultsStack.RemoveLast;
+begin
+  TObject(FResultsList[FResultsList.Count - 1]).Free;
+  FResultsList.Delete(FResultsList.Count - 1);
+end;
+
+procedure TSuiteResultsStack.Add;
+begin
+  FResultsList.Add(TSuiteResults.Create);
+end;
+
+procedure TSuiteResultsStack.IncrementRuns;
+var
+  i: integer;
+begin
+  for i := 0 to FResultsList.Count -1 do 
+    Inc(TSuiteResults(FResultsList[i]).Runs);
+end;
+
+procedure TSuiteResultsStack.IncrementFailures;
+var
+  i: integer;
+begin
+  for i := 0 to FResultsList.Count -1 do 
+    Inc(TSuiteResults(FResultsList[i]).Failures);
+end;
+
+procedure TSuiteResultsStack.IncrementErrors;
+var
+  i: integer;
+begin
+  for i := 0 to FResultsList.Count -1 do 
+    Inc(TSuiteResults(FResultsList[i]).Errors);
+end;
+
+procedure TSuiteResultsStack.IncrementIgnores;
+var
+  i: integer;
+begin
+  for i := 0 to FResultsList.Count -1 do 
+    Inc(TSuiteResults(FResultsList[i]).Ignores);
+end;
+
+
+constructor TCustomResultsWriter.Create(AOwner: TComponent);
+begin
+  inherited Create(AOwner);
+  FLevel := -1;
+  FCount := 1;
+  FSuiteResultsStack := TSuiteResultsStack.Create;
+end;
+
+destructor TCustomResultsWriter.Destroy;
+begin
+  FSuiteResultsStack.Free;
+  inherited Destroy
+end;
+
+procedure TCustomResultsWriter.AfterConstruction;
+begin
+  WriteHeader;
+end;
+
+procedure TCustomResultsWriter.BeforeDestruction;
+begin
+  WriteFooter;
+end;
+
+procedure TCustomResultsWriter.StartTest(ATest: TTest);
+begin
+  WriteTestHeader(ATest, FLevel, FCount);
+  if Assigned(FOnStartTest) then 
+    FOnStartTest(Self, ATest);
+  FTestTime := Now;
+end;
+
+procedure TCustomResultsWriter.EndTest(ATest: TTest);
+begin
+  Inc(FCount);
+  FTestTime := Now - FTestTime;
+  FSuiteResultsStack.IncrementRuns;
+  WriteTestFooter(ATest, FLevel, FTestTime);
+  if Assigned(FOnEndTest) then 
+    FOnEndTest(Self, ATest);
+end;
+
+procedure TCustomResultsWriter.StartTestSuite(ATestSuite: TTestSuite);
+begin
+  inc(FLevel);
+  WriteSuiteHeader(ATestSuite, FLevel);
+  if Assigned(FOnStartTestSuite) then 
+    FOnStartTestSuite(Self, ATestSuite);
+  FSuiteResultsStack.Add;
+  FSuiteResultsStack.Last.StartTime := now;
+end;
+
+procedure TCustomResultsWriter.EndTestSuite(ATestSuite: TTestSuite);
+begin
+  with FSuiteResultsStack.Last do 
+  begin
+    WriteSuiteFooter(ATestSuite, FLevel, Now - StartTime,
+    Runs, Errors, Failures, Ignores);
+  end;
+  FSuiteResultsStack.RemoveLast;
+  dec(FLevel);
+  if Assigned(FOnEndTestSuite) then 
+    FOnEndTestSuite(Self, ATestSuite);
+end;
+
+procedure TCustomResultsWriter.AddFailure(ATest: TTest; AFailure: TTestFailure);
+begin
+  if AFailure.IsIgnoredTest then 
+    FSuiteResultsStack.IncrementIgnores
+  else 
+    FSuiteResultsStack.IncrementFailures;
+  if Assigned(FOnAddFailure) then 
+    FOnAddFailure(Self, ATest, AFailure);
+end; 
+    
+procedure TCustomResultsWriter.AddError(ATest: TTest; AError: TTestFailure);
+begin
+  FSuiteResultsStack.IncrementErrors;
+  if Assigned(FOnAddError) then 
+    FOnAddError(Self, ATest, AError);
+end;
+
+procedure TCustomResultsWriter.WriteTestHeader(ATest: TTest; ALevel: integer; ACount: integer);
+begin
+  if Assigned(FOnWriteTestHeader) then 
+    FOnWriteTestHeader(Self, ATest, ALevel, ACount);
+end;
+
+procedure TCustomResultsWriter.WriteTestFooter(ATest: TTest; ALevel: integer; 
+  ATiming: TDateTime);
+begin
+  if Assigned(FOnWriteTestFooter) then 
+    FOnWriteTestFooter(Self, ATest, ALevel, ATiming);
+end;
+
+procedure TCustomResultsWriter.WriteSuiteHeader(ATestSuite: TTestSuite; ALevel: integer);
+begin
+  if Assigned(FOnWriteSuiteHeader) then 
+    FOnWriteSuiteHeader(Self, ATestSuite, ALevel);
+end;
+
+procedure TCustomResultsWriter.WriteSuiteFooter(ATestSuite: TTestSuite; ALevel: integer; 
+  ATiming: TDateTime; ANumRuns: integer; ANumErrors: integer; ANumFailures: integer;
+  ANumIgnores: integer);
+begin
+  if Assigned(FOnWriteSuiteFooter) then 
+    FOnWriteSuiteFooter(Self, ATestSuite, ALevel, ATiming, ANumRuns, ANumErrors, 
+      aNumFailures, ANumIgnores);
+end;
+
+procedure TCustomResultsWriter.WriteHeader;
+begin
+  // do nothing
+end;
+
+procedure TCustomResultsWriter.WriteFooter;
+begin
+  // do nothing
+end;
+    
+procedure TCustomResultsWriter.WriteResult(aResult: TTestResult);
+begin
+  // do nothing
+end;
+
+end.
+

+ 262 - 0
fcl/fpcunit/latextestreport.pp

@@ -0,0 +1,262 @@
+{$mode objfpc}
+{$h+}
+{
+    This file is part of the Free Component Library (FCL)
+    Copyright (c) 2006 by Dean Zobec
+
+    an example of latex report for FPCUnit tests.
+
+    See the file COPYING.FPC, included in this distribution,
+    for details about the copyright.
+
+    This program is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+
+ **********************************************************************}
+unit latextestreport;
+
+interface
+
+uses
+  classes, SysUtils, fpcunit, fpcunitreport, strutils;
+
+type
+   
+  TLatexResultsWriter = class(TCustomResultsWriter)
+  private
+    FDoc: TStringList;
+    FSuiteHeaderIdx: TFPList;
+    FTempFailure: TTestFailure;
+  protected
+    class function EscapeText(const S: string): String; virtual;
+    procedure WriteTestHeader(ATest: TTest; ALevel: integer; ACount: integer); override;
+    procedure WriteTestFooter(ATest: TTest; ALevel: integer; ATiming: TDateTime); override;
+    procedure WriteSuiteHeader(ATestSuite: TTestSuite; ALevel: integer); override;
+    procedure WriteSuiteFooter(ATestSuite: TTestSuite; ALevel: integer; 
+      ATiming: TDateTime; ANumRuns: integer; ANumErrors: integer; 
+      ANumFailures: integer; ANumIgnores: integer); override;
+  public
+    constructor Create(aOwner: TComponent); override;
+    destructor  Destroy; override;
+    procedure WriteHeader; override;
+    procedure WriteFooter; override;
+    procedure WriteResult(aResult: TTestResult); override;
+    procedure AddFailure(ATest: TTest; AFailure: TTestFailure); override;
+    procedure AddError(ATest: TTest; AError: TTestFailure); override;
+    procedure StartTest(ATest: TTest); override;
+    procedure EndTest(ATest: TTest); override;
+  end;
+
+function TestSuiteAsLatex(aSuite:TTestSuite): string;
+function GetSuiteAsLatex(aSuite: TTestSuite): string;
+
+implementation
+
+class function TLatexResultsWriter.EscapeText(const S: string): String;
+var
+  i: integer;
+begin
+  SetLength(Result, 0);
+    for i := 1 to Length(S) do
+      case S[i] of
+        '&','{','}','#','_','$','%':     // Escape these characters
+          Result := Result + '\' + S[i];
+        '~','^':
+          Result := Result + '\'+S[i]+' ';
+        '\':
+          Result := Result + '$\backslash$';
+        '<':
+          Result := Result + '$<$';
+        '>':
+          Result := Result + '$>$'
+        else
+          Result := Result + S[i];
+      end;
+end;
+
+constructor TLatexResultsWriter.Create(aOwner: TComponent);
+begin
+  inherited Create(aOwner);
+  FDoc := TStringList.Create;
+  FSuiteHeaderIdx := TFPList.Create;
+  FTempFailure := nil;
+end;
+
+destructor  TLatexResultsWriter.Destroy;
+begin
+  FDoc.Free;
+  FSuiteHeaderIdx.Free;
+  inherited Destroy;
+end;
+
+procedure TLatexResultsWriter.WriteHeader;
+begin
+  inherited WriteHeader;
+  FDoc.Add('\documentclass[a4paper,12pt]{report}');
+  FDoc.Add('\usepackage{fullpage}');
+  FDoc.Add('\usepackage{color}');
+  FDoc.Add('\definecolor{Blue}{rgb}{0.3,0.3,0.9}');
+  FDoc.Add('\definecolor{Red}{rgb}{1,0,0}');
+  FDoc.Add('\definecolor{Pink}{rgb}{1,0,1}');
+  FDoc.Add('\definecolor{Yellow}{rgb}{1,1,0}');
+  FDoc.Add('\author{FPCUnit}');
+  FDoc.Add('\title{Unit tests run by FPCUnit}');
+  FDoc.Add('\begin{document}');
+  FDoc.Add('\maketitle');
+  FDoc.Add('\flushleft');
+end;
+
+procedure TLatexResultsWriter.WriteFooter;
+begin
+  inherited WriteFooter;
+  
+end;
+    
+procedure TLatexResultsWriter.WriteResult(aResult: TTestResult);
+var
+  f: text;
+begin
+  inherited WriteResult(aResult);
+  with aResult do
+  begin
+    FDoc.Insert(11, '\begin{tabular}{ll}');
+    FDoc.Insert(12, '{\bf Number of run tests:} &' + intToStr(RunTests)+ '\\');
+    FDoc.Insert(13, '{\bf Number of errors:} &' + intToStr(NumberOfErrors)+ '\\');
+    FDoc.Insert(14, '{\bf Number of failures:} &' + intToStr(NumberOfFailures)+ '\\');
+    FDoc.Insert(15, '{\bf Number of ignored tests:} &' + intToStr(NumberOfIgnoredTests)+ '\\');
+    FDoc.Insert(16, '\end{tabular}');
+  end;
+  FDoc.Add('\end{document}');
+  system.Assign(f, FileName);
+  rewrite(f);
+  writeln(f, FDoc.Text);
+  close(f);
+end;
+  
+{ITestListener}
+    
+procedure TLatexResultsWriter.AddFailure(ATest: TTest; AFailure: TTestFailure);
+begin
+  inherited AddFailure(ATest, AFailure);
+  FTempFailure := AFailure;
+end;
+
+procedure TLatexResultsWriter.AddError(ATest: TTest; AError: TTestFailure);
+begin
+  inherited;
+  FTempFailure := AError;
+end;
+    
+procedure TLatexResultsWriter.WriteTestHeader(ATest: TTest; ALevel: integer; ACount: integer);
+begin
+  inherited;
+end;
+
+procedure TLatexResultsWriter.WriteTestFooter(ATest: TTest; ALevel: integer; ATiming: TDateTime);
+begin
+  inherited;
+  FDoc.Add(StringOfChar(' ',ALevel*2)+ '  '+ '\item[-] ' + FormatDateTime('ss.zzz', ATiming)  
+    + '  ' + EscapeText(ATest.TestName));
+  if Assigned(FTempFailure) then
+  begin
+    //check if it's an error 
+    if not FTempFailure.IsFailure then 
+    begin
+      FDoc[FDoc.Count -1] := '{\color{Red}'+FDoc[FDoc.Count -1];
+      FDoc.Add('\begin{description}');
+      FDoc.Add('\item[Error:] '+ EscapeText(FTempFailure.ExceptionClassName));
+      FDoc.Add('\item[Exception:]  '+ EscapeText(FTempFailure.ExceptionMessage));
+      FDoc.Add('\item[Source unit:] '+ EscapeText(FTempFailure.SourceUnitName));
+      FDoc.Add('\item[Method name:] '+ EscapeText(FTempFailure.FailedMethodName));
+      FDoc.Add('\item[Line number:] '+ IntToStr(FTempFailure.LineNumber));
+      FDoc.Add('\end{description}}');
+    end
+    else
+      if FTempFailure.IsIgnoredTest then
+      begin
+        FDoc[FDoc.Count -1] := '{\color{Yellow}'+FDoc[FDoc.Count -1] + '  {\bf IGNORED TEST: ' + 
+          EscapeText(FTempFailure.ExceptionMessage) +'}}'
+      end
+      else
+        //is a failure
+        FDoc[FDoc.Count -1] := '{\color{Pink}'+FDoc[FDoc.Count -1] + '  {\bf FAILED: ' + 
+          EscapeText(FTempFailure.ExceptionMessage) +'}}';
+  end;
+  FTempFailure := nil;
+end;
+
+procedure TLatexResultsWriter.WriteSuiteHeader(ATestSuite: TTestSuite; ALevel: integer);
+begin
+  inherited;
+  FDoc.Add('{\bf {\color{Blue}'+ StringOfChar(' ',ALevel*2)+ '\item[-] '+ 
+    EscapeText(ATestSuite.TestName)+ '}}');
+  FSuiteHeaderIdx.Add(Pointer(FDoc.Count - 1));
+  FDoc.Add(StringOfChar(' ',ALevel*2)+ '\begin{itemize}');
+end;
+
+procedure TLatexResultsWriter.WriteSuiteFooter(ATestSuite: TTestSuite; ALevel: integer;
+  ATiming: TDateTime; ANumRuns: integer; ANumErrors: integer; ANumFailures: integer;
+  ANumIgnores: integer);
+var
+  idx: integer;
+begin
+  inherited;
+  FDoc.Add(StringOfChar(' ',ALevel*2)+ ' \end{itemize}');
+  idx := Integer(FSuiteHeaderIdx[FSuiteHeaderIdx.Count -1]);
+  FDoc[idx] := FDoc[idx] + ' {\color{Blue}'+ '  Time:'+ FormatDateTime('ss.zzz', ATiming)+
+    ' N:'+ IntToStr(ANumRuns)+ ' E:'+ IntToStr(ANumErrors)+ ' F:'+ IntToStr(ANumFailures)+ 
+    ' I:'+ IntToStr(ANumIgnores)+'}';
+  FSuiteHeaderIdx.Delete(FSuiteHeaderIdx.Count -1);
+end;
+
+procedure TLatexResultsWriter.StartTest(ATest: TTest);
+begin
+  inherited StartTest(ATest);
+end;
+    
+procedure TLatexResultsWriter.EndTest(ATest: TTest);
+begin
+  inherited EndTest(ATest);
+  
+end;
+
+function TestSuiteAsLatex(aSuite:TTestSuite): string;
+var
+  i,j: integer;
+  s: TTestSuite;
+begin
+  Result := '\flushleft' + System.sLineBreak;
+  for i := 0 to aSuite.Tests.Count - 1 do
+  begin
+    s := TTestSuite(ASuite.Tests.Items[i]);
+    Result := Result + TLatexResultsWriter.EscapeText(s.TestSuiteName) + System.sLineBreak;
+    Result := Result + '\begin{itemize}'+ System.sLineBreak;
+    for j := 0 to s.Tests.Count - 1 do
+      if TTest(s.Tests.Items[j]) is TTestCase then
+        Result := Result + '\item[-] ' + 
+          TLatexResultsWriter.EscapeText(TTestcase(s.Tests.Items[j]).TestName)
+          + System.sLineBreak;
+    Result := Result +'\end{itemize}' + System.sLineBreak;
+  end;
+end;
+
+
+function GetSuiteAsLatex(aSuite: TTestSuite): string;
+begin
+  if aSuite <> nil then
+    begin
+      Result := '\documentclass[a4paper,12pt]{article}' + System.sLineBreak;
+      Result := Result + '\usepackage{array}' + System.sLineBreak;
+      Result := Result + '\usepackage{mdwlist}' + System.sLineBreak + System.sLineBreak;
+      Result := Result + '\begin{document}' + System.sLineBreak + System.sLineBreak;
+      if aSuite.TestName = '' then
+        aSuite.TestName := 'Test Suite';
+      Result := Result + TestSuiteAsLatex(aSuite);
+      Result := Result + '\end{document}';
+    end
+  else
+    Result := '';
+end;
+
+end.

+ 238 - 0
fcl/fpcunit/plaintestreport.pp

@@ -0,0 +1,238 @@
+{$mode objfpc}
+{$h+}
+{
+    This file is part of the Free Component Library (FCL)
+    Copyright (c) 2006 by Dean Zobec
+
+    an example of plain text report for FPCUnit tests.
+
+    See the file COPYING.FPC, included in this distribution,
+    for details about the copyright.
+
+    This program is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+
+ **********************************************************************}
+unit plaintestreport;
+
+interface
+
+uses
+  classes, SysUtils, fpcunit, fpcunitreport;
+
+type
+
+  TPlainResultsWriter = class(TCustomResultsWriter)
+  private
+    FDoc: TStringList;
+    FSuiteHeaderIdx: TFPList;
+    FTempFailure: TTestFailure;
+  protected
+    procedure WriteTestHeader(ATest: TTest; ALevel: integer; ACount: integer); override;
+    procedure WriteTestFooter(ATest: TTest; ALevel: integer; ATiming: TDateTime); override;
+    procedure WriteSuiteHeader(ATestSuite: TTestSuite; ALevel: integer); override;
+    procedure WriteSuiteFooter(ATestSuite: TTestSuite; ALevel: integer; 
+      ATiming: TDateTime; ANumRuns: integer; ANumErrors: integer; 
+      ANumFailures: integer; ANumIgnores: integer); override;
+  public
+    constructor Create(aOwner: TComponent); override;
+    destructor  Destroy; override;
+    procedure WriteHeader; override;
+    procedure WriteResult(aResult: TTestResult); override;
+    procedure AddFailure(ATest: TTest; AFailure: TTestFailure); override;
+    procedure AddError(ATest: TTest; AError: TTestFailure); override;
+  end;
+
+function TestSuiteAsPlain(aSuite:TTestSuite): string;
+function GetSuiteAsPlain(aSuite: TTestSuite): string;
+function TestResultAsPlain(aTestResult: TTestResult): string;
+
+implementation
+
+
+{TPlainResultsWriter}
+
+constructor TPlainResultsWriter.Create(aOwner: TComponent);
+begin
+  inherited Create(aOwner);
+  FDoc := TStringList.Create;
+  FSuiteHeaderIdx := TFPList.Create;
+  FTempFailure := nil;
+end;
+
+destructor  TPlainResultsWriter.Destroy;
+begin
+  FDoc.Free;
+  FSuiteHeaderIdx.Free;
+  inherited Destroy;
+end;
+
+procedure TPlainResultsWriter.WriteHeader;
+begin
+end;
+
+procedure TPlainResultsWriter.WriteResult(aResult: TTestResult);
+var
+  f: text;
+begin
+  system.Assign(f, FileName);
+  rewrite(f);
+  FDoc.Add('');
+  FDoc.Add(TestResultAsPlain(aResult));
+  writeln(f, FDoc.Text);
+  close(f);
+end;
+
+procedure TPlainResultsWriter.AddFailure(ATest: TTest; AFailure: TTestFailure);
+begin
+  inherited AddFailure(ATest, AFailure);
+  FTempFailure := AFailure;
+end;
+
+procedure TPlainResultsWriter.AddError(ATest: TTest; AError: TTestFailure);
+begin
+  inherited AddError(ATest, AError);
+  FTempFailure := AError;
+end;
+
+procedure TPlainResultsWriter.WriteTestHeader(ATest: TTest; ALevel: integer; ACount: integer);
+begin
+  inherited;
+end;
+
+procedure TPlainResultsWriter.WriteTestFooter(ATest: TTest; ALevel: integer; ATiming: TDateTime);
+begin
+  inherited;
+  FDoc.Add('  ' + StringOfChar(' ',ALevel*2) +  FormatDateTime('ss.zzz', ATiming) + '  ' 
+    + ATest.TestName);
+  if Assigned(FTempFailure) then
+  begin
+    //check if it's an error 
+    if not FTempFailure.IsFailure then 
+    begin
+      FDoc[FDoc.Count -1] := FDoc[FDoc.Count -1] + '  Error: ' + FTempFailure.ExceptionClassName;
+      FDoc.Add(StringOfChar(' ',ALevel*2) + '    Exception:   ' + FTempFailure.ExceptionMessage);
+      FDoc.Add(StringOfChar(' ',ALevel*2) + '    Source unit: ' + FTempFailure.SourceUnitName);
+      FDoc.Add(StringOfChar(' ',ALevel*2) + '    Method name: ' + FTempFailure.FailedMethodName);
+      FDoc.Add(StringOfChar(' ',ALevel*2) + '    Line number: ' 
+        + IntToStr(FTempFailure.LineNumber));
+    end
+    else
+      if FTempFailure.IsIgnoredTest then
+      begin
+         FDoc[FDoc.Count -1] := FDoc[FDoc.Count -1] + '  Ignored test: ' 
+           + FTempFailure.ExceptionMessage;
+      end
+      else
+        //is a failure
+        FDoc[FDoc.Count -1] := FDoc[FDoc.Count -1] + '  Failed: ' 
+          + FTempFailure.ExceptionMessage;
+  end;
+  FTempFailure := nil;
+end;
+
+procedure TPlainResultsWriter.WriteSuiteFooter(ATestSuite: TTestSuite; ALevel: integer; 
+  ATiming: TDateTime; ANumRuns: integer; ANumErrors: integer; ANumFailures: integer;
+  ANumIgnores: integer);
+var
+  idx: integer;
+begin
+  inherited;
+  idx := Integer(FSuiteHeaderIdx[FSuiteHeaderIdx.Count -1]);
+  FDoc[idx] := FDoc[idx] + ' Time:'+ FormatDateTime('ss.zzz', ATiming)+
+    ' N:'+ IntToStr(ANumRuns)+ ' E:'+ IntToStr(ANumErrors)+ ' F:'+ IntToStr(ANumFailures)+ 
+    ' I:'+ IntToStr(ANumIgnores);
+  FSuiteHeaderIdx.Delete(FSuiteHeaderIdx.Count -1);
+end;
+
+procedure TPlainResultsWriter.WriteSuiteHeader(ATestSuite: TTestSuite; ALevel: integer);
+begin
+  inherited;
+  FDoc.Add(StringOfChar(' ',ALevel*2) + ATestSuite.TestName);
+  FSuiteHeaderIdx.Add(Pointer(FDoc.Count - 1));
+end;
+
+function TestSuiteAsPlain(aSuite:TTestSuite): string;
+var
+  i: integer;
+begin
+  Result := '';
+  for i := 0 to aSuite.Tests.Count - 1 do
+    if TTest(aSuite.Tests.Items[i]) is TTestSuite then
+      Result := Result + TestSuiteAsPlain(TTestSuite(aSuite.Tests.Items[i]))
+    else
+      if TTest(aSuite.Tests.Items[i]) is TTestCase then
+        Result := Result + '  ' + ASuite.TestName+'.' + TTestcase(aSuite.Tests.Items[i]).TestName + System.sLineBreak;
+end;
+
+function GetSuiteAsPlain(aSuite: TTestSuite): string;
+begin
+  Result := '';
+
+  if aSuite <> nil then
+    Result := 'TestSuites: ' + System.sLineBreak + TestSuiteAsPlain(aSuite);
+end;
+
+function TestResultAsPlain(aTestResult: TTestResult): string;
+var
+  i: longint;
+  f: TTestFailure;
+begin
+  with aTestResult do
+  begin
+    Result :=          'Number of run tests: ' + intToStr(RunTests) + System.sLineBreak;
+    Result := Result + 'Number of errors:    ' + intToStr(NumberOfErrors) + System.sLineBreak;
+    Result := Result + 'Number of failures:  ' + intToStr(NumberOfFailures);
+    if NumberOfErrors <> 0 then
+    begin
+      Result := Result + System.sLineBreak;
+      Result := Result + System.sLineBreak;
+      Result := Result + 'List of errors:';
+      for i := 0 to Errors.Count - 1 do
+      begin
+        Result := Result + System.sLineBreak;
+        Result := Result + '  Error: ' + System.sLineBreak;
+        f := TTestFailure(Errors.Items[i]);
+        Result := Result + '    Message:           ' + f.AsString + System.sLineBreak;
+        Result := Result + '    Exception class:   ' + f.ExceptionClassName + System.sLineBreak;
+        Result := Result + '    Exception message: ' + f.ExceptionMessage + System.sLineBreak;
+        Result := Result + '    Source unitname:   ' + f.SourceUnitName + System.sLineBreak;
+        Result := Result + '    Line number:       ' + IntToStr(f.LineNumber) + System.sLineBreak;
+        Result := Result + '    Failed methodname: ' + f.FailedMethodName + System.sLineBreak;
+      end;
+    end;
+    if NumberOfFailures <> 0 then
+    begin
+      Result := Result + System.sLineBreak;
+      Result := Result + System.sLineBreak;
+      Result := Result + 'List of failures:' + System.sLineBreak;
+      for i := 0 to Failures.Count - 1 do
+      begin
+        Result := Result + '  Failure: ' + System.sLineBreak;
+        f := TTestFailure(Failures.Items[i]);
+        Result := Result + '    Message:           ' + f.AsString + System.sLineBreak;
+        Result := Result + '    Exception class:   ' + f.ExceptionClassName + System.sLineBreak;
+        Result := Result + '    Exception message: ' + f.ExceptionMessage + System.sLineBreak;
+      end;
+    end;
+   if NumberOfIgnoredTests <> 0 then
+    begin
+      Result := Result + System.sLineBreak;
+      Result := Result + System.sLineBreak;
+      Result := Result + 'List of ignored tests:' + System.sLineBreak;
+      for i := 0 to IgnoredTests.Count - 1 do
+      begin
+        Result := Result + '  Ignored test: ' + System.sLineBreak;
+        f := TTestFailure(IgnoredTests.Items[i]);
+        Result := Result + '    Message:           ' + f.AsString + System.sLineBreak;
+        Result := Result + '    Exception class:   ' + f.ExceptionClassName + System.sLineBreak;
+        Result := Result + '    Exception message: ' + f.ExceptionMessage + System.sLineBreak;
+      end;
+    end;
+  end;
+  Result := Result + System.sLineBreak;
+end;
+
+
+end.

+ 241 - 0
fcl/fpcunit/xmltestreport.pp

@@ -0,0 +1,241 @@
+{
+    This file is part of the Free Component Library (FCL)
+    Copyright (c) 2006 by Dean Zobec, Graeme Geldenhuys
+
+    an example of XML report for FPCUnit tests.
+
+    See the file COPYING.FPC, included in this distribution,
+    for details about the copyright.
+
+    This program is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+
+ **********************************************************************
+  
+
+  Purpose:
+    This unit contains a XML TestListener for use with the fpcUnit testing
+    framework.  It uses the XMLWrite unit, which is part of FPC, to generate
+    the XML document. The benefit of using the XMLWrite unit, is that the
+    data generated is valid XML, with resevered characters correctly escaped.
+    This allows the XML document to be further processed with XSLT etc without
+    any issues.
+
+}
+
+unit xmltestreport;
+
+{$mode objfpc}{$H+}
+
+interface
+
+uses
+  Classes, SysUtils,fpcunit, fpcunitreport, testutils, dom, XMLWrite;
+  
+
+type
+
+  { TXMLResultsWriter }
+
+  TXMLResultsWriter = class(TCustomResultsWriter)
+  private
+    FDoc: TXMLDocument;
+    FResults, FListing: TDOMNode;
+    FSuitePath: TFPList;
+    FCurrentTest: TDOMElement;
+  protected
+    procedure WriteTestHeader(ATest: TTest; ALevel: integer; ACount: integer); override;
+    procedure WriteTestFooter(ATest: TTest; ALevel: integer; ATiming: TDateTime); override;
+    procedure WriteSuiteHeader(ATestSuite: TTestSuite; ALevel: integer); override;
+    procedure WriteSuiteFooter(ATestSuite: TTestSuite; ALevel: integer; 
+      ATiming: TDateTime; ANumRuns: integer; ANumErrors: integer; 
+      ANumFailures: integer; ANumIgnores: integer); override;
+  public
+    constructor Create(aOwner: TComponent); override;
+    destructor  Destroy; override;
+    procedure WriteHeader; override;
+    procedure WriteFooter; override;
+    procedure AddFailure(ATest: TTest; AFailure: TTestFailure); override;
+    procedure AddError(ATest: TTest; AError: TTestFailure); override;
+    procedure StartTest(ATest: TTest); override;
+    procedure EndTest(ATest: TTest); override;
+    procedure WriteResult(aResult: TTestResult); override;
+  end;
+
+
+implementation
+
+
+{ TXMLResultsWriter }
+
+procedure TXMLResultsWriter.WriteTestHeader(ATest: TTest; ALevel: integer; ACount: integer);
+var
+  n: TDOMElement;
+begin
+  inherited;
+  n := FDoc.CreateElement('Test');
+  n['Name'] := ATest.TestName;
+  n['Result'] := 'OK';
+  TDOMElement(FSuitePath[FSuitePath.Count -1]).AppendChild(n);
+  FCurrentTest := n;
+end;
+
+procedure TXMLResultsWriter.WriteTestFooter(ATest: TTest; ALevel: integer; ATiming: TDateTime);
+begin
+  inherited;
+  FCurrentTest['ElapsedTime'] := FormatDateTime('hh:nn:ss.zzz', ATiming);
+end;
+
+
+procedure TXMLResultsWriter.WriteSuiteHeader(ATestSuite: TTestSuite; ALevel: integer);
+var
+  n: TDOMElement;
+begin
+  inherited;
+  n := FDoc.CreateElement('TestSuite');
+  FSuitePath.Add(n); 
+  n['Name'] := ATestSuite.TestName;
+  if FSuitePath.Count = 1 then
+    FListing.AppendChild(n)
+  else
+    TDOMElement(FSuitePath[FSuitePath.Count -2]).AppendChild(n);
+end;
+
+
+procedure TXMLResultsWriter.WriteSuiteFooter(ATestSuite: TTestSuite; ALevel: integer; 
+  ATiming: TDateTime; ANumRuns: integer; ANumErrors: integer; ANumFailures: integer;
+  ANumIgnores: integer);
+var
+  n: TDOMElement;
+begin
+  inherited;
+  n := TDomElement(FSuitePath[FSuitePath.Count -1]);
+  n['ElapsedTime'] := FormatDateTime('hh:nn:ss.zzz', ATiming);
+  n['NumberOfRunTests'] := IntToStr(ANumRuns);
+  n['NumberOfErrors'] := IntToStr(ANumErrors);
+  n['NumberOfFailures'] := IntToStr(ANumFailures);
+  n['NumberOfIgnoredTests'] := IntToStr(ANumIgnores);
+  FSuitePath.Delete(FSuitePath.Count -1);
+end;
+
+constructor TXMLResultsWriter.Create(aOwner: TComponent);
+begin
+  inherited Create(aOwner);
+  FDoc:= TXMLDocument.Create;
+  FSuitePath := TFPList.Create;
+  FResults := nil;
+  FListing := nil;
+end;
+
+destructor  TXMLResultsWriter.Destroy;
+begin
+  FResults := nil;
+  FListing := nil;
+  FSuitePath.Free;
+  FDoc.Free;
+  inherited Destroy;
+end;
+
+
+procedure TXMLResultsWriter.WriteHeader;
+begin
+  inherited;
+  FResults := FDoc.CreateElement('TestResults');
+  FResults.AppendChild(FDoc.CreateComment(' Generated using FPCUnit on '
+    + FormatDateTime('yyyy-mm-dd hh:mm:ss', Now) ));
+  FDoc.AppendChild(FResults);
+  FListing := FDoc.CreateElement('TestListing');
+  FResults.AppendChild(FListing);
+end;
+
+
+procedure TXMLResultsWriter.WriteFooter;
+begin
+  inherited;
+end;
+
+procedure TXMLResultsWriter.AddFailure(ATest: TTest; AFailure: TTestFailure);
+begin
+  inherited;
+  if AFailure.IsIgnoredTest then
+    FCurrentTest['Result'] := 'Ignored'
+  else  
+    FCurrentTest['Result'] := 'Failed';
+    FCurrentTest.AppendChild(FDoc.CreateElement('Message')).AppendChild
+      (FDoc.CreateTextNode(AFailure.AsString));
+    FCurrentTest.AppendChild(FDoc.CreateElement('ExceptionClass')).AppendChild
+      (FDoc.CreateTextNode(AFailure.ExceptionClassName));
+    FCurrentTest.AppendChild(FDoc.CreateElement('ExceptionMessage')).AppendChild
+      (FDoc.CreateTextNode(AFailure.ExceptionMessage));
+end;
+
+procedure TXMLResultsWriter.AddError(ATest: TTest; AError: TTestFailure);
+begin
+  inherited;
+  FCurrentTest['Result'] := 'Error';
+  FCurrentTest.AppendChild(FDoc.CreateElement('Message')).AppendChild
+    (FDoc.CreateTextNode(AError.AsString));
+  FCurrentTest.AppendChild(FDoc.CreateElement('ExceptionClass')).AppendChild
+    (FDoc.CreateTextNode(AError.ExceptionClassName));
+  FCurrentTest.AppendChild(FDoc.CreateElement('ExceptionMessage')).AppendChild
+    (FDoc.CreateTextNode(AError.ExceptionMessage));
+  FCurrentTest.AppendChild(FDoc.CreateElement('SourceUnitName')).AppendChild
+    (FDoc.CreateTextNode(AError.SourceUnitName));
+  FCurrentTest.AppendChild(FDoc.CreateElement('LineNumber')).AppendChild
+    (FDoc.CreateTextNode(IntToStr(AError.LineNumber)));
+  FCurrentTest.AppendChild(FDoc.CreateElement('FailedMethodName')).AppendChild
+    (FDoc.CreateTextNode(AError.FailedMethodName));
+end;
+
+
+procedure TXMLResultsWriter.StartTest(ATest: TTest);
+begin
+  inherited;
+end;
+
+
+procedure TXMLResultsWriter.EndTest(ATest: TTest);
+begin
+  inherited;
+end;
+
+procedure TXMLResultsWriter.WriteResult(aResult: TTestResult);
+var
+  n, lResults: TDOMNode;
+  f: text;
+begin
+  lResults := FDoc.FindNode('TestResults');
+  n := FDoc.CreateElement('NumberOfRunTests');
+  n.AppendChild(FDoc.CreateTextNode(IntToStr(aResult.RunTests)));
+  lResults.AppendChild(n);
+
+  n := FDoc.CreateElement('NumberOfErrors');
+  n.AppendChild(FDoc.CreateTextNode(IntToStr(aResult.NumberOfErrors)));
+  lResults.AppendChild(n);
+
+  n := FDoc.CreateElement('NumberOfFailures');
+  n.AppendChild(FDoc.CreateTextNode(IntToStr(aResult.NumberOfFailures)));
+  lResults.AppendChild(n);
+  
+  n := FDoc.CreateElement('NumberOfIgnoredTests');
+  n.AppendChild(FDoc.CreateTextNode(IntToStr(aResult.NumberOfIgnoredTests)));
+  lResults.AppendChild(n);
+
+  n := FDoc.CreateElement('TotalElapsedTime');
+  n.AppendChild(FDoc.CreateTextNode(FormatDateTime('hh:nn:ss.zzz', 
+    Now - aResult.StartingTime)));
+  lResults.AppendChild(n);     
+
+  { Summary of ISO 8601  http://www.cl.cam.ac.uk/~mgk25/iso-time.html }
+  n := FDoc.CreateElement('DateTimeRan');
+  n.AppendChild(FDoc.CreateTextNode(FormatDateTime('yyyy-mm-dd hh:mm:ss', Now)));
+  lResults.AppendChild(n);
+  system.Assign(f, FileName);
+  rewrite(f);
+  WriteXMLFile(FDoc, f);
+  close(f);
+end;
+
+end.
+

+ 0 - 0
fcl/fpcunit/DUnitCompatibleInterface.inc → fcl/inc/DUnitCompatibleInterface.inc


+ 0 - 0
fcl/fpcunit/fpcunit.pp → fcl/inc/fpcunit.pp


+ 0 - 0
fcl/fpcunit/testutils.pp → fcl/inc/testutils.pp


Some files were not shown because too many files changed in this diff