OSDN Git Service

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