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