| @@ -173,7 +173,7 @@ | |||||
| <!-- obsolete --> | <!-- obsolete --> | ||||
| <exclude>org/apache/tools/ant/taskdefs/optional/Jspc*</exclude> | <exclude>org/apache/tools/ant/taskdefs/optional/Jspc*</exclude> | ||||
| <exclude>org/apache/tools/ant/taskdefs/optional/Pvcs*</exclude> | <exclude>org/apache/tools/ant/taskdefs/optional/Pvcs*</exclude> | ||||
| <!-- xalan: workaround for diferent resource encoding --> | |||||
| <!-- xalan: workaround for different resource encoding --> | |||||
| <exclude>org/apache/tools/ant/taskdefs/optional/TraXLiaison*</exclude> | <exclude>org/apache/tools/ant/taskdefs/optional/TraXLiaison*</exclude> | ||||
| <!-- ERROR: UnknownHostException: chemical --> | <!-- ERROR: UnknownHostException: chemical --> | ||||
| <exclude>org/apache/tools/ant/taskdefs/optional/XmlValidateCatalog*</exclude> | <exclude>org/apache/tools/ant/taskdefs/optional/XmlValidateCatalog*</exclude> | ||||
| @@ -18,11 +18,9 @@ | |||||
| <project name="test" default="def" basedir="."> | <project name="test" default="def" basedir="."> | ||||
| <import file="../../buildfiletest-base.xml"/> | <import file="../../buildfiletest-base.xml"/> | ||||
| <property name="root" location="../../../../.."/> | |||||
| <target name="setUp"> | <target name="setUp"> | ||||
| <mkdir dir="${output}" /> | |||||
| <copy file="replaceregexp.properties" tofile="${output}/test.properties" /> | |||||
| <mkdir dir="${output}"/> | |||||
| <copy file="replaceregexp.properties" tofile="${output}/test.properties"/> | |||||
| </target> | </target> | ||||
| <target name="def"> | <target name="def"> | ||||
| @@ -30,39 +28,39 @@ | |||||
| </target> | </target> | ||||
| <target name="setUp-nl"> | <target name="setUp-nl"> | ||||
| <mkdir dir="${output}" /> | |||||
| <copy file="replaceregexp2.properties" tofile="${output}/test.properties" /> | |||||
| <mkdir dir="${output}"/> | |||||
| <copy file="replaceregexp2.properties" tofile="${output}/test.properties"/> | |||||
| </target> | </target> | ||||
| <target name="testReplace" depends="setUp"> | <target name="testReplace" depends="setUp"> | ||||
| <replaceregexp file="${output}/test.properties" byline="true"> | <replaceregexp file="${output}/test.properties" byline="true"> | ||||
| <regexp pattern="Old(.*)=(.*)" /> | |||||
| <substitution expression="NewProp=\1\2" /> | |||||
| <regexp pattern="Old(.*)=(.*)"/> | |||||
| <substitution expression="NewProp=\1\2"/> | |||||
| </replaceregexp> | </replaceregexp> | ||||
| </target> | </target> | ||||
| <!-- use in conjunction with testDirectoryDateDoesNotChange to make sure something will happen --> | <!-- use in conjunction with testDirectoryDateDoesNotChange to make sure something will happen --> | ||||
| <target name="touchDirectory"> | <target name="touchDirectory"> | ||||
| <copy file="replaceregexp.properties" tofile="${output}/test.properties" /> | |||||
| <copy file="replaceregexp.properties" tofile="${output}/test.properties"/> | |||||
| </target> | </target> | ||||
| <target name="testDirectoryDateDoesNotChange"> | <target name="testDirectoryDateDoesNotChange"> | ||||
| <replaceregexp file="${output}/test.properties" byline="true"> | <replaceregexp file="${output}/test.properties" byline="true"> | ||||
| <regexp pattern="foo" /> | |||||
| <regexp pattern="foo"/> | |||||
| <substitution expression="bar"/> | <substitution expression="bar"/> | ||||
| </replaceregexp> | </replaceregexp> | ||||
| </target> | </target> | ||||
| <target name="testDontAddNewline1" depends="setUp-nl"> | <target name="testDontAddNewline1" depends="setUp-nl"> | ||||
| <replaceregexp file="${output}/test.properties" byline="false"> | <replaceregexp file="${output}/test.properties" byline="false"> | ||||
| <regexp pattern="Old(.*)=(.*)" /> | |||||
| <substitution expression="NewProp=\1\2" /> | |||||
| <regexp pattern="Old(.*)=(.*)"/> | |||||
| <substitution expression="NewProp=\1\2"/> | |||||
| </replaceregexp> | </replaceregexp> | ||||
| </target> | </target> | ||||
| <target name="testDontAddNewline2" depends="setUp-nl"> | <target name="testDontAddNewline2" depends="setUp-nl"> | ||||
| <replaceregexp file="${output}/test.properties" byline="true"> | <replaceregexp file="${output}/test.properties" byline="true"> | ||||
| <regexp pattern="Old(.*)=(.*)" /> | |||||
| <substitution expression="NewProp=\1\2" /> | |||||
| <regexp pattern="Old(.*)=(.*)"/> | |||||
| <substitution expression="NewProp=\1\2"/> | |||||
| </replaceregexp> | </replaceregexp> | ||||
| </target> | </target> | ||||
| @@ -19,24 +19,20 @@ | |||||
| <import file="../../buildfiletest-base.xml"/> | <import file="../../buildfiletest-base.xml"/> | ||||
| <property name="root" location="../../../../.."/> | |||||
| <target name="def"> | <target name="def"> | ||||
| <fail>This build-file is intended to be run from the test cases</fail> | <fail>This build-file is intended to be run from the test cases</fail> | ||||
| </target> | </target> | ||||
| <target name="setup1"> | <target name="setup1"> | ||||
| <script language="javascript"> <![CDATA[ | |||||
| <script language="javascript"> | |||||
| <![CDATA[ | |||||
| for (i=1; i<=10; i++) { | for (i=1; i<=10; i++) { | ||||
| echo = testproject.createTask("echo"); | echo = testproject.createTask("echo"); | ||||
| setup1.addTask(echo); | setup1.addTask(echo); | ||||
| echo.setMessage(i*i); | echo.setMessage(i*i); | ||||
| } | } | ||||
| ]]> </script> | |||||
| ]]> | |||||
| </script> | |||||
| </target> | </target> | ||||
| <target name="example1" depends="setup1"/> | <target name="example1" depends="setup1"/> | ||||
| @@ -48,21 +44,21 @@ | |||||
| </target> | </target> | ||||
| <target name="useSrcAndEncoding"> | <target name="useSrcAndEncoding"> | ||||
| <mkdir dir="${output}" /> | |||||
| <mkdir dir="${output}"/> | |||||
| <property name="useSrcAndEncoding.encoding" value="UTF-8"/> | <property name="useSrcAndEncoding.encoding" value="UTF-8"/> | ||||
| <property name="useSrcAndEncoding.reader.encoding" value="${useSrcAndEncoding.encoding}" | <property name="useSrcAndEncoding.reader.encoding" value="${useSrcAndEncoding.encoding}" | ||||
| description="Set a different encoding to raise a failure (ex. ISO-8859-1)" /> | |||||
| description="Set a different encoding to raise a failure (ex. ISO-8859-1)"/> | |||||
| <property name="useSrcAndEncoding.file" location="${output}/script.useSrcAndEncoding.js"/> | <property name="useSrcAndEncoding.file" location="${output}/script.useSrcAndEncoding.js"/> | ||||
| <property name="useSrcAndEncoding.expectedProp" value="eacute [é]" /> | |||||
| <property name="useSrcAndEncoding.expectedProp" value="eacute [é]"/> | |||||
| <echo file="${useSrcAndEncoding.file}" encoding="${useSrcAndEncoding.encoding}" | <echo file="${useSrcAndEncoding.file}" encoding="${useSrcAndEncoding.encoding}" | ||||
| message="project.setNewProperty('useSrcAndEncoding.prop', '${useSrcAndEncoding.expectedProp}');"/> | |||||
| message="project.setNewProperty('useSrcAndEncoding.prop', '${useSrcAndEncoding.expectedProp}');"/> | |||||
| <script language="javascript" src="${useSrcAndEncoding.file}" encoding="${useSrcAndEncoding.reader.encoding}"/> | <script language="javascript" src="${useSrcAndEncoding.file}" encoding="${useSrcAndEncoding.reader.encoding}"/> | ||||
| <condition property="useSrcAndEncoding.testOK" > | <condition property="useSrcAndEncoding.testOK" > | ||||
| <equals arg1="${useSrcAndEncoding.expectedProp}" arg2="${useSrcAndEncoding.prop}" /> | |||||
| <equals arg1="${useSrcAndEncoding.expectedProp}" arg2="${useSrcAndEncoding.prop}"/> | |||||
| </condition> | </condition> | ||||
| <fail message="expected <${useSrcAndEncoding.expectedProp}> but was <${useSrcAndEncoding.prop}>" unless="useSrcAndEncoding.testOK" /> | |||||
| <fail message="expected <${useSrcAndEncoding.expectedProp}> but was <${useSrcAndEncoding.prop}>" unless="useSrcAndEncoding.testOK"/> | |||||
| </target> | </target> | ||||
| </project> | </project> | ||||
| @@ -19,8 +19,6 @@ | |||||
| <import file="../../../buildfiletest-base.xml"/> | <import file="../../../buildfiletest-base.xml"/> | ||||
| <property name="root" location="../../../../../.."/> | |||||
| <target name="def"> | <target name="def"> | ||||
| <fail>This build-file is intended to be run from the test cases</fail> | <fail>This build-file is intended to be run from the test cases</fail> | ||||
| </target> | </target> | ||||
| @@ -30,11 +28,9 @@ | |||||
| <attribute name="attr1"/> | <attribute name="attr1"/> | ||||
| <element name="fileset" type="fileset"/> | <element name="fileset" type="fileset"/> | ||||
| <![CDATA[ | <![CDATA[ | ||||
| project.log("Attribute attr1 = " + attributes.get("attr1")); | project.log("Attribute attr1 = " + attributes.get("attr1")); | ||||
| project.log("Fileset basedir = " | project.log("Fileset basedir = " | ||||
| + elements.get("fileset").get(0).getDir(project)); | + elements.get("fileset").get(0).getDir(project)); | ||||
| ]]> | ]]> | ||||
| </scriptdef> | </scriptdef> | ||||
| @@ -65,11 +61,9 @@ | |||||
| <attribute name="attr1"/> | <attribute name="attr1"/> | ||||
| <element name="fileset" classname="org.apache.tools.ant.types.FileSet"/> | <element name="fileset" classname="org.apache.tools.ant.types.FileSet"/> | ||||
| <![CDATA[ | <![CDATA[ | ||||
| project.log("Attribute attr1 = " + attributes.get("attr1")); | project.log("Attribute attr1 = " + attributes.get("attr1")); | ||||
| project.log("Fileset basedir = " | project.log("Fileset basedir = " | ||||
| + elements.get("fileset").get(0).getDir(project)); | + elements.get("fileset").get(0).getDir(project)); | ||||
| ]]> | ]]> | ||||
| </scriptdef> | </scriptdef> | ||||
| @@ -97,11 +91,9 @@ | |||||
| <attribute name="attr1"/> | <attribute name="attr1"/> | ||||
| <element name="fileset" classname="org.apache.tools.ant.types.FileSet"/> | <element name="fileset" classname="org.apache.tools.ant.types.FileSet"/> | ||||
| <![CDATA[ | <![CDATA[ | ||||
| java.lang.System.out.println("Attribute attr1 = " + attributes.get("attr1")); | java.lang.System.out.println("Attribute attr1 = " + attributes.get("attr1")); | ||||
| java.lang.System.out.println("Fileset basedir = " | java.lang.System.out.println("Fileset basedir = " | ||||
| + elements.get("fileset").get(0).getDir(project)); | + elements.get("fileset").get(0).getDir(project)); | ||||
| ]]> | ]]> | ||||
| </scriptdef> | </scriptdef> | ||||
| @@ -135,7 +127,6 @@ | |||||
| <scriptdef name="scripttest" language="javascript"> | <scriptdef name="scripttest" language="javascript"> | ||||
| <attribute name="attr1"/> | <attribute name="attr1"/> | ||||
| <![CDATA[ | <![CDATA[ | ||||
| project.log("Attribute value = " + attributes.get("attr1")); | project.log("Attribute value = " + attributes.get("attr1")); | ||||
| ]]> | ]]> | ||||
| </scriptdef> | </scriptdef> | ||||
| @@ -152,78 +143,74 @@ | |||||
| </target> | </target> | ||||
| <target name="useSrcAndEncoding"> | <target name="useSrcAndEncoding"> | ||||
| <mkdir dir="${output}" /> | |||||
| <mkdir dir="${output}"/> | |||||
| <property name="useSrcAndEncoding.encoding" value="UTF-8"/> | <property name="useSrcAndEncoding.encoding" value="UTF-8"/> | ||||
| <property name="useSrcAndEncoding.reader.encoding" value="${useSrcAndEncoding.encoding}" | <property name="useSrcAndEncoding.reader.encoding" value="${useSrcAndEncoding.encoding}" | ||||
| description="Set a different encoding to raise a failure (ex. ISO-8859-1)" /> | |||||
| description="Set a different encoding to raise a failure (ex. ISO-8859-1)"/> | |||||
| <property name="useSrcAndEncoding.file" location="${output}/script.useSrcAndEncoding.js"/> | <property name="useSrcAndEncoding.file" location="${output}/script.useSrcAndEncoding.js"/> | ||||
| <property name="useSrcAndEncoding.expectedProp" value="eacute [é]" /> | |||||
| <property name="useSrcAndEncoding.expectedProp" value="eacute [é]"/> | |||||
| <echo file="${useSrcAndEncoding.file}" encoding="${useSrcAndEncoding.encoding}" | <echo file="${useSrcAndEncoding.file}" encoding="${useSrcAndEncoding.encoding}" | ||||
| message="project.setNewProperty('useSrcAndEncoding.prop', '${useSrcAndEncoding.expectedProp}');"/> | |||||
| message="project.setNewProperty('useSrcAndEncoding.prop', '${useSrcAndEncoding.expectedProp}');"/> | |||||
| <scriptdef name="useSrcAndEncoding" language="javascript" src="${useSrcAndEncoding.file}" encoding="${useSrcAndEncoding.reader.encoding}"/> | <scriptdef name="useSrcAndEncoding" language="javascript" src="${useSrcAndEncoding.file}" encoding="${useSrcAndEncoding.reader.encoding}"/> | ||||
| <useSrcAndEncoding/> | <useSrcAndEncoding/> | ||||
| <condition property="useSrcAndEncoding.testOK" > | <condition property="useSrcAndEncoding.testOK" > | ||||
| <equals arg1="${useSrcAndEncoding.expectedProp}" arg2="${useSrcAndEncoding.prop}" /> | |||||
| <equals arg1="${useSrcAndEncoding.expectedProp}" arg2="${useSrcAndEncoding.prop}"/> | |||||
| </condition> | </condition> | ||||
| <fail message="expected <${useSrcAndEncoding.expectedProp}> but was <${useSrcAndEncoding.prop}>" unless="useSrcAndEncoding.testOK" /> | |||||
| <fail message="expected <${useSrcAndEncoding.expectedProp}> but was <${useSrcAndEncoding.prop}>" unless="useSrcAndEncoding.testOK"/> | |||||
| </target> | </target> | ||||
| <target name="useCompiled"> | <target name="useCompiled"> | ||||
| <!-- Test with 'javax' manager, 'bsf' manager already compiles the script. --> | <!-- Test with 'javax' manager, 'bsf' manager already compiles the script. --> | ||||
| <scriptdef manager="javax" name="heavyscript" language="javascript" src="heavy-script.js" encoding="UTF-8" compiled="true" /> | |||||
| <heavyscript /> | |||||
| <heavyscript /> | |||||
| <heavyscript /> | |||||
| <heavyscript /> | |||||
| <heavyscript /> | |||||
| <heavyscript /> | |||||
| <heavyscript /> | |||||
| <heavyscript /> | |||||
| <heavyscript /> | |||||
| <heavyscript /> | |||||
| <heavyscript /> | |||||
| <heavyscript /> | |||||
| <heavyscript /> | |||||
| <heavyscript /> | |||||
| <heavyscript /> | |||||
| <heavyscript /> | |||||
| <heavyscript /> | |||||
| <heavyscript /> | |||||
| <heavyscript /> | |||||
| <heavyscript /> | |||||
| <scriptdef manager="javax" name="heavyscript" language="javascript" src="heavy-script.js" encoding="UTF-8" compiled="true"/> | |||||
| <heavyscript/> | |||||
| <heavyscript/> | |||||
| <heavyscript/> | |||||
| <heavyscript/> | |||||
| <heavyscript/> | |||||
| <heavyscript/> | |||||
| <heavyscript/> | |||||
| <heavyscript/> | |||||
| <heavyscript/> | |||||
| <heavyscript/> | |||||
| <heavyscript/> | |||||
| <heavyscript/> | |||||
| <heavyscript/> | |||||
| <heavyscript/> | |||||
| <heavyscript/> | |||||
| <heavyscript/> | |||||
| <heavyscript/> | |||||
| <heavyscript/> | |||||
| <heavyscript/> | |||||
| <heavyscript/> | |||||
| </target> | </target> | ||||
| <target name="useNotCompiled"> | <target name="useNotCompiled"> | ||||
| <scriptdef manager="javax" name="heavyscriptNotCompiled" language="javascript" src="heavy-script.js" encoding="UTF-8" compiled="false" /> | |||||
| <heavyscriptNotCompiled /> | |||||
| <heavyscriptNotCompiled /> | |||||
| <heavyscriptNotCompiled /> | |||||
| <heavyscriptNotCompiled /> | |||||
| <heavyscriptNotCompiled /> | |||||
| <heavyscriptNotCompiled /> | |||||
| <heavyscriptNotCompiled /> | |||||
| <heavyscriptNotCompiled /> | |||||
| <heavyscriptNotCompiled /> | |||||
| <heavyscriptNotCompiled /> | |||||
| <heavyscriptNotCompiled /> | |||||
| <heavyscriptNotCompiled /> | |||||
| <heavyscriptNotCompiled /> | |||||
| <heavyscriptNotCompiled /> | |||||
| <heavyscriptNotCompiled /> | |||||
| <heavyscriptNotCompiled /> | |||||
| <heavyscriptNotCompiled /> | |||||
| <heavyscriptNotCompiled /> | |||||
| <heavyscriptNotCompiled /> | |||||
| <heavyscriptNotCompiled /> | |||||
| <scriptdef manager="javax" name="heavyscriptNotCompiled" language="javascript" src="heavy-script.js" encoding="UTF-8" compiled="false"/> | |||||
| <heavyscriptNotCompiled/> | |||||
| <heavyscriptNotCompiled/> | |||||
| <heavyscriptNotCompiled/> | |||||
| <heavyscriptNotCompiled/> | |||||
| <heavyscriptNotCompiled/> | |||||
| <heavyscriptNotCompiled/> | |||||
| <heavyscriptNotCompiled/> | |||||
| <heavyscriptNotCompiled/> | |||||
| <heavyscriptNotCompiled/> | |||||
| <heavyscriptNotCompiled/> | |||||
| <heavyscriptNotCompiled/> | |||||
| <heavyscriptNotCompiled/> | |||||
| <heavyscriptNotCompiled/> | |||||
| <heavyscriptNotCompiled/> | |||||
| <heavyscriptNotCompiled/> | |||||
| <heavyscriptNotCompiled/> | |||||
| <heavyscriptNotCompiled/> | |||||
| <heavyscriptNotCompiled/> | |||||
| <heavyscriptNotCompiled/> | |||||
| <heavyscriptNotCompiled/> | |||||
| </target> | </target> | ||||
| </project> | </project> | ||||
| @@ -31,6 +31,7 @@ import org.junit.Rule; | |||||
| import org.junit.Test; | import org.junit.Test; | ||||
| import static org.junit.Assert.assertEquals; | import static org.junit.Assert.assertEquals; | ||||
| import static org.junit.Assert.assertNotNull; | |||||
| /** | /** | ||||
| * Test to see if static initializers are invoked the same way | * Test to see if static initializers are invoked the same way | ||||
| @@ -47,6 +48,7 @@ public class InitializeClassTest { | |||||
| @Before | @Before | ||||
| public void setUp() { | public void setUp() { | ||||
| assertNotNull("build.tests.value not set", System.getProperty("build.tests.value")); | |||||
| buildRule.configureProject("src/etc/testcases/taskdefs/initializeclass.xml"); | buildRule.configureProject("src/etc/testcases/taskdefs/initializeclass.xml"); | ||||
| f1 = buildRule.getProject().resolveFile("forkedout"); | f1 = buildRule.getProject().resolveFile("forkedout"); | ||||
| f2 = buildRule.getProject().resolveFile("unforkedout"); | f2 = buildRule.getProject().resolveFile("unforkedout"); | ||||
| @@ -19,6 +19,7 @@ | |||||
| package org.apache.tools.ant.taskdefs; | package org.apache.tools.ant.taskdefs; | ||||
| import static org.junit.Assert.assertEquals; | import static org.junit.Assert.assertEquals; | ||||
| import static org.junit.Assert.assertNotNull; | |||||
| import org.apache.tools.ant.BuildException; | import org.apache.tools.ant.BuildException; | ||||
| import org.apache.tools.ant.BuildFileRule; | import org.apache.tools.ant.BuildFileRule; | ||||
| @@ -39,6 +40,7 @@ public class XmlnsTest { | |||||
| @Before | @Before | ||||
| public void setUp() { | public void setUp() { | ||||
| assertNotNull("build.tests.value not set", System.getProperty("build.tests.value")); | |||||
| buildRule.configureProject("src/etc/testcases/taskdefs/xmlns.xml"); | buildRule.configureProject("src/etc/testcases/taskdefs/xmlns.xml"); | ||||
| } | } | ||||
| @@ -24,6 +24,7 @@ import org.junit.Rule; | |||||
| import org.junit.Test; | import org.junit.Test; | ||||
| import static org.hamcrest.Matchers.containsString; | import static org.hamcrest.Matchers.containsString; | ||||
| import static org.junit.Assert.assertNotNull; | |||||
| import static org.junit.Assert.assertThat; | import static org.junit.Assert.assertThat; | ||||
| /** | /** | ||||
| @@ -37,6 +38,7 @@ public class JDependTest { | |||||
| @Before | @Before | ||||
| public void setUp() { | public void setUp() { | ||||
| assertNotNull("build.tests.value not set", System.getProperty("build.tests.value")); | |||||
| buildRule.configureProject("src/etc/testcases/taskdefs/optional/jdepend/jdepend.xml"); | buildRule.configureProject("src/etc/testcases/taskdefs/optional/jdepend/jdepend.xml"); | ||||
| } | } | ||||