diff options
Diffstat (limited to 'framework/src/ant/apache-ant-1.9.6/src/tests/antunit/core/location')
-rw-r--r-- | framework/src/ant/apache-ant-1.9.6/src/tests/antunit/core/location/location.xml | 93 | ||||
-rw-r--r-- | framework/src/ant/apache-ant-1.9.6/src/tests/antunit/core/location/src/task/EchoLocation.java | 26 |
2 files changed, 119 insertions, 0 deletions
diff --git a/framework/src/ant/apache-ant-1.9.6/src/tests/antunit/core/location/location.xml b/framework/src/ant/apache-ant-1.9.6/src/tests/antunit/core/location/location.xml new file mode 100644 index 00000000..091d6f33 --- /dev/null +++ b/framework/src/ant/apache-ant-1.9.6/src/tests/antunit/core/location/location.xml @@ -0,0 +1,93 @@ +<?xml version="1.0"?> +<!-- + Licensed to the Apache Software Foundation (ASF) under one or more + contributor license agreements. See the NOTICE file distributed with + this work for additional information regarding copyright ownership. + The ASF licenses this file to You under the Apache License, Version 2.0 + (the "License"); you may not use this file except in compliance with + the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +--> +<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"> + <!-- TODO --> + </target> + + <target name="test-condition-task"> + <!-- TODO --> + </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> diff --git a/framework/src/ant/apache-ant-1.9.6/src/tests/antunit/core/location/src/task/EchoLocation.java b/framework/src/ant/apache-ant-1.9.6/src/tests/antunit/core/location/src/task/EchoLocation.java new file mode 100644 index 00000000..e306357d --- /dev/null +++ b/framework/src/ant/apache-ant-1.9.6/src/tests/antunit/core/location/src/task/EchoLocation.java @@ -0,0 +1,26 @@ +/* +Licensed to the Apache Software Foundation (ASF) under one or more +contributor license agreements. See the NOTICE file distributed with +this work for additional information regarding copyright ownership. +The ASF licenses this file to You under the Apache License, Version 2.0 +(the "License"); you may not use this file except in compliance with +the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ +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); + } +} |