cmd/tests: Add tests for variable delayed expansion.
[wine] / programs / cmd / tests / test_builtins.cmd.exp
1
2 @pwd@>echo Tests for cmd's builtin commands@space@
3 Tests for cmd's builtin commands
4
5 @pwd@>echo ------------ Testing 'echo' [ON] --------------@space@
6 ------------ Testing 'echo' [ON] --------------
7
8 @pwd@>echo word@space@
9 word
10
11 @pwd@>echo 'singlequotedword'@space@
12 'singlequotedword'
13
14 @pwd@>echo "doublequotedword"@space@
15 "doublequotedword"
16 at-echoed-word
17
18 @pwd@>echo "/?"@space@
19 "/?"
20
21 @todo_wine@@pwd@>echo.
22
23
24 @pwd@>echo .@space@
25 .
26
27 @todo_wine@@pwd@>echo.word
28 word
29
30 @pwd@>echo .word@space@
31 .word
32
33 @todo_wine@@pwd@>echo:
34
35
36 @pwd@>echo :@space@
37 :
38
39 @todo_wine@@pwd@>echo:word
40 word
41
42 @pwd@>echo :word@space@
43 :word
44
45 @pwd@>echo word@space@@space@
46 word@space@
47
48 @pwd@>echo word@space@@space@@space@
49 word@space@@space@
50 ------------ Testing 'echo' [OFF] --------------
51 word
52 'singlequotedword'
53 "doublequotedword"
54 at-echoed-word
55 "/?"
56
57 .
58 word
59 .word
60
61 :
62 word
63 :word
64 word@space@
65 word@space@@space@
66 ------------ Testing redirection operators --------------
67 ...stdout redirection
68 foo
69 foo@space@
70 @todo_wine@foo1
71 @todo_wine@foo11
72 @todo_wine@foo12
73 ...stdout appending
74 foo
75 foo@space@
76 foob@space@
77 foob@space@
78 fooc@space@
79 foob@space@
80 fooc@space@
81 @todo_wine@food1
82 @todo_wine@foob@space@
83 @todo_wine@fooc@space@
84 @todo_wine@food1
85 @todo_wine@food2
86 @todo_wine@food21
87 @todo_wine@------------ Testing ^ escape character --------------
88 @todo_wine@hello, world
89 @todo_wine@hello, world
90 @todo_wine@hell^o, world
91 @todo_wine@hell^o, world
92 baz
93 @todo_wine@baz
94 @todo_wine@foo | echo bar
95 @todo_wine@foo & echo bar
96 @todo_wine@bak &
97 @todo_wine@baz@space@
98 @todo_wine@0@or_broken@1
99 @todo_wine@foo > foo
100 @todo_wine@<
101 @todo_wine@ffoof
102 @todo_wine@FOO=bar | baz
103 @todo_wine@0
104 @todo_wine@FOO=bar ^| baz
105 @todo_wine@bar | baz
106 @todo_wine@0
107 ------------ Testing 'set' --------------
108 1
109 @todo_wine@0
110 FOOBAR not defined
111 @todo_wine@  baz
112 FOOBAR =  baz
113 @todo_wine@0
114 @todo_wine@  baz2
115 @todo_wine@0
116  bar
117 @todo_wine@FOOBAR= bar
118 @todo_wine@FOOBAR =  baz2
119 FOOBAR =  baz2
120 FOOBAR not defined
121 1
122 bar
123 foobar
124 FOO not defined
125 BAZ=bazbaz
126 bazbaz
127 set "FOO=bar" should not include the quotes in the variable value
128 bar
129 ------------ Testing variable expansion --------------
130 ~dp0 should be directory containing batch file
131 @pwd@\
132 @pwd@\
133 CD value @pwd@@or_broken@CD value@space@
134 %
135 P
136 P
137 S
138 P
139 PS
140 ERRORLEVEL
141 0
142 00
143 0ERRORLEVEL
144 0
145 0%
146 P0
147 0S
148 P0S
149 ------------ Testing variable delayed expansion --------------
150 ...default mode (load-time expansion)
151 foo
152 !FOO!
153 foo
154 foo
155 ...runtime (delayed) expansion mode
156 foo
157 @todo_wine@foo@or_broken@!FOO!
158 foo
159 @todo_wine@bar@or_broken@foo
160 0
161 0@or_broken@1
162 foo
163 !FOO!
164 ------------ Testing conditional execution --------------
165 @todo_wine@...unconditional &
166 foo1
167 bar2@space@
168 foo2
169 @todo_wine@foobar deleted
170 @todo_wine@...on success conditional &&
171 @todo_wine@foo3 not created
172 bar4@space@
173 foo4
174 @todo_wine@...on failure conditional ||
175 @todo_wine@foo5
176 @todo_wine@foo6@space@
177 ------------ Testing type ------------
178
179 @pwd@>type foobaz@space@
180 bar
181
182 @pwd@>echo ***@space@
183 ***
184 bar
185 ***
186 ------------ Testing NUL ------------
187 bar
188 bar
189 bar
190 NUL
191 @todo_wine@foo created
192 ------------ Testing if/else --------------
193 if/else should work with blocks
194 if seems to work
195 else seems to work
196 @todo_wine@if seems not to detect /c as parameter
197 Testing case sensitivity with and without /i option
198 if seems to default to case sensitivity
199 if /i seems to work
200 if /I seems to work
201 -----------Testing for -----------
202 ...plain FOR
203 A
204 B
205 C
206 %I
207 %I
208 %I
209 %j
210 %j
211 %j
212 A
213 B
214 C
215 1
216 4
217 1
218 A
219 B
220 C
221 ...imbricated FORs
222 @todo_wine@X Y
223 @todo_wine@X Y
224 @todo_wine@A C
225 @todo_wine@A D
226 @todo_wine@B C
227 @todo_wine@B D
228 @todo_wine@A C
229 @todo_wine@A D
230 @todo_wine@B C
231 @todo_wine@B D
232 ...basic wildcards
233 bazbaz
234 ...for /d
235 baz
236 foo
237 bar
238 ...for /L
239 1
240 3
241 5
242 1
243 3
244 5
245 0
246 2
247 1
248 -1
249 @todo_wine@ErrorLevel 0
250 @todo_wine@ErrorLevel 0
251 -----------Testing del /a-----------
252 not-r.test not found after delete, good
253 r.test found before delete, good
254 r.test not found after delete, good
255 ------------ Testing del /q --------------
256 del /q * succeeded on file1
257 del /q * succeeded on file2.dat
258 ------------ Testing del /s --------------
259 ----------- Testing mkdir -----------
260 0
261 0
262 @todo_wine@1
263 @todo_wine@1
264 0
265 0
266 0
267 0
268 0
269 @todo_wine@1
270 0
271 0
272 0
273 dir created
274 0
275 @todo_wine@1
276 @todo_wine@1
277 @todo_wine@1
278 @todo_wine@ok, foo created
279 @todo_wine@1
280 @todo_wine@ok, foo\bar created
281 foo created
282 @todo_wine@bar created
283 @todo_wine@foobar created
284 @todo_wine@bar\baz created
285 ----------- Testing rmdir -----------
286 0
287 dir removed
288 0
289 dir removed
290 0
291 0
292 file not removed
293 0
294 non-empty dir not removed
295 0
296 non-empty dir not removed
297 recursive rmdir succeeded
298 recursive rmdir succeeded
299 foo removed
300 bar removed
301 foobar removed
302 bar\baz removed
303 ------------ Testing CALL --------------
304 foo@space@
305 @todo_wine@foo 8
306 foo@space@@space@
307 foo bar@space@
308 @todo_wine@foo ""@space@
309 @todo_wine@"" bar@space@
310 foo ''@space@
311 '' bar@space@
312 bar :testRoutine
313 foo@space@
314 foo bar
315 @todo_wine@foo ""
316 @todo_wine@"" bar
317 foo ''
318 '' bar
319 @todo_wine@0
320 @todo_wine@foo created
321 @todo_wine@Should expand foobaz
322 @todo_wine@batfile
323 @todo_wine@robinfile
324 @todo_wine@1
325 @todo_wine@1
326 non-builtin dir
327 -----------Testing Errorlevel-----------
328 9009
329 1
330 errorlevel just right, good
331 abc0def@or_broken@abc1def
332 errorlevel zero, good@or_broken@errorlevel nonzero, bad
333 7 should be 7
334 7 should still be 7
335 -----------Testing GOTO-----------
336 goto with no leading space worked
337 goto with a leading space worked
338 goto with a leading tab worked
339 goto with a following space worked
340 -----------Done, jumping to EOF-----------