-
-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathkeysAndLogicTests.bat
167 lines (120 loc) · 6.2 KB
/
keysAndLogicTests.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
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
@echo off
:: Copyright (c) 2017 Denis Kuzmin <x-3F@outlook.com> github/3F
:: Tests. Part of https://github.com/3F/hMSBuild
setlocal enableDelayedExpansion
call a isNotEmptyOrWhitespaceOrFail %~1 || exit /B1
set /a gcount=!%~1! & set /a failedTotal=!%~2!
set "exec=%~3" & set "wdir=%~4"
:::::::::::::::::: :::::::::::::: :::::::::::::::::::::::::
:: Tests
:: NOTE: :startTest will use ` as "
:: It helps to use double quotes inside double quotes " ... `args` ... "
:::::::::::::::::
call :cleanup
::_______ ------ ______________________________________
call a startTest "-help" || goto x
call a msgOrFailAt 0 "" || goto x
if not defined appversionHms call a failTest "Empty *appversionHms" & goto x
if not "%appversionHms%"=="off" (
call a msgOrFailAt 1 "hMSBuild %appversionHms%" || goto x
)
call a msgOrFailAt 2 "github/3F" || goto x
call a completeTest
::_____________________________________________________
::_______ ------ ______________________________________
call a startTest "-version" || goto x
if not defined appversionHms call a failTest "Empty *appversionHms" & goto x
if not "%appversionHms%"=="off" (
call a msgOrFailAt 1 "%appversionHms%" || goto x
)
call a completeTest
::_____________________________________________________
::_______ ------ ______________________________________
call a startTest "-?" || goto x
if not "%appversionHms%"=="off" (
call a msgOrFailAt 1 "hMSBuild %appversionHms%" || goto x
)
call a msgOrFailAt 2 "github/3F" || goto x
call a completeTest
::_____________________________________________________
::_______ ------ ______________________________________
call a startTest "-debug ~c RCI" 1 || goto x
call a findInStreamOrFail "Arguments:" 4,n || goto x
call a msgOrFailAt !n! "/p:Configuration" || goto x
call a msgOrFailAt !n! "`RCI`" || goto x
call a completeTest
::_____________________________________________________
::_______ ------ ______________________________________
call a startTest "-debug ~p x86" 1 || goto x
call a findInStreamOrFail "Arguments:" 4,n || goto x
call a msgOrFailAt !n! "/p:Platform" || goto x
call a msgOrFailAt !n! "`x86`" || goto x
call a completeTest
::_____________________________________________________
::_______ ------ ______________________________________
call a startTest "-debug ~c `Public Release` ~p `Any CPU`" 1 || goto x
call a findInStreamOrFail "Arguments:" 4,n || goto x
call a msgOrFailAt !n! "/p:Configuration" || goto x
call a msgOrFailAt !n! "`Public Release` /p:Platform" || goto x
call a msgOrFailAt !n! "`Any CPU`" || goto x
call a completeTest
::_____________________________________________________
::_______ ------ ______________________________________
call a startTest "-debug ~x ~c name" 1 || goto x
call a findInStreamOrFail "Arguments:" 4,n || goto x
set /a maxcpu=NUMBER_OF_PROCESSORS - 1
call a msgOrFailAt !n! "/v:m /m:!maxcpu!" || goto x
call a completeTest
::_____________________________________________________
::_______ ------ ______________________________________
call a startTest "-debug /p:Platform=`Any CPU` " 1 || goto x
call a findInStreamOrFail "Arguments:" 4,n || goto x
call a msgOrFailAt !n! "/p:Platform" || goto x
call a msgOrFailAt !n! "`Any CPU`" || goto x
call a completeTest
::_____________________________________________________
::_______ ------ ______________________________________
call a startTest "-debug -only-path /p:Platform=`Any CPU` " || goto x
call a msgOrFailAt 1 "non-handled key: /p:Platform" || goto x
call a msgOrFailAt 2 "non-handled key: " || goto x
call a msgOrFailAt 3 "non-handled key: `Any CPU`" || goto x
call a completeTest
::_____________________________________________________
::_______ ------ ______________________________________
call a startTest "-debug /p:Configuration=`Public Release` " 1 || goto x
call a findInStreamOrFail "Arguments:" 4,n || goto x
call a msgOrFailAt !n! "/p:Configuration" || goto x
call a msgOrFailAt !n! "`Public Release`" || goto x
call a completeTest
::_____________________________________________________
::_______ ------ ______________________________________
call a startTest "-debug /p:Configuration=`Public Release` /p:Platform=`Any CPU`" 1 || goto x
call a msgOrFailAt 1 "non-handled key: /p:Configuration" || goto x
call a msgOrFailAt 2 "non-handled key: " || goto x
call a msgOrFailAt 3 "non-handled key: `Public Release`" || goto x
call a msgOrFailAt 4 "non-handled key: /p:Platform" || goto x
call a msgOrFailAt 5 "non-handled key: " || goto x
call a msgOrFailAt 6 "non-handled key: `Any CPU`" || goto x
call a findInStreamOrFail "Arguments:" 7,n || goto x
call a msgOrFailAt !n! "/p:Configuration" || goto x
call a msgOrFailAt !n! "`Public Release` /p:Platform" || goto x
call a msgOrFailAt !n! "`Any CPU`" || goto x
call a completeTest
::_____________________________________________________
::_______ ------ ______________________________________
REM: calling built-in GetNuTool using keys with empty "", e.g. proxycfg="" etc.
call a startTest "-debug -GetNuTool Conari /p:proxycfg=``" 0 || goto x
call a findInStreamOrFail "Conari " 4,n || goto x
call a msgOrFailAt !n! "packages\Conari" || goto x
call a completeTest
::_____________________________________________________
:::::::::::::
call :cleanup
:::::::::::::::::: :::::::::::::: :::::::::::::::::::::::::
::
:x
endlocal & set /a %1=%gcount% & set /a %2=%failedTotal%
if !failedTotal! EQU 0 exit /B 0
exit /B 1
:cleanup
exit /B 0