Browse Source

No, it isnt the fact that I declare things through a property file either.

git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@386330 13f79535-47bb-0310-9956-ffa450edef68
master
Steve Loughran 19 years ago
parent
commit
72a6e5e9df
2 changed files with 35 additions and 0 deletions
  1. +14
    -0
      src/etc/testcases/core/extended-taskdef.xml
  2. +21
    -0
      src/testcases/org/apache/tools/ant/ExtendedTaskdefTest.java

+ 14
- 0
src/etc/testcases/core/extended-taskdef.xml View File

@@ -5,6 +5,7 @@

</description>
<property name="src" value="Foo.java"/>
<property name="taskdefs" value="tasks.properties"/>

<target name="write" >
<echo file="${src}">
@@ -17,6 +18,9 @@
}
}
</echo>
<propertyfile file="${taskdefs}">
<entry key="foo2" value="Foo"/>
</propertyfile>
</target>

<target name="compile" depends="write">
@@ -32,11 +36,21 @@
</foo>
</target>

<target name="testRun2" depends="compile">
<taskdef resource="${taskdefs}" classpath="${basedir}"/>
<foo2 maxwait="5" maxwaitunit="second"
timeoutproperty="foo">
<or/>
</foo2>
</target>


<target name="teardown">
<delete>
<fileset dir="${basedir}"
includes="${src},*.class"/>
</delete>
<delete file="${taskdefs}" />
</target>

</project>

+ 21
- 0
src/testcases/org/apache/tools/ant/ExtendedTaskdefTest.java View File

@@ -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.
* <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 {
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");
}

}

Loading…
Cancel
Save