You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ant.apache.org by ke...@apache.org on 2006/12/08 11:23:20 UTC

svn commit: r483907 - in /ant/core/trunk/src/tests/antunit/core/location: ./ location.xml src/ src/task/ src/task/EchoLocation.java

Author: kevj
Date: Fri Dec  8 02:23:19 2006
New Revision: 483907

URL: http://svn.apache.org/viewvc?view=rev&rev=483907
Log:
-first stab at converting Location test to antunit

Added:
    ant/core/trunk/src/tests/antunit/core/location/
    ant/core/trunk/src/tests/antunit/core/location/location.xml
    ant/core/trunk/src/tests/antunit/core/location/src/
    ant/core/trunk/src/tests/antunit/core/location/src/task/
    ant/core/trunk/src/tests/antunit/core/location/src/task/EchoLocation.java

Added: ant/core/trunk/src/tests/antunit/core/location/location.xml
URL: http://svn.apache.org/viewvc/ant/core/trunk/src/tests/antunit/core/location/location.xml?view=auto&rev=483907
==============================================================================
--- ant/core/trunk/src/tests/antunit/core/location/location.xml (added)
+++ ant/core/trunk/src/tests/antunit/core/location/location.xml Fri Dec  8 02:23:19 2006
@@ -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>
\ No newline at end of file

Added: ant/core/trunk/src/tests/antunit/core/location/src/task/EchoLocation.java
URL: http://svn.apache.org/viewvc/ant/core/trunk/src/tests/antunit/core/location/src/task/EchoLocation.java?view=auto&rev=483907
==============================================================================
--- ant/core/trunk/src/tests/antunit/core/location/src/task/EchoLocation.java (added)
+++ ant/core/trunk/src/tests/antunit/core/location/src/task/EchoLocation.java Fri Dec  8 02:23:19 2006
@@ -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);
+    }
+}
\ No newline at end of file



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@ant.apache.org
For additional commands, e-mail: dev-help@ant.apache.org