git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@442301 13f79535-47bb-0310-9956-ffa450edef68master
| @@ -35,4 +35,29 @@ | |||||
| </condition> | </condition> | ||||
| </target> | </target> | ||||
| <target name="define"> | |||||
| <property name="testclasses" | |||||
| location="../../../../build/testcases" /> | |||||
| <taskdef name="echoloc" | |||||
| classname="org.apache.tools.ant.LocationTest$EchoLocation"> | |||||
| <classpath> | |||||
| <pathelement location="${testclasses}" /> | |||||
| <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="testMacrodefWrappedTask" depends="macrodef"> | |||||
| <echo id="echo3">Hello</echo> | |||||
| <echoloc2/> | |||||
| </target> | |||||
| </project> | </project> | ||||
| @@ -51,4 +51,19 @@ public class LocationTest extends BuildFileTest { | |||||
| assertFalse(c.getLocation() == Location.UNKNOWN_LOCATION); | assertFalse(c.getLocation() == Location.UNKNOWN_LOCATION); | ||||
| assertFalse(c.getLocation().getLineNumber() == 0); | assertFalse(c.getLocation().getLineNumber() == 0); | ||||
| } | } | ||||
| } | |||||
| public void XtestMacrodefWrappedTask() { | |||||
| executeTarget("testMacrodefWrappedTask"); | |||||
| Echo e = (Echo) getProject().getReference("echo3"); | |||||
| assertTrue(getLog().indexOf("Line: " | |||||
| + (e.getLocation().getLineNumber() + 1)) | |||||
| > -1); | |||||
| } | |||||
| public static class EchoLocation extends Task { | |||||
| public void execute() { | |||||
| log("Line: " + getLocation().getLineNumber(), Project.MSG_INFO); | |||||
| } | |||||
| } | |||||
| } | |||||