1@echo off
2
3REM execute a single test case of the accessibility test suite
4REM
5REM (c) 2006 (W3C) MIT, ERCIM, Keio University
6REM See tidy.c for the copyright notice.
7REM
8REM <URL:http://tidy.sourceforge.net/>
9REM
10REM CVS Info:
11REM
12REM    $Author: iccir $
13REM    $Date: 2007/01/31 02:33:39 $
14REM    $Revision: 1.1 $
15
16echo Testing %1 %2 %3
17set TESTNO=%1
18set TESTEXPECTED=%2
19set ACCESSLEVEL=%3
20
21set INFILES=%TIDYINPUT%\%1.*ml
22set CFGFILE=%TIDYINPUT%\cfg_%1.txt
23
24set TIDYFILE=%TIDYOUT%\out_%1.html
25set MSGFILE=%TIDYout%\msg_%1.txt
26
27set HTML_TIDY=
28
29REM If no test specific config file, use default.
30if NOT exist %CFGFILE% set CFGFILE=%TIDYINPUT%\cfg_default.txt
31
32REM Get specific input file name
33for %%F in ( %INFILES% ) do set INFILE=%%F
34
35if EXIST %INFILE% goto DOIT
36@echo ERROR: Can NOT locate [%INFILE%] ... aborting test ...
37@echo ======================================= >> ACCERR.TXT
38@echo Testing %1 %2 %3 >> ACCERR.TXT
39@echo ERROR: Can NOT locate [%INFILE%] ... aborting test ... >> ACCERR.TXT
40@goto done
41
42:DOIT
43REM Remove any pre-existing test outputs
44if exist %MSGFILE%  del %MSGFILE%
45if exist %TIDYFILE% del %TIDYFILE%
46
47REM this has to all one line ...
48%TIDY% -f %MSGFILE% --accessibility-check %ACCESSLEVEL% -config %CFGFILE% --gnu-emacs yes --tidy-mark no -o %TIDYFILE% %INFILE%
49
50@REM output the FIND count to the a result file
51find /c "%TESTEXPECTED%" %MSGFILE% > tempres.txt
52@REM load the find count, token 3, into variable RESULT
53for /F "tokens=3" %%i in (tempres.txt) do set RESULT=%%i
54@REM test the RESULT variable ...
55if "%RESULT%." == "0." goto Err
56if "%RESULT%." == "1." goto done
57@REM echo note - test '%TESTEXPECTED%' found %RESULT% times in file '%INFILE%'
58goto done
59
60:Err
61echo FAILED --- test '%TESTEXPECTED%' not detected in file '%INFILE%'
62type %MSGFILE%
63echo FAILED --- test '%TESTEXPECTED%' not detected in above
64set FAILEDACC=%FAILEDACC% %1
65REM append results to the ACCERR.TXT file
66echo ======================================= >> ACCERR.TXT
67echo %TIDY% -f %MSGFILE% --accessibility-check %ACCESSLEVEL% -config %CFGFILE% --gnu-emacs yes --tidy-mark no -o %TIDYFILE% %INFILE% >> ACCERR.TXT
68echo FAILED --- test '%TESTEXPECTED%' not detected in file '%MSGFILE%', as follows - >> ACCERR.TXT
69type %MSGFILE% >> ACCERR.TXT
70echo FAILED --- test '%TESTEXPECTED%' not detected in above >> ACCERR.TXT
71goto done
72
73:done
74