blob: 8ce92924fe1155ef190e0649ab2a1b898b0f47b2 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
|
<project name="pathtofileset"
xmlns:au="antlib:org.apache.ant.antunit"
xmlns:antcontrib="antlib:net.sf.antcontrib">
<import file="../common.xml" />
<target name="setUp" depends="common.setUp">
<property name="test.dir" value="${root.dir}/target/resources/pathtofileset"/>
<mkdir dir="${test.dir}/0/0"/>
<mkdir dir="${test.dir}/0/1"/>
<mkdir dir="${test.dir}/1/0"/>
<mkdir dir="${test.dir}/1/1"/>
<touch file="${test.dir}/0/0/0.java"/>
<touch file="${test.dir}/0/1/1.java"/>
<touch file="${test.dir}/1/0/2.java"/>
<touch file="${test.dir}/1/1/3.java"/>
</target>
<target name="testSimple">
<path id="simple">
<fileset dir="${test.dir}/0" includes="**/*.java"/>
<fileset dir="${test.dir}/1" includes="**/*.java"/>
</path>
<antcontrib:pathtofileset
dir="${test.dir}/0"
pathrefid="simple"
ignoreNonRelative="yes"
name="simple.0.fileset"/>
<pathconvert
targetos="unix"
refid="simple.0.fileset"
property="simple.0.property"/>
<antcontrib:pathtofileset
dir="${test.dir}/1"
pathrefid="simple"
ignoreNonRelative="yes"
name="simple.1.fileset"/>
<pathconvert
targetos="unix"
refid="simple.1.fileset"
property="simple.1.property"/>
<au:assertTrue>
<and>
<contains string="${simple.0.property}" substring="0.java" />
<contains string="${simple.0.property}" substring="1.java" />
<not><contains string="${simple.0.property}" substring="2.java" /></not>
<not><contains string="${simple.0.property}" substring="3.java" /></not>
<contains string="${simple.1.property}" substring="2.java" />
<contains string="${simple.1.property}" substring="3.java" />
<not><contains string="${simple.1.property}" substring="0.java" /></not>
<not><contains string="${simple.1.property}" substring="1.java" /></not>
</and>
</au:assertTrue>
</target>
<target name="testSimpleException">
<path id="simple">
<fileset dir="${test.dir}/0" includes="**/*.java"/>
<fileset dir="${test.dir}/1" includes="**/*.java"/>
</path>
<au:expectfailure expectedMessage="is not relative to">
<antcontrib:pathtofileset
dir="${test.dir}/0"
pathrefid="simple"
name="simple.0.fileset"/>
</au:expectfailure>
</target>
</project>
|