OSDN Git Service

Initial commit
[wordring-tm/wordring-tm.git] / third_party / tidy-html5-master / test / onetest.cmd
1 @echo off
2 @set TMPTEST=temptest.txt
3 REM onetest.cmd - execute a single test case
4 REM
5 REM (c) 1998-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 @if "%TIDY%." == "." goto Err1
12 @if NOT EXIST %TIDY% goto Err2
13 @if "%TIDYOUT%." == "." goto Err3
14 @if NOT EXIST %TIDYOUT%\nul goto Err4
15 @if NOT EXIST input\nul goto Err5
16
17 set TESTNO=%1
18 set EXPECTED=%2
19
20 set INFILES=input\in_%1.*ml
21 set CFGFILE=input\cfg_%1.txt
22
23 set TIDYFILE=%TIDYOUT%\out_%1.html
24 set MSGFILE=%TIDYOUT%\msg_%1.txt
25
26 set HTML_TIDY=
27
28 REM If no test specific config file, use default.
29 if NOT exist %CFGFILE% set CFGFILE=input\cfg_default.txt
30
31 REM Get specific input file name
32 @set INFILE=
33 for %%F in ( %INFILES% ) do set INFILE=%%F 
34 @if "%INFILE%." == "." goto Err6
35 @if NOT EXIST %INFILE% goto Err7
36
37 REM Remove any pre-exising test outputs
38 if exist %MSGFILE%  del %MSGFILE%
39 if exist %TIDYFILE% del %TIDYFILE%
40
41 @REM Noisy output, or quiet
42 @REM echo Testing %1 input %INFILE% config %CFGFILE% ...
43 @echo Doing: '%TIDY% -f %MSGFILE% -config %CFGFILE% %3 %4 %5 %6 %7 %8 %9 --tidy-mark no -o %TIDYFILE% %INFILE% >> %TMPTEST%
44
45 @%TIDY% -f %MSGFILE% -config %CFGFILE% %3 %4 %5 %6 %7 %8 %9 --tidy-mark no -o %TIDYFILE% %INFILE%
46 @set STATUS=%ERRORLEVEL%
47 @echo Testing %1, expect %EXPECTED%, got %STATUS%
48 @echo Testing %1, expect %EXPECTED%, got %STATUS% >> %TMPTEST%
49
50 @if %STATUS% EQU %EXPECTED% goto done
51 @set ERRTESTS=%ERRTESTS% %TESTNO%
52 @echo *** Failed - got %STATUS%, expected %EXPECTED% ***
53 @type %MSGFILE%
54 @echo *** Failed - got %STATUS%, expected %EXPECTED% *** >> %TMPTEST%
55 @type %MSGFILE% >> %TMPTEST%
56 goto done
57
58 :Err1
59 @echo ==============================================================
60 @echo ERROR: runtime exe not set in TIDY environment variable ...
61 @echo ==============================================================
62 @goto TRYAT
63
64 :Err2
65 @echo ==============================================================
66 @echo ERROR: runtime exe %TIDY% not found ... check name, location ...
67 @echo ==============================================================
68 @goto TRYAT
69
70 :Err3
71 @echo ==============================================================
72 @echo ERROR: output folder TIDYOUT not set in environment ...
73 @echo ==============================================================
74 @goto TRYAT
75
76 :Err4
77 @echo ==============================================================
78 @echo ERROR: output folder %TIDYOUT% does not exist ...
79 @echo ==============================================================
80 @goto TRYAT
81
82 :Err5
83 @echo ==============================================================
84 @echo ERROR: input folder 'input' does not exist ... check name, location ..
85 @echo ==============================================================
86 @goto TRYAT
87
88 :TRYAT
89 @echo Try running alltest1.cmd ..\build\cmake\Release\Tidy5.exe tmp
90 @echo ==============================================================
91 @pause
92 @goto done
93
94 :Err6
95 @echo ==============================================================
96 @echo ERROR: Failed to find input matching '%INFILES%'!!!
97 @echo ==============================================================
98 @pause
99 @goto done
100
101 :Err7
102 @echo ==============================================================
103 @echo ERROR: Failed to find input file '%INFILE%'!!!
104 @echo ==============================================================
105 @pause
106 @goto done
107
108 :done