source: release-kits/lirk3/resources/gs3-release-maker/apache-ant-1.6.5/src/etc/testcases/taskdefs/condition.xml@ 14982

Last change on this file since 14982 was 14982, checked in by oranfry, 16 years ago

initial import of LiRK3

File size: 9.1 KB
Line 
1<?xml version="1.0"?>
2
3<!-- test conditioning -->
4<project name="condition-test" basedir="." default="test1">
5
6 <target name="basic">
7 <condition property="basic">
8 <equals arg1="a" arg2="a" />
9 </condition>
10 <echo>${basic}</echo>
11 </target>
12
13 <target name="condition-incomplete">
14 <condition >
15 <equals arg1="a" arg2="a" />
16 </condition>
17 </target>
18
19 <target name="condition-empty">
20 <condition property="condition-empty"/>
21 <echo>${condition-empty}</echo>
22 </target>
23
24 <target name="shortcut">
25 <property name="shortcut" value="set"/>
26 <condition property="shortcut">
27 <equals arg1="a" arg2="a" />
28 </condition>
29 <echo>${shortcut}</echo>
30 </target>
31
32 <target name="dontset">
33 <condition property="dontset">
34 <equals arg1="a" arg2="b" />
35 </condition>
36 <echo>${dontset}</echo>
37 </target>
38
39 <target name="setvalue">
40 <condition property="setvalue" value="woowoo" >
41 <equals arg1="a" arg2="a" />
42 </condition>
43 <echo>${setvalue}</echo>
44 </target>
45
46 <target name="negation">
47 <condition property="negation">
48 <not>
49 <equals arg1="a" arg2="B" />
50 </not>
51 </condition>
52 <echo>${negation}</echo>
53 </target>
54
55 <target name="negationfalse">
56 <condition property="negationfalse">
57 <not>
58 <equals arg1="a" arg2="a" />
59 </not>
60 </condition>
61 <echo>${negationfalse}</echo>
62 </target>
63
64 <target name="negationincomplete">
65 <condition property="negationincomplete">
66 <not />
67 </condition>
68 <echo>${negationincomplete}</echo>
69 </target>
70
71 <target name="and">
72 <condition property="and">
73 <and>
74 <equals arg1="a" arg2="a" />
75 <equals arg1="B" arg2="B" />
76 </and>
77 </condition>
78 <echo>${and}</echo>
79 </target>
80
81 <target name="andfails">
82 <condition property="andfails">
83 <and>
84 <equals arg1="a" arg2="B" />
85 <equals arg1="B" arg2="a" />
86 </and>
87 </condition>
88 <echo>${andfails}</echo>
89 </target>
90
91 <target name="andincomplete">
92 <condition property="andincomplete">
93 <and>
94 <equals arg1="a" arg2="B" />
95 </and>
96 </condition>
97 <echo>${andincomplete}</echo>
98 </target>
99
100
101 <target name="andempty">
102 <condition property="andempty">
103 <and/>
104 </condition>
105 <echo>${andempty}</echo>
106 </target>
107
108
109 <target name="or">
110 <condition property="or">
111 <or>
112 <equals arg1="a" arg2="B" />
113 <equals arg1="B" arg2="B" />
114 </or>
115 </condition>
116 <echo>${or}</echo>
117 </target>
118
119 <target name="orincomplete">
120 <condition property="orincomplete">
121 <or>
122 <equals arg1="a" arg2="a" />
123 </or>
124 </condition>
125 <echo>${orincomplete}</echo>
126 </target>
127
128 <target name="orempty">
129 <condition property="orempty">
130 <or/>
131 </condition>
132 <echo>${orempty}</echo>
133 </target>
134
135 <target name="orfails">
136 <condition property="orfails">
137 <or>
138 <equals arg1="a" arg2="B" />
139 <equals arg1="B" arg2="a" />
140 </or>
141 </condition>
142 <echo>${orfails}</echo>
143 </target>
144
145 <target name="orboth">
146 <condition property="orboth">
147 <or>
148 <equals arg1="a" arg2="a" />
149 <equals arg1="B" arg2="B" />
150 </or>
151 </condition>
152 <echo>${orboth}</echo>
153 </target>
154
155 <target name="filesmatch-identical" >
156 <condition property="filesmatch-identical">
157 <filesmatch
158 file1="condition.xml"
159 file2="condition.xml" />
160 </condition>
161 <echo>${filesmatch-identical}</echo>
162 </target>
163
164 <target name="filesmatch-incomplete" >
165 <condition property="filesmatch-incomplete">
166 <filesmatch
167 file1="condition.xml"/>
168 </condition>
169 <echo>${filesmatch-incomplete}</echo>
170 </target>
171
172 <target name="filesmatch-oddsizes" >
173 <condition property="filesmatch-oddsizes">
174 <filesmatch
175 file1="condition.xml"
176 file2="property.xml" />
177 </condition>
178 <echo>${filesmatch-oddsizes}</echo>
179 </target>
180
181 <target name="filesmatch-existence" >
182 <condition property="filesmatch-existence">
183 <filesmatch
184 file1="condition.xml"
185 file2="this-file-doesnt-exist.xml" />
186 </condition>
187 <echo>${filesmatch-existence}</echo>
188 </target>
189
190 <target name="filesmatch-different">
191 <echo file="match1.txt" message="012345676890" />
192 <echo file="match2.txt" message="012345676889" />
193 <condition property="filesmatch-different">
194 <filesmatch
195 file1="match1.txt"
196 file2="match2.txt" />
197 </condition>
198 <echo>${filesmatch-different}</echo>
199 </target>
200
201
202 <target name="filesmatch-match" >
203 <echo file="match3.txt" message="012345676890" />
204 <echo file="match4.txt" message="012345676890" />
205 <condition property="filesmatch-match">
206 <filesmatch
207 file1="match3.txt"
208 file2="match4.txt" />
209 </condition>
210 <echo>${filesmatch-match}</echo>
211 </target>
212
213 <target name="filesmatch-different-sizes">
214 <echo file="match5.txt" message="012345676890" />
215 <echo file="match6.txt" message="0123456768" />
216 <condition property="filesmatch-different-sizes">
217 <filesmatch
218 file1="match5.txt"
219 file2="match6.txt" />
220 </condition>
221 <echo>${filesmatch-different-sizes}</echo>
222 </target>
223
224 <target name="filesmatch-different-onemissing">
225 <condition property="filesmatch-different-sizes">
226 <filesmatch
227 file1="condition.xml"
228 file2="missing-file.txt" />
229 </condition>
230 <echo>${filesmatch-different-onemissing}</echo>
231 </target>
232
233 <target name="contains" >
234 <condition property="contains">
235 <contains
236 string="abcd"
237 substring="cd" />
238 </condition>
239 <echo>${contains}</echo>
240 </target>
241
242 <target name="contains-doesnt" >
243 <condition property="contains-doesnt">
244 <contains
245 string="abcd"
246 substring="CD" />
247 </condition>
248 <echo>${contains-doesnt}</echo>
249 </target>
250
251 <target name="contains-anycase" >
252 <condition property="contains-anycase">
253 <contains casesensitive="false"
254 string="abcd"
255 substring="CD" />
256 </condition>
257 <echo>${contains-anycase}</echo>
258 </target>
259
260 <target name="contains-incomplete1" >
261 <condition property="contains-incomplete1">
262 <contains
263 string="abcd" />
264 </condition>
265 <echo>${contains-incomplete1}</echo>
266 </target>
267
268 <target name="contains-incomplete2" >
269 <condition property="contains-incomplete2">
270 <contains
271 substring="CD" />
272 </condition>
273 <echo>${contains-incomplete2}</echo>
274 </target>
275
276 <target name="istrue" >
277 <property name="t" value="true" />
278 <property name="o" value="o" />
279 <property name="n" value="n" />
280 <condition property="istrue">
281 <and>
282 <istrue value="${t}" />
283 <istrue value="TRUE" />
284 <istrue value="yes" />
285 <istrue value="YeS" />
286 <istrue value="on" />
287 <istrue value="${o}${n}" />
288 </and>
289 </condition>
290 <echo>${istrue}</echo>
291 </target>
292
293 <target name="istrue-not" >
294 <condition property="istrue-not">
295 <istrue
296 value="this sentence is true" />
297 </condition>
298 <echo>${istrue-not}</echo>
299 </target>
300
301 <target name="istrue-false" >
302 <condition property="istrue-false">
303 <or>
304 <istrue value="false" />
305 <istrue value="" />
306 </or>
307 </condition>
308 <echo>${istrue-false}</echo>
309 </target>
310
311 <target name="istrue-incomplete" >
312 <condition property="istrue-incomplete">
313 <istrue />
314 </condition>
315 <echo>${istrue-incomplete}</echo>
316 </target>
317
318
319 <target name="isfalse-true" >
320 <property name="t" value="true" />
321 <condition property="isfalse-true">
322 <isfalse
323 value="${t}" />
324 </condition>
325 <echo>${isfalse-true}</echo>
326 </target>
327
328 <target name="isfalse-not" >
329 <condition property="isfalse-not">
330 <isfalse
331 value="this sentence is true" />
332 </condition>
333 <echo>${isfalse-not}</echo>
334 </target>
335
336 <target name="isfalse-false" >
337 <condition property="isfalse-false">
338 <isfalse
339 value="false" />
340 </condition>
341 <echo>${isfalse-false}</echo>
342 </target>
343
344 <target name="isfalse-incomplete" >
345 <condition property="isfalse-incomplete">
346 <isfalse />
347 </condition>
348 <echo>${isfalse-incomplete}</echo>
349 </target>
350
351 <target name="testElse">
352 <condition property="unset" value="foo">
353 <or />
354 </condition>
355 <condition property="value" value="foo" else="bar">
356 <and />
357 </condition>
358 <condition property="else" value="foo" else="bar">
359 <or />
360 </condition>
361 <fail>
362 <condition>
363 <or>
364 <isset property="unset" />
365 <not>
366 <and>
367 <equals arg1="${value}" arg2="foo" />
368 <equals arg1="${else}" arg2="bar" />
369 </and>
370 </not>
371 </or>
372 </condition>
373 </fail>
374 </target>
375
376 <target name="cleanup" >
377 <delete file="match1.txt" />
378 <delete file="match2.txt" />
379 <delete file="match3.txt" />
380 <delete file="match4.txt" />
381 <delete file="match5.txt" />
382 <delete file="match6.txt" />
383 </target>
384
385</project>
Note: See TracBrowser for help on using the repository browser.