2015-05-13 10:40:46 +00:00
|
|
|
@setlocal
|
|
|
|
@REM echo off
|
2011-11-17 02:44:16 +00:00
|
|
|
|
2015-05-13 10:40:46 +00:00
|
|
|
@REM execute a single test case of the accessibility test suite
|
|
|
|
@REM
|
|
|
|
@REM (c) 2006 (W3C) MIT, ERCIM, Keio University
|
|
|
|
@REM See tidy.c for the copyright notice.
|
|
|
|
@REM
|
|
|
|
@REM <URL:http://www.html-tidy.org/>
|
|
|
|
@REM
|
|
|
|
@echo Testing %1 %2 %3
|
|
|
|
@set TESTNO=%1
|
|
|
|
@set TESTEXPECTED=%2
|
|
|
|
@set ACCESSLEVEL=%3
|
|
|
|
@if "%1x" == "x" goto NOTEST
|
|
|
|
@if "%2x" == "x" goto NOEXPECT
|
|
|
|
@if "%3x" == "x" goto NOLEVEL
|
|
|
|
@if "%TIDYLOG%x" == "x" goto NOLOG
|
2011-11-17 02:44:16 +00:00
|
|
|
|
2015-05-13 10:40:46 +00:00
|
|
|
@set INFILES=%TIDYINPUT%\%1.*ml
|
|
|
|
@set CFGFILE=%TIDYINPUT%\cfg_%1.txt
|
2011-11-17 02:44:16 +00:00
|
|
|
|
2015-05-13 10:40:46 +00:00
|
|
|
@set TIDYFILE=%TIDYOUT%\out_%1.html
|
|
|
|
@set MSGFILE=%TIDYout%\msg_%1.txt
|
2011-11-17 02:44:16 +00:00
|
|
|
|
2015-05-13 10:40:46 +00:00
|
|
|
@set HTML_TIDY=
|
2011-11-17 02:44:16 +00:00
|
|
|
|
2015-05-13 10:40:46 +00:00
|
|
|
@REM If no test specific config file, use default.
|
|
|
|
@if NOT exist %CFGFILE% @set CFGFILE=%TIDYINPUT%\cfg_default.txt
|
2011-11-17 02:44:16 +00:00
|
|
|
|
2015-05-13 10:40:46 +00:00
|
|
|
@REM Get specific input file name
|
|
|
|
@for %%F in ( %INFILES% ) do @set INFILE=%%F
|
2011-11-17 02:44:16 +00:00
|
|
|
|
2015-05-13 10:40:46 +00:00
|
|
|
@if EXIST %INFILE% goto DOIT
|
2011-11-17 02:44:16 +00:00
|
|
|
@echo ERROR: Can NOT locate [%INFILE%] ... aborting test ...
|
2015-05-13 10:40:46 +00:00
|
|
|
@echo ======================================= >> %TIDYLOG%
|
|
|
|
@echo Testing %1 %2 %3 >> %TIDYLOG%
|
|
|
|
@echo ERROR: Can NOT locate [%INFILE%] ... aborting test ... >> %TIDYLOG%
|
2011-11-17 02:44:16 +00:00
|
|
|
@goto done
|
|
|
|
|
|
|
|
:DOIT
|
2015-05-13 10:40:46 +00:00
|
|
|
@REM Remove any pre-existing test outputs
|
|
|
|
@if exist %MSGFILE% del %MSGFILE%
|
|
|
|
@if exist %TIDYFILE% del %TIDYFILE%
|
2011-11-17 02:44:16 +00:00
|
|
|
|
2015-05-13 10:40:46 +00:00
|
|
|
@REM this has to all one line ...
|
|
|
|
@%TIDY% -f %MSGFILE% --accessibility-check %ACCESSLEVEL% -config %CFGFILE% --gnu-emacs yes --tidy-mark no -o %TIDYFILE% %INFILE%
|
2011-11-17 02:44:16 +00:00
|
|
|
|
|
|
|
@REM output the FIND count to the a result file
|
2015-05-13 10:40:46 +00:00
|
|
|
@find /c "%TESTEXPECTED%" %MSGFILE% > tempres.txt
|
2011-11-17 02:44:16 +00:00
|
|
|
@REM load the find count, token 3, into variable RESULT
|
2015-05-13 10:40:46 +00:00
|
|
|
@for /F "tokens=3" %%i in (tempres.txt) do @set RESULT=%%i
|
2011-11-17 02:44:16 +00:00
|
|
|
@REM test the RESULT variable ...
|
2015-05-13 10:40:46 +00:00
|
|
|
@if "%RESULT%." == "0." goto Err
|
|
|
|
@if "%RESULT%." == "1." goto done
|
2011-11-17 02:44:16 +00:00
|
|
|
@REM echo note - test '%TESTEXPECTED%' found %RESULT% times in file '%INFILE%'
|
2015-05-13 10:40:46 +00:00
|
|
|
@goto done
|
2011-11-17 02:44:16 +00:00
|
|
|
|
|
|
|
:Err
|
2015-05-13 10:40:46 +00:00
|
|
|
@echo FAILED --- test '%TESTEXPECTED%' not detected in file '%INFILE%'
|
|
|
|
@type %MSGFILE%
|
|
|
|
@echo FAILED --- test '%TESTEXPECTED%' not detected in above
|
|
|
|
@set FAILEDACC=%FAILEDACC% %1
|
|
|
|
@REM append results to the ACCERR.TXT file
|
|
|
|
@echo ======================================= >> %TIDYLOG%
|
|
|
|
@echo %TIDY% -f %MSGFILE% --accessibility-check %ACCESSLEVEL% -config %CFGFILE% --gnu-emacs yes --tidy-mark no -o %TIDYFILE% %INFILE% >> %TIDYLOG%
|
|
|
|
@echo FAILED --- test '%TESTEXPECTED%' not detected in file '%MSGFILE%', as follows - >> %TIDYLOG%
|
|
|
|
@type %MSGFILE% >> %TIDYLOG%
|
|
|
|
@echo FAILED --- test '%TESTEXPECTED%' not detected in above >> %TIDYLOG%
|
|
|
|
@goto done
|
|
|
|
|
|
|
|
:NOTEST
|
|
|
|
@echo Error: NO test number given as the first command!
|
|
|
|
:NOEXPECT
|
|
|
|
@echo Error: NO expected result given as the second command!
|
|
|
|
:NOLEVEL
|
|
|
|
@echo Error: NO accesslevel given as the thrid command!
|
|
|
|
@goto HELP
|
|
|
|
|
|
|
|
:NOLOG
|
|
|
|
@echo.
|
|
|
|
@echo Error: TIDYLOG NOT set in the environment!!! This is set in acctest.cmd
|
|
|
|
:HELP
|
|
|
|
@echo The file acctest.cmd should be used to run this cmd...
|
|
|
|
@echo Use Ctrl+c to abort, to fix...
|
|
|
|
@pause
|
|
|
|
@goto NOLOG
|
2011-11-17 02:44:16 +00:00
|
|
|
|
|
|
|
:done
|
2015-05-13 10:40:46 +00:00
|
|
|
@endlocal
|