diff options
Diffstat (limited to 'test')
-rw-r--r-- | test/antunit/property/pathtofileset.xml | 75 | ||||
-rw-r--r-- | test/antunit/property/propertyselector.xml (renamed from test/antunit/property/propertyslector.xml) | 0 | ||||
-rw-r--r-- | test/antunit/property/variable.xml | 72 |
3 files changed, 147 insertions, 0 deletions
diff --git a/test/antunit/property/pathtofileset.xml b/test/antunit/property/pathtofileset.xml new file mode 100644 index 0000000..8ce9292 --- /dev/null +++ b/test/antunit/property/pathtofileset.xml @@ -0,0 +1,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>
\ No newline at end of file diff --git a/test/antunit/property/propertyslector.xml b/test/antunit/property/propertyselector.xml index 016f159..016f159 100644 --- a/test/antunit/property/propertyslector.xml +++ b/test/antunit/property/propertyselector.xml diff --git a/test/antunit/property/variable.xml b/test/antunit/property/variable.xml new file mode 100644 index 0000000..acd3ad1 --- /dev/null +++ b/test/antunit/property/variable.xml @@ -0,0 +1,72 @@ +<project name="propertycopy" + xmlns:au="antlib:org.apache.ant.antunit" + xmlns:antcontrib="antlib:net.sf.antcontrib"> + <import file="../common.xml" /> + + <!-- use like a standard property --> + <target name="test1"> + <antcontrib:var name="x" value="6" /> + <au:assertPropertyEquals name="x" value="6" /> + </target> + + <!-- use like a standard property --> + <target name="test2"> + <antcontrib:var name="x" value="12" /> + <au:assertPropertyEquals name="x" value="12" /> + </target> + + <!-- can append to itself --> + <target name="test3"> + <antcontrib:var name="x" value="12" /> + <antcontrib:var name="x" value="6 + ${x}" /> <!-- 6 + 12 --> + <au:assertPropertyEquals name="x" value="6 + 12" /> + </target> + + <!-- property can't override --> + <target name="test4"> + <antcontrib:var name="x" value="6" /> + <property name="x" value="12" /> + <au:assertPropertyEquals name="x" value="6" /> + </target> + + <!-- can append multiple times --> + <target name="test5"> + <antcontrib:var name="str" value="I" /> + <antcontrib:var name="str" value="${str} am" /> + <antcontrib:var name="str" value="${str} a" /> + <antcontrib:var name="str" value="${str} string." /> + <au:assertPropertyEquals name="str" value="I am a string." /> + </target> + + <!-- property can't override --> + <target name="test6"> + <antcontrib:var name="x" value="blue" /> + <tstamp> + <format property="x" pattern="EEEE" /> + </tstamp> + <antcontrib:var name="x" value="Today is ${x}."/> + <au:assertPropertyEquals name="x" value="Today is blue." /> + </target> + + <!-- can override property --> + <target name="test7"> + <property name="x" value="12" /> + <antcontrib:var name="x" value="6" /> + <au:assertPropertyEquals name="x" value="6" /> + </target> + + <target name="test9"> + <property name="i" value="2"/> + <antcontrib:var name="i" unset="true"/> + <au:assertTrue> + <not><isset property="i" /></not> + </au:assertTrue> + </target> + + <target name="test10"> + <antcontrib:var name="x" value="test"/> + <antcontrib:var name="x" unset="true"/> + <property name="x" value="xxx"/> + <au:assertPropertyEquals name="x" value="xxx" /> + </target> +</project>
\ No newline at end of file |