diff --git a/src/etc/testcases/core/extended-taskdef.xml b/src/etc/testcases/core/extended-taskdef.xml index 66bb14e1d..805368fd9 100644 --- a/src/etc/testcases/core/extended-taskdef.xml +++ b/src/etc/testcases/core/extended-taskdef.xml @@ -5,6 +5,7 @@ + @@ -17,6 +18,9 @@ } } + + + @@ -32,11 +36,21 @@ + + + + + + + + + \ No newline at end of file diff --git a/src/testcases/org/apache/tools/ant/ExtendedTaskdefTest.java b/src/testcases/org/apache/tools/ant/ExtendedTaskdefTest.java index 31e8a0c55..d1f00eaf6 100644 --- a/src/testcases/org/apache/tools/ant/ExtendedTaskdefTest.java +++ b/src/testcases/org/apache/tools/ant/ExtendedTaskdefTest.java @@ -35,9 +35,30 @@ public class ExtendedTaskdefTest extends BuildFileTest { configureProject("src/etc/testcases/core/extended-taskdef.xml"); } + /** + * Automatically calls the target called "tearDown" + * from the build file tested if it exits. + *

+ * 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 { expectBuildExceptionContaining("testRun", "exception thrown by the subclass", "executing the Foo task"); } + + public void testRun2() throws Exception { + expectBuildExceptionContaining("testRun2", + "exception thrown by the subclass", + "executing the Foo task"); + } + }