1--------- Testing GOTO ---------
2Test GOTO ok
3--------- Testing CALL within batch ---------
4Test CALL ok from :test_call
5Hi there!
6Hi there!
7Hi there!
8Hi there!
9goto with unrelated first character, and escape carets worked
10Params: ':dest1', '', '', ''
11goto with unrelated first character, and escape carets worked
12Params: ':dest1', '', '', ''
13goto with unrelated first character, and escape carets worked
14Params: ':dest1', '', '', ''
15goto with unrelated first character, and escape carets worked
16Params: ':dest1', '', '', ''
17goto with unrelated first character, and escape carets worked
18Params: ':dest1', 'a', 'b', 'c'
19goto with unrelated first character, and escape carets worked
20Params: ':dest1', '', '', ''
21OK
22OK
23CALL with escape caret worked
24GOTO with escape caret worked
25Hi there!
26Hi there!
27Hi there!
28Hi there!
29Hi there!
30Hi there!
31--------- Testing :EOF support ---------
32OK
33OK
34OK
35OK
36OK
37OK
38OK
39--------- Testing GOTO within block ---------
40Block-test 1: Single-line
41Block-test 2: Multi-line
42--------- Testing CALL within block ---------
43Block-test 3: CALL in block
44Test CALL in block OK from :test_call_block
45CALL done
46Block-test 4 OK
47--------- Testing CALL within FOR ---------
480 IS NOT equal to 2
491 IS NOT equal to 2
50Out of FOR 1 CALL from :out_of_loop_1, number is 2
512 IS equal to 2
523 IS NOT equal to 2
53--------- Testing GOTO within FOR ---------
540 IS NOT equal to 2
551 IS NOT equal to 2
56Out of FOR 2, number is 2
57--------- Testing FOR loop stopping with GOTO ---------
58--- FOR
59
60@pwd@>for %A in (1 2 3 4 5 6 7 8 9 10) do (
61set Number=%A@space@@space@
62 if %A == 5 goto :out_of_loop_2a@space@
63)@space@
64
65@pwd@>(
66set Number=1@space@@space@
67 if 1 == 5 goto :out_of_loop_2a@space@
68)@space@
69
70@pwd@>(
71set Number=2@space@@space@
72 if 2 == 5 goto :out_of_loop_2a@space@
73)@space@
74
75@pwd@>(
76set Number=3@space@@space@
77 if 3 == 5 goto :out_of_loop_2a@space@
78)@space@
79
80@pwd@>(
81set Number=4@space@@space@
82 if 4 == 5 goto :out_of_loop_2a@space@
83)@space@
84
85@pwd@>(
86set Number=5@space@@space@
87 if 5 == 5 goto :out_of_loop_2a@space@
88)@space@
89
90@pwd@>echo Out of FOR 2a, number is 5@space@
91Out of FOR 2a, number is 5
92--- FOR /R
93
94@pwd@\foobar>for /R %A in (1 2 3 4 5 6 7 8 9 10) do (
95set Number=%~nA@space@@space@
96 if %~nA == 5 goto :out_of_loop_2b@space@
97)@space@
98
99@pwd@\foobar>(
100set Number=1@space@@space@
101 if 1 == 5 goto :out_of_loop_2b@space@
102)@space@
103
104@pwd@\foobar>(
105set Number=2@space@@space@
106 if 2 == 5 goto :out_of_loop_2b@space@
107)@space@
108
109@pwd@\foobar>(
110set Number=3@space@@space@
111 if 3 == 5 goto :out_of_loop_2b@space@
112)@space@
113
114@pwd@\foobar>(
115set Number=4@space@@space@
116 if 4 == 5 goto :out_of_loop_2b@space@
117)@space@
118
119@pwd@\foobar>(
120set Number=5@space@@space@
121 if 5 == 5 goto :out_of_loop_2b@space@
122)@space@
123
124@pwd@\foobar>echo Out of FOR 2b, number is 5@space@
125Out of FOR 2b, number is 5
126--- FOR /L
127
128@pwd@>for /L %A in (1 1 10) do (
129set Number=%A@space@@space@
130 if %A == 5 goto :out_of_loop_2c@space@
131)@space@
132
133@pwd@>(
134set Number=1@space@@space@
135 if 1 == 5 goto :out_of_loop_2c@space@
136)@space@
137
138@pwd@>(
139set Number=2@space@@space@
140 if 2 == 5 goto :out_of_loop_2c@space@
141)@space@
142
143@pwd@>(
144set Number=3@space@@space@
145 if 3 == 5 goto :out_of_loop_2c@space@
146)@space@
147
148@pwd@>(
149set Number=4@space@@space@
150 if 4 == 5 goto :out_of_loop_2c@space@
151)@space@
152
153@pwd@>(
154set Number=5@space@@space@
155 if 5 == 5 goto :out_of_loop_2c@space@
156)@space@
157
158@pwd@>(
159set Number=6@space@@space@
160 if 6 == 5 goto :out_of_loop_2c@space@
161)@space@
162
163@pwd@>(
164set Number=7@space@@space@
165 if 7 == 5 goto :out_of_loop_2c@space@
166)@space@
167
168@pwd@>(
169set Number=8@space@@space@
170 if 8 == 5 goto :out_of_loop_2c@space@
171)@space@
172
173@pwd@>(
174set Number=9@space@@space@
175 if 9 == 5 goto :out_of_loop_2c@space@
176)@space@
177
178@pwd@>(
179set Number=10@space@@space@
180 if 10 == 5 goto :out_of_loop_2c@space@
181)@space@
182
183@pwd@>echo Out of FOR 2c, number is 5@space@
184Out of FOR 2c, number is 5
185--- FOR /F
186
187@pwd@>for %T in ("1:2:3" "4:5:6:7" "8:9:10") do (
188set "pc=%~T"@space@@space@
189 for /F "delims=" %A in ("!pc::=
190!") do (
191set Number=%A@space@@space@
192 if %A == 5 goto :out_of_loop_2d@space@
193)@space@
194)@space@
195
196@pwd@>(
197set "pc=1:2:3"@space@@space@
198 for /F "delims=" %A in ("!pc::=
199!") do (
200set Number=%A@space@@space@
201 if %A == 5 goto :out_of_loop_2d@space@
202)@space@
203)@space@
204
205@pwd@>(
206set Number=1@space@@space@
207 if 1 == 5 goto :out_of_loop_2d@space@
208)@space@
209
210@pwd@>(
211set Number=2@space@@space@
212 if 2 == 5 goto :out_of_loop_2d@space@
213)@space@
214
215@pwd@>(
216set Number=3@space@@space@
217 if 3 == 5 goto :out_of_loop_2d@space@
218)@space@
219
220@pwd@>(
221set "pc=4:5:6:7"@space@@space@
222 for /F "delims=" %A in ("!pc::=
223!") do (
224set Number=%A@space@@space@
225 if %A == 5 goto :out_of_loop_2d@space@
226)@space@
227)@space@
228
229@pwd@>(
230set Number=4@space@@space@
231 if 4 == 5 goto :out_of_loop_2d@space@
232)@space@
233
234@pwd@>(
235set Number=5@space@@space@
236 if 5 == 5 goto :out_of_loop_2d@space@
237)@space@
238
239@pwd@>echo Out of FOR 2d, number is 5@space@
240Out of FOR 2d, number is 5
241--------- Testing CALL within IF ---------
242Out of IF CALL from :out_of_if_1, number is 123
243Success IF echo 1
244--------- Testing GOTO within IF ---------
245Out of IF ok
246A
247A
248B
249--------- Testing EXIT within IF ---------
250First block
251Second block
252--------- Testing CALL (triggers GOTO /?) ---------
253--- Direct label, redirection
254Test message -- ':/?','argument'
255Arguments: 'argument'
256Test message -- '',''
257OK, GOTO help.
258--- Direct label, piping
259OK, CALL help.@space@
260Test message -- '',''
261--------- Testing CALL with escape carets (triggers GOTO /?) ---------
262--- Direct label, redirection
263Test message -- ':myLabel /?','^arg ^argument'
264Arguments: '^arg ^argument'
265Test message -- '',''
266OK, GOTO help.
267--- Direct label, piping
268OK, CALL help.@space@
269Test message -- '',''
270--------- Testing CALL (NOT triggering GOTO /? or CALL /?) ---------
271Arguments: '/?'
272OK, ECHO help.@space@
273
274 Hello World
275--------- Testing CALL double delayed expansion ---------
276It works!
277--------- Finished  --------------
278