3e94300fd76b47d66d4cda7f453419d89e0ccede
[reactos.git] / modules / rostests / win32 / cmd / test_goto_call.cmd.exp
1 --------- Testing GOTO ---------
2 Test GOTO ok
3 --------- Testing CALL within batch ---------
4 Test CALL ok from :test_call
5 GOTO with escape caret worked
6 Hi there!
7 Hi there!
8 Hi there!
9 Hi there!
10 Hi there!
11 Hi there!
12 --------- Testing :EOF support ---------
13 OK
14 OK
15 OK
16 OK
17 OK
18 --------- Testing GOTO within block ---------
19 Block-test 1: Single-line
20 Block-test 2: Multi-line
21 --------- Testing CALL within block ---------
22 Block-test 3: CALL in block
23 Test CALL in block OK from :test_call_block
24 CALL done
25 Block-test 4 OK
26 --------- Testing CALL within FOR ---------
27 0 IS NOT equal to 2
28 1 IS NOT equal to 2
29 Out of FOR 1 CALL from :out_of_loop_1, number is 2
30 2 IS equal to 2
31 3 IS NOT equal to 2
32 --------- Testing GOTO within FOR ---------
33 0 IS NOT equal to 2
34 1 IS NOT equal to 2
35 Out of FOR 2, number is 2
36 --------- Testing FOR loop stopping with GOTO ---------
37 --- FOR
38
39 @pwd@>for %A in (1 2 3 4 5 6 7 8 9 10) do (
40 set Number=%A@space@@space@
41 if %A == 5 goto :out_of_loop_2a@space@
42 )@space@
43
44 @pwd@>(
45 set Number=1@space@@space@
46 if 1 == 5 goto :out_of_loop_2a@space@
47 )@space@
48
49 @pwd@>(
50 set Number=2@space@@space@
51 if 2 == 5 goto :out_of_loop_2a@space@
52 )@space@
53
54 @pwd@>(
55 set Number=3@space@@space@
56 if 3 == 5 goto :out_of_loop_2a@space@
57 )@space@
58
59 @pwd@>(
60 set Number=4@space@@space@
61 if 4 == 5 goto :out_of_loop_2a@space@
62 )@space@
63
64 @pwd@>(
65 set Number=5@space@@space@
66 if 5 == 5 goto :out_of_loop_2a@space@
67 )@space@
68
69 @pwd@>echo Out of FOR 2a, number is 5@space@
70 Out of FOR 2a, number is 5
71 --- FOR /R
72
73 @pwd@\foobar>for /R %A in (1 2 3 4 5 6 7 8 9 10) do (
74 set Number=%~nA@space@@space@
75 if %~nA == 5 goto :out_of_loop_2b@space@
76 )@space@
77
78 @pwd@\foobar>(
79 set Number=1@space@@space@
80 if 1 == 5 goto :out_of_loop_2b@space@
81 )@space@
82
83 @pwd@\foobar>(
84 set Number=2@space@@space@
85 if 2 == 5 goto :out_of_loop_2b@space@
86 )@space@
87
88 @pwd@\foobar>(
89 set Number=3@space@@space@
90 if 3 == 5 goto :out_of_loop_2b@space@
91 )@space@
92
93 @pwd@\foobar>(
94 set Number=4@space@@space@
95 if 4 == 5 goto :out_of_loop_2b@space@
96 )@space@
97
98 @pwd@\foobar>(
99 set Number=5@space@@space@
100 if 5 == 5 goto :out_of_loop_2b@space@
101 )@space@
102
103 @pwd@\foobar>echo Out of FOR 2b, number is 5@space@
104 Out of FOR 2b, number is 5
105 --- FOR /L
106
107 @pwd@>for /L %A in (1 1 10) do (
108 set Number=%A@space@@space@
109 if %A == 5 goto :out_of_loop_2c@space@
110 )@space@
111
112 @pwd@>(
113 set Number=1@space@@space@
114 if 1 == 5 goto :out_of_loop_2c@space@
115 )@space@
116
117 @pwd@>(
118 set Number=2@space@@space@
119 if 2 == 5 goto :out_of_loop_2c@space@
120 )@space@
121
122 @pwd@>(
123 set Number=3@space@@space@
124 if 3 == 5 goto :out_of_loop_2c@space@
125 )@space@
126
127 @pwd@>(
128 set Number=4@space@@space@
129 if 4 == 5 goto :out_of_loop_2c@space@
130 )@space@
131
132 @pwd@>(
133 set Number=5@space@@space@
134 if 5 == 5 goto :out_of_loop_2c@space@
135 )@space@
136
137 @pwd@>(
138 set Number=6@space@@space@
139 if 6 == 5 goto :out_of_loop_2c@space@
140 )@space@
141
142 @pwd@>(
143 set Number=7@space@@space@
144 if 7 == 5 goto :out_of_loop_2c@space@
145 )@space@
146
147 @pwd@>(
148 set Number=8@space@@space@
149 if 8 == 5 goto :out_of_loop_2c@space@
150 )@space@
151
152 @pwd@>(
153 set Number=9@space@@space@
154 if 9 == 5 goto :out_of_loop_2c@space@
155 )@space@
156
157 @pwd@>(
158 set Number=10@space@@space@
159 if 10 == 5 goto :out_of_loop_2c@space@
160 )@space@
161
162 @pwd@>echo Out of FOR 2c, number is 5@space@
163 Out of FOR 2c, number is 5
164 --- FOR /F
165
166 @pwd@>for %T in ("1:2:3" "4:5:6:7" "8:9:10") do (
167 set "pc=%~T"@space@@space@
168 for /F "delims=" %A in ("!pc::=
169 !") do (
170 set Number=%A@space@@space@
171 if %A == 5 goto :out_of_loop_2d@space@
172 )@space@
173 )@space@
174
175 @pwd@>(
176 set "pc=1:2:3"@space@@space@
177 for /F "delims=" %A in ("!pc::=
178 !") do (
179 set Number=%A@space@@space@
180 if %A == 5 goto :out_of_loop_2d@space@
181 )@space@
182 )@space@
183
184 @pwd@>(
185 set Number=1@space@@space@
186 if 1 == 5 goto :out_of_loop_2d@space@
187 )@space@
188
189 @pwd@>(
190 set Number=2@space@@space@
191 if 2 == 5 goto :out_of_loop_2d@space@
192 )@space@
193
194 @pwd@>(
195 set Number=3@space@@space@
196 if 3 == 5 goto :out_of_loop_2d@space@
197 )@space@
198
199 @pwd@>(
200 set "pc=4:5:6:7"@space@@space@
201 for /F "delims=" %A in ("!pc::=
202 !") do (
203 set Number=%A@space@@space@
204 if %A == 5 goto :out_of_loop_2d@space@
205 )@space@
206 )@space@
207
208 @pwd@>(
209 set Number=4@space@@space@
210 if 4 == 5 goto :out_of_loop_2d@space@
211 )@space@
212
213 @pwd@>(
214 set Number=5@space@@space@
215 if 5 == 5 goto :out_of_loop_2d@space@
216 )@space@
217
218 @pwd@>echo Out of FOR 2d, number is 5@space@
219 Out of FOR 2d, number is 5
220 --------- Testing CALL within IF ---------
221 Out of IF CALL from :out_of_if_1, number is 123
222 Success IF echo 1
223 --------- Testing GOTO within IF ---------
224 Out of IF ok
225 A
226 A
227 B
228 --------- Testing EXIT within IF ---------
229 First block
230 Second block
231 --------- Finished --------------