-
Notifications
You must be signed in to change notification settings - Fork 0
/
test.bat
99 lines (68 loc) · 1.85 KB
/
test.bat
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
@echo off
SETLOCAL
set next=0
REM -- TEST: NO ARGS --
type >type_cmd.1 2>NUL
type.exe >type_exe.1 2>NUL
type 2>type_cmd.2 >NUL
type.exe 2>type_exe.2 >NUL
GOTO ERRORCHECK
:AFTERTEST1
REM -- TEST: HELP SWITCH --
type/? >type_cmd.1 2>NUL
type.exe/? >type_exe.1 2>NUL
type/? 2>type_cmd.2 >NUL
type.exe/? 2>type_exe.2 >NUL
GOTO ERRORCHECK
:AFTERTEST2
REM -- TEST: HELP SWITCH W/ OTHER ARGS --
type /T /? /p >type_cmd.1 2>NUL
type.exe /T /? /p >type_exe.1 2>NUL
type /T /? /p 2>type_cmd.2 >NUL
type.exe /T /? /p 2>type_exe.2 >NUL
GOTO ERRORCHECK
:AFTERTEST3
REM -- TEST: BOGUS SWITCHES --
type /T /p >type_cmd.1 2>NUL
type.exe /T /p >type_exe.1 2>NUL
type /T /p 2>type_cmd.2 >NUL
type.exe /T /p 2>type_exe.2 >NUL
GOTO ERRORCHECK
:AFTERTEST4
REM -- TEST: BAD FILENAME --
type badfilename >type_cmd.1 2>NUL
type.exe badfilename >type_exe.1 2>NUL
type badfilename 2>type_cmd.2 >NUL
type.exe badfilename 2>type_exe.2 >NUL
GOTO ERRORCHECK
:AFTERTEST5
REM -- TEST: BAD FILENAME W/ MULTPILE FILES --
type badfile1 badfile2 >type_cmd.1 2>NUL
type.exe badfile1 badfile2 >type_exe.1 2>NUL
type badfile1 badfile2 2>type_cmd.2 >NUL
type.exe badfile1 badfile2 2>type_exe.2 >NUL
GOTO ERRORCHECK
:AFTERTEST6
REM -- TEST: MULTIPLE FILES --
type .gitattributes .gitignore >type_cmd.1 2>NUL
type.exe .gitattributes .gitignore >type_exe.1 2>NUL
type .gitattributes .gitignore 2>type_cmd.2 >NUL
type.exe .gitattributes .gitignore 2>type_exe.2 >NUL
GOTO ERRORCHECK
:AFTERTEST7
GOTO EXIT
:ERRORCHECK
set /a next=%next%+1
fc.exe /b type_cmd.1 type_exe.1 >NUL
if ERRORLEVEL 1 GOTO ERROREXIT
fc.exe /b type_cmd.2 type_exe.2 >NUL
if ERRORLEVEL 1 GOTO ERROREXIT
GOTO AFTERTEST%next%
:ERROREXIT
echo Error: Test %next% - Mismatch in type_cmd and type_exe files.
exit /b 1
@echo on
:EXIT
del type_cmd.* type_exe.*
echo All tests passed.
@echo on