Browse Source

-first stab at converting Location test to antunit

git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@483907 13f79535-47bb-0310-9956-ffa450edef68
master
Kevin Jackson 18 years ago
parent
commit
b9f1982589
2 changed files with 87 additions and 0 deletions
  1. +77
    -0
      src/tests/antunit/core/location/location.xml
  2. +10
    -0
      src/tests/antunit/core/location/src/task/EchoLocation.java

+ 77
- 0
src/tests/antunit/core/location/location.xml View File

@@ -0,0 +1,77 @@
<?xml version="1.0"?>
<project name="location-test" basedir="." default="all"
xmlns:au="antlib:org.apache.ant.antunit">
<property name="ant.build.dir" location="../../../../../build"/>
<property name="working.dir"
location="${ant.build.dir}/ant-unit/location-dir"/>
<property name="classes.dir" location="${working.dir}/classes"/>
<target name="all">
<au:antunit>
<fileset file="${ant.file}"/>
<au:plainlistener/>
</au:antunit>
</target>
<target name="setUp">
<mkdir dir="${classes.dir}"/>
<javac srcdir="src" destdir="${classes.dir}" debug="yes"/>
<taskdef name="echo-location" classname="task.EchoLocation"
classpath="${classes.dir}"/>
</target>
<target name="define">
<taskdef name="echoloc"
classname="task.EchoLocation">
<classpath>
<pathelement location="${classes.dir}" />
<pathelement path="${java.class.path}"/>
</classpath>
</taskdef>
</target>
<target name="macrodef" depends="define">
<macrodef name="echoloc2" backtrace="false">
<sequential>
<echoloc/>
</sequential>
</macrodef>
</target>
<target name="presetdef" depends="define">
<presetdef name="echoloc3">
<echoloc/>
</presetdef>
</target>
<target name="tearDown">
<delete dir="${working.dir}"/>
</target>
<target name="test-plain-task">
<echo id="echo">Hello</echo>
<au:assertLogContains text="Hello"/>
</target>
<target name="test-standalone-type">
</target>
<target name="test-condition-task">
</target>
<target name="test-macrodef-wrapped-task" depends="macrodef">
<echo id="echo3">Hello</echo>
<echoloc2/>
<au:assertLogContains text="Line: "/>
</target>
<target name="test-presetdef-wrapped-task" depends="presetdef">
<echo id="echo4">Hello</echo>
<echoloc3/>
<au:assertLogContains text="Line: "/>
</target>
</project>

+ 10
- 0
src/tests/antunit/core/location/src/task/EchoLocation.java View File

@@ -0,0 +1,10 @@
package task;
import org.apache.tools.ant.Project;
import org.apache.tools.ant.Task;
public class EchoLocation extends Task {
public void execute() {
log("Line: " + getLocation().getLineNumber(), Project.MSG_INFO);
}
}

Loading…
Cancel
Save