Files
harbour-core/harbour/tests/test_all.prg
Viktor Szakats 2242853a44 2012-07-22 15:55 UTC+0200 Viktor Szakats (vszakats syenar.net)
* contrib/hbide/idestylesheets.prg
  * contrib/hbide/idetags.prg
    ! fixed wrong usage of hb_B*() raw string functions

  * contrib/hbmysql/utils/dbf2mysq.prg
    * formatting

  * contrib/hbpgsql/tests/dbf2pg.prg
  * extras/httpsrv/session.prg
  * extras/hbvpdf/hbvpdf.prg
  * extras/hbvpdf/hbvpdft.prg
  * tests/rddtest/rddtst.prg
    * using F_ERROR instead of -1

  * contrib/hbtip/tests/dnldftp.prg
  * contrib/hbtip/tests/upld_ftp.prg
  * tests/codebloc.prg
  * tests/recursiv.prg
  * tests/test_all.prg
  * tests/testdbf.prg
  * tests/teststr.prg
    * using hb_eol() instead of explict chr() values
2012-07-22 13:59:53 +00:00

75 lines
1.8 KiB
Plaintext

//NOTEST
/*
* $Id$
*/
/* AutoMatic Test Bank
Patrick Mast and David G. Holm
Compiler independent, but not platform independent (creates a DOS style batch file).
Specify the hbxxx batch file name to use to build with on the command line.
Defaults to "run_prg".
The test_all.bat batch file has restart capability. For example, if there is an error
in testgt.prg, find and fix the problem, then restart by running "TEST_ALL TESTGT".
*/
#include "directry.ch"
#include "fileio.ch"
PROCEDURE Main( cOption, cCmd )
LOCAL aDir, f, n, o, p, cRead
SET DATE ANSI
SET CENTURY ON
aDir := Directory( "*.prg" )
o := FCreate( "test_all.bat" )
IF Empty( cOption )
cOption := "run_prg"
ENDIF
IF Empty( cCmd )
cCmd := "call "
ELSE
cCmd += " /c "
ENDIF
FWrite( o, "if not .%1==. goto %1" + Chr( 13 ) + Chr( 10 ) )
FOR f := 1 TO Len( aDir )
IF TestIt( aDir[ f ][ F_NAME ] )
p := At( ".prg", Lower( aDir[ f ][ F_NAME ] ) )
IF p > 1
n := Left( aDir[ f ][ F_NAME ], p - 1 )
FWrite( o, ":" + n + Chr( 13 ) + Chr( 10 ) )
FWrite( o, cCmd + cOption + " " + n + Chr( 13 ) + Chr( 10 ) +;
"if errorlevel 1 goto end" + Chr( 13 ) + Chr( 10 ) + Chr( 13 ) + Chr( 10 ) )
ENDIF
ENDIF
NEXT
FWrite( o, ":END" + Chr( 13 ) + Chr( 10 ) )
FClose( o )
RETURN
FUNCTION TestIt( cFile )
LOCAL nH1, lRetu, nH2
nH1 := FOpen( cFile )
lRetu := !( Upper( FReadStr( nH1, 8 ) ) == "//NOTEST" )
FClose( nH1 )
IF ! lRetu
IF ! hb_FileExists( "NotTestd.txt" )
nH2 := FCreate( "nottestd.txt" )
ELSE
nH2 := FOpen( "nottestd.txt", FO_WRITE )
ENDIF
FSeek( nH2, 0, FS_END )
FWrite( nH2, DToC( Date() ) + " " + Time() + " " + cFile + hb_eol() )
FClose( nH2 )
ENDIF
RETURN lRetu