git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@386330 13f79535-47bb-0310-9956-ffa450edef68master
@@ -5,6 +5,7 @@ | |||||
</description> | </description> | ||||
<property name="src" value="Foo.java"/> | <property name="src" value="Foo.java"/> | ||||
<property name="taskdefs" value="tasks.properties"/> | |||||
<target name="write" > | <target name="write" > | ||||
<echo file="${src}"> | <echo file="${src}"> | ||||
@@ -17,6 +18,9 @@ | |||||
} | } | ||||
} | } | ||||
</echo> | </echo> | ||||
<propertyfile file="${taskdefs}"> | |||||
<entry key="foo2" value="Foo"/> | |||||
</propertyfile> | |||||
</target> | </target> | ||||
<target name="compile" depends="write"> | <target name="compile" depends="write"> | ||||
@@ -32,11 +36,21 @@ | |||||
</foo> | </foo> | ||||
</target> | </target> | ||||
<target name="testRun2" depends="compile"> | |||||
<taskdef resource="${taskdefs}" classpath="${basedir}"/> | |||||
<foo2 maxwait="5" maxwaitunit="second" | |||||
timeoutproperty="foo"> | |||||
<or/> | |||||
</foo2> | |||||
</target> | |||||
<target name="teardown"> | <target name="teardown"> | ||||
<delete> | <delete> | ||||
<fileset dir="${basedir}" | <fileset dir="${basedir}" | ||||
includes="${src},*.class"/> | includes="${src},*.class"/> | ||||
</delete> | </delete> | ||||
<delete file="${taskdefs}" /> | |||||
</target> | </target> | ||||
</project> | </project> |
@@ -35,9 +35,30 @@ public class ExtendedTaskdefTest extends BuildFileTest { | |||||
configureProject("src/etc/testcases/core/extended-taskdef.xml"); | configureProject("src/etc/testcases/core/extended-taskdef.xml"); | ||||
} | } | ||||
/** | |||||
* Automatically calls the target called "tearDown" | |||||
* from the build file tested if it exits. | |||||
* <p/> | |||||
* This allows to use Ant tasks directly in the build file | |||||
* to clean up after each test. Note that no "setUp" target | |||||
* is automatically called, since it's trivial to have a | |||||
* test target depend on it. | |||||
*/ | |||||
protected void tearDown() throws Exception { | |||||
super.tearDown(); | |||||
executeTarget("teardown"); | |||||
} | |||||
public void testRun() throws Exception { | public void testRun() throws Exception { | ||||
expectBuildExceptionContaining("testRun", | expectBuildExceptionContaining("testRun", | ||||
"exception thrown by the subclass", | "exception thrown by the subclass", | ||||
"executing the Foo task"); | "executing the Foo task"); | ||||
} | } | ||||
public void testRun2() throws Exception { | |||||
expectBuildExceptionContaining("testRun2", | |||||
"exception thrown by the subclass", | |||||
"executing the Foo task"); | |||||
} | |||||
} | } |