git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@691944 13f79535-47bb-0310-9956-ffa450edef68master
@@ -17,6 +17,14 @@ | |||
--> | |||
<project name="antunit-base"> | |||
<property name="input" location="${java.io.tmpdir}/testinput"/> | |||
<property name="output" location="${java.io.tmpdir}/testoutput"/> | |||
<target name="tearDown"> | |||
<delete dir="${input}"/> | |||
<delete dir="${output}"/> | |||
</target> | |||
<target name="antunit"> | |||
<antunit xmlns="antlib:org.apache.ant.antunit"> | |||
<plainlistener /> | |||
@@ -18,50 +18,49 @@ | |||
<project default="antunit" xmlns:au="antlib:org.apache.ant.antunit"> | |||
<import file="../antunit-base.xml" /> | |||
<target name="tearDown"> | |||
<delete file="binaryAppendDest" /> | |||
<delete file="encodeStringDest" /> | |||
</target> | |||
<property name="encodeStringDest" location="${output}/encodeStringDest"/> | |||
<target name="testBinaryAppend"> | |||
<property name="binaryAppendDest" location="${output}/binaryAppendDest"/> | |||
<mkdir dir="${output}"/> | |||
<au:assertTrue message="prerequisite conditions unmet"> | |||
<length length="0"> | |||
<!-- allow for nonexistent OR zero-length: --> | |||
<fileset file="binaryAppendDest" /> | |||
<fileset file="${binaryAppendDest}" /> | |||
</length> | |||
</au:assertTrue> | |||
<echo file="binaryAppendDest">x</echo> | |||
<echo file="${binaryAppendDest}">x</echo> | |||
<au:assertTrue message="destfile setup failed"> | |||
<length length="1" file="binaryAppendDest" /> | |||
<length length="1" file="${binaryAppendDest}" /> | |||
</au:assertTrue> | |||
<concat append="true" destfile="binaryAppendDest" binary="true"> | |||
<concat append="true" destfile="${binaryAppendDest}" binary="true"> | |||
<string value="x" /> | |||
</concat> | |||
<au:assertTrue message="expected length 2"> | |||
<length file="binaryAppendDest" length="2" /> | |||
<length file="${binaryAppendDest}" length="2" /> | |||
</au:assertTrue> | |||
</target> | |||
<target name="testStringEncoding" if="os.unix"> | |||
<property name="br" value="${line.separator}" /> | |||
<concat destfile="encodeStringDest" | |||
<concat destfile="${encodeStringDest}" | |||
outputEncoding="utf-16">foo${br}bar${br}baz${br}</concat> | |||
<au:assertTrue> | |||
<resourcesmatch astext="true"> | |||
<file file="utf-16.expected" /> | |||
<file file="encodeStringDest" /> | |||
<file file="${encodeStringDest}" /> | |||
</resourcesmatch> | |||
</au:assertTrue> | |||
</target> | |||
<target name="testStringEncodingWindows" if="os.windows"> | |||
<property name="br" value="${line.separator}" /> | |||
<concat destfile="encodeStringDest" | |||
<concat destfile="${encodeStringDest}" | |||
outputEncoding="utf-16">foo${br}bar${br}baz${br}</concat> | |||
<au:assertTrue> | |||
<resourcesmatch astext="true"> | |||
<file file="utf-16.expected.windows" /> | |||
<file file="encodeStringDest" /> | |||
<file file="${encodeStringDest}" /> | |||
</resourcesmatch> | |||
</au:assertTrue> | |||
</target> | |||
@@ -1,4 +1,4 @@ | |||
<?xml version="1.0" encoding="utf-8"?> | |||
<?xml version="1.0" encoding="utf-8"?> | |||
<!-- | |||
Licensed to the Apache Software Foundation (ASF) under one or more | |||
contributor license agreements. See the NOTICE file distributed with | |||
@@ -15,128 +15,125 @@ | |||
See the License for the specific language governing permissions and | |||
limitations under the License. | |||
--> | |||
<project name="resourcecontains-test" default="antunit" xmlns:au="antlib:org.apache.ant.antunit"> | |||
<import file="../../antunit-base.xml"/> | |||
<target name="setUp"> | |||
<property name="file" location="${java.io.tmpdir}/test-resource.txt"/> | |||
<echo file="${file}" message="loads of text!"/> | |||
</target> | |||
<target name="tearDown"> | |||
<delete file="${file}"/> | |||
</target> | |||
<target name="testcontains"> | |||
<au:assertTrue message="Should have found the text in the resource"> | |||
<resourcecontains resource="${file}" substring="text"/> | |||
</au:assertTrue> | |||
</target> | |||
<target name="testContainsLowerNonCS"> | |||
<echo file="${file}" message="LOADS OF TEXT!"/> | |||
<au:assertTrue message="Should have found the text in the resource"> | |||
<resourcecontains resource="${file}" substring="text" | |||
casesensitive="false"/> | |||
</au:assertTrue> | |||
</target> | |||
<target name="testContainsUpperNonCS"> | |||
<au:assertTrue message="Should have found the text in the resource"> | |||
<resourcecontains resource="${file}" substring="TEXT" | |||
casesensitive="false"/> | |||
</au:assertTrue> | |||
</target> | |||
<target name="testContainsEmptyString"> | |||
<au:assertTrue message="Should have found the text in the resource"> | |||
<resourcecontains resource="${file}" substring="" /> | |||
</au:assertTrue> | |||
</target> | |||
<target name="testContainsEmptyProperty"> | |||
<property name="testContainsEmptyProperty" value="" /> | |||
<au:assertTrue message="Should have found the text in the resource"> | |||
<resourcecontains resource="${file}" | |||
substring="${testContainsEmptyProperty}" /> | |||
</au:assertTrue> | |||
</target> | |||
<target name="testwithemptyfile"> | |||
<truncate file="${file}"/> | |||
<au:assertFalse message="Should have found nothing as file is empty"> | |||
<resourcecontains resource="${file}" substring="text"/> | |||
</au:assertFalse> | |||
</target> | |||
<target name="testWithEmptyFileAndSubstring"> | |||
<truncate file="${file}"/> | |||
<au:assertTrue message="Empty resource should contain empty string"> | |||
<resourcecontains resource="${file}" substring=""/> | |||
</au:assertTrue> | |||
</target> | |||
<target name="testdoesntcontain"> | |||
<au:assertFalse message="Should have found nothing as file is empty"> | |||
<resourcecontains resource="${file}" substring="futurama"/> | |||
</au:assertFalse> | |||
</target> | |||
<target name="testFileRefContains"> | |||
<file id="file" file="${file}" /> | |||
<au:assertTrue message="Should have found the text in the resource"> | |||
<resourcecontains refid="file" substring="text"/> | |||
</au:assertTrue> | |||
</target> | |||
<target name="testStringRefContains"> | |||
<string id="string">loads of text!</string> | |||
<au:assertTrue message="Should have found the text in the resource"> | |||
<resourcecontains refid="string" substring="text"/> | |||
</au:assertTrue> | |||
</target> | |||
<target name="testTextConcatRefContains"> | |||
<resources id="concat"> | |||
<concat>loads of text!</concat> | |||
</resources> | |||
<au:assertTrue message="Should have found the text in the resource"> | |||
<resourcecontains refid="concat" substring="text"/> | |||
</au:assertTrue> | |||
</target> | |||
<target name="testFileConcatRefContains"> | |||
<resources id="concat"> | |||
<concat><file file="${file}" /></concat> | |||
</resources> | |||
<au:assertTrue message="Should have found the text in the resource"> | |||
<resourcecontains refid="concat" substring="text"/> | |||
</au:assertTrue> | |||
</target> | |||
<target name="testMultiConcatRefContains"> | |||
<resources id="concat"> | |||
<concat> | |||
<header>HEADER</header> | |||
<footer>FOOTER</footer> | |||
<string>foo</string> | |||
<file file="${file}" /> | |||
<string>bar</string> | |||
</concat> | |||
</resources> | |||
<au:assertTrue message="Should have found the text in the resource"> | |||
<resourcecontains refid="concat" substring="text"/> | |||
</au:assertTrue> | |||
</target> | |||
<target name="testFirstRefContains"> | |||
<first id="first"> | |||
<fileset dir="${basedir}" includes="*-test.xml" /> | |||
</first> | |||
<au:assertTrue message="Should have found the text in the resource"> | |||
<resourcecontains refid="first" substring="project"/> | |||
</au:assertTrue> | |||
</target> | |||
</project> | |||
<project name="resourcecontains-test" default="antunit" xmlns:au="antlib:org.apache.ant.antunit"> | |||
<import file="../../antunit-base.xml"/> | |||
<target name="setUp"> | |||
<mkdir dir="${output}"/> | |||
<property name="file" location="${output}/test-resource.txt"/> | |||
<echo file="${file}" message="loads of text!"/> | |||
</target> | |||
<target name="testcontains"> | |||
<au:assertTrue message="Should have found the text in the resource"> | |||
<resourcecontains resource="${file}" substring="text"/> | |||
</au:assertTrue> | |||
</target> | |||
<target name="testContainsLowerNonCS"> | |||
<echo file="${file}" message="LOADS OF TEXT!"/> | |||
<au:assertTrue message="Should have found the text in the resource"> | |||
<resourcecontains resource="${file}" substring="text" | |||
casesensitive="false"/> | |||
</au:assertTrue> | |||
</target> | |||
<target name="testContainsUpperNonCS"> | |||
<au:assertTrue message="Should have found the text in the resource"> | |||
<resourcecontains resource="${file}" substring="TEXT" | |||
casesensitive="false"/> | |||
</au:assertTrue> | |||
</target> | |||
<target name="testContainsEmptyString"> | |||
<au:assertTrue message="Should have found the text in the resource"> | |||
<resourcecontains resource="${file}" substring="" /> | |||
</au:assertTrue> | |||
</target> | |||
<target name="testContainsEmptyProperty"> | |||
<property name="testContainsEmptyProperty" value="" /> | |||
<au:assertTrue message="Should have found the text in the resource"> | |||
<resourcecontains resource="${file}" | |||
substring="${testContainsEmptyProperty}" /> | |||
</au:assertTrue> | |||
</target> | |||
<target name="testwithemptyfile"> | |||
<truncate file="${file}"/> | |||
<au:assertFalse message="Should have found nothing as file is empty"> | |||
<resourcecontains resource="${file}" substring="text"/> | |||
</au:assertFalse> | |||
</target> | |||
<target name="testWithEmptyFileAndSubstring"> | |||
<truncate file="${file}"/> | |||
<au:assertTrue message="Empty resource should contain empty string"> | |||
<resourcecontains resource="${file}" substring=""/> | |||
</au:assertTrue> | |||
</target> | |||
<target name="testdoesntcontain"> | |||
<au:assertFalse message="Should have found nothing as file is empty"> | |||
<resourcecontains resource="${file}" substring="futurama"/> | |||
</au:assertFalse> | |||
</target> | |||
<target name="testFileRefContains"> | |||
<file id="file" file="${file}" /> | |||
<au:assertTrue message="Should have found the text in the resource"> | |||
<resourcecontains refid="file" substring="text"/> | |||
</au:assertTrue> | |||
</target> | |||
<target name="testStringRefContains"> | |||
<string id="string">loads of text!</string> | |||
<au:assertTrue message="Should have found the text in the resource"> | |||
<resourcecontains refid="string" substring="text"/> | |||
</au:assertTrue> | |||
</target> | |||
<target name="testTextConcatRefContains"> | |||
<resources id="concat"> | |||
<concat>loads of text!</concat> | |||
</resources> | |||
<au:assertTrue message="Should have found the text in the resource"> | |||
<resourcecontains refid="concat" substring="text"/> | |||
</au:assertTrue> | |||
</target> | |||
<target name="testFileConcatRefContains"> | |||
<resources id="concat"> | |||
<concat><file file="${file}" /></concat> | |||
</resources> | |||
<au:assertTrue message="Should have found the text in the resource"> | |||
<resourcecontains refid="concat" substring="text"/> | |||
</au:assertTrue> | |||
</target> | |||
<target name="testMultiConcatRefContains"> | |||
<resources id="concat"> | |||
<concat> | |||
<header>HEADER</header> | |||
<footer>FOOTER</footer> | |||
<string>foo</string> | |||
<file file="${file}" /> | |||
<string>bar</string> | |||
</concat> | |||
</resources> | |||
<au:assertTrue message="Should have found the text in the resource"> | |||
<resourcecontains refid="concat" substring="text"/> | |||
</au:assertTrue> | |||
</target> | |||
<target name="testFirstRefContains"> | |||
<first id="first"> | |||
<fileset dir="${basedir}" includes="*-test.xml" /> | |||
</first> | |||
<au:assertTrue message="Should have found the text in the resource"> | |||
<resourcecontains refid="first" substring="project"/> | |||
</au:assertTrue> | |||
</target> | |||
</project> |
@@ -18,22 +18,18 @@ | |||
<project name="delete-test" basedir="." default="antunit" | |||
xmlns:au="antlib:org.apache.ant.antunit"> | |||
<property name="working.dir" value="working"/> | |||
<property name="existing.dir" value="working/exists"/> | |||
<property name="nonexistent.dir" value="working/nonexists"/> | |||
<import file="../antunit-base.xml" /> | |||
<property name="existing.dir" location="${output}/exists"/> | |||
<property name="nonexistent.dir" location="${output}/nonexists"/> | |||
<target name="init"> | |||
<delete dir="${working.dir}"/> | |||
<mkdir dir="${working.dir}"/> | |||
<delete dir="${output}"/> | |||
<mkdir dir="${output}"/> | |||
<mkdir dir="${existing.dir}"/> | |||
</target> | |||
<target name="tearDown"> | |||
<delete dir="${working.dir}"/> | |||
</target> | |||
<!--test that you can delete a fileset with a nonexistent dir without failure--> | |||
<target name="testdelfileset" depends="init"> | |||
<delete quiet="true" includeEmptyDirs="true"> | |||
@@ -1,4 +1,4 @@ | |||
<?xml version="1.0"?> | |||
<?xml version="1.0"?> | |||
<!-- | |||
Licensed to the Apache Software Foundation (ASF) under one or more | |||
contributor license agreements. See the NOTICE file distributed with | |||
@@ -15,45 +15,45 @@ | |||
See the License for the specific language governing permissions and | |||
limitations under the License. | |||
--> | |||
<project name="dirname-test" basedir="." default="antunit" xmlns:au="antlib:org.apache.ant.antunit"> | |||
<import file="../antunit-base.xml"/> | |||
<target name="test1"> | |||
<au:expectfailure expectedmessage="property attribute required"> | |||
<dirname/> | |||
</au:expectfailure> | |||
</target> | |||
<target name="test2"> | |||
<au:expectfailure expectedmessage="file attribute required"> | |||
<dirname property="propname"/> | |||
</au:expectfailure> | |||
</target> | |||
<target name="test3"> | |||
<au:expectfailure expectedmessage="property attribute required"> | |||
<dirname file="filename"/> | |||
</au:expectfailure> | |||
</target> | |||
<target name="init-test4"> | |||
<condition property="valid.os"> | |||
<and> | |||
<not><os family="dos"/></not><not><os family="netware"/></not> | |||
</and> | |||
</condition> | |||
</target> | |||
<target name="test4" depends="init-test4" if="valid.os"> | |||
<dirname property="local.dir" file="/usr/local/foo.txt"/> | |||
<au:assertPropertyEquals name="local.dir" | |||
value="${file.separator}usr${file.separator}local"/> | |||
</target> | |||
<target name="test5"> | |||
<dirname property="base.dir" file="foo.txt"/> | |||
<au:assertPropertyEquals name="base.dir" value="${basedir}"/> | |||
</target> | |||
</project> | |||
<project name="dirname-test" basedir="." default="antunit" xmlns:au="antlib:org.apache.ant.antunit"> | |||
<import file="../antunit-base.xml"/> | |||
<target name="test1"> | |||
<au:expectfailure expectedmessage="property attribute required"> | |||
<dirname/> | |||
</au:expectfailure> | |||
</target> | |||
<target name="test2"> | |||
<au:expectfailure expectedmessage="file attribute required"> | |||
<dirname property="propname"/> | |||
</au:expectfailure> | |||
</target> | |||
<target name="test3"> | |||
<au:expectfailure expectedmessage="property attribute required"> | |||
<dirname file="filename"/> | |||
</au:expectfailure> | |||
</target> | |||
<target name="init-test4"> | |||
<condition property="valid.os"> | |||
<and> | |||
<not><os family="dos"/></not><not><os family="netware"/></not> | |||
</and> | |||
</condition> | |||
</target> | |||
<target name="test4" depends="init-test4" if="valid.os"> | |||
<dirname property="local.dir" file="/usr/local/foo.txt"/> | |||
<au:assertPropertyEquals name="local.dir" | |||
value="${file.separator}usr${file.separator}local"/> | |||
</target> | |||
<target name="test5"> | |||
<dirname property="base.dir" file="foo.txt"/> | |||
<au:assertPropertyEquals name="base.dir" value="${basedir}"/> | |||
</target> | |||
</project> |
@@ -19,14 +19,8 @@ | |||
<project name="echo-test" default="antunit" xmlns:au="antlib:org.apache.ant.antunit"> | |||
<import file="../antunit-base.xml" /> | |||
<property name="dest.dir" location="echo.dest"/> | |||
<target name="setUp"> | |||
<mkdir dir="${dest.dir}" /> | |||
</target> | |||
<target name="tearDown"> | |||
<delete dir="${dest.dir}"/> | |||
<mkdir dir="${output}" /> | |||
</target> | |||
<target name="test1"> | |||
@@ -66,11 +60,11 @@ | |||
</target> | |||
<target name="testFile"> | |||
<echo file="${dest.dir}/echo.txt">Simple text</echo> | |||
<echo file="${output}/echo.txt">Simple text</echo> | |||
<au:assertTrue> | |||
<resourcecount count="1"> | |||
<restrict> | |||
<file file="${dest.dir}/echo.txt" /> | |||
<file file="${output}/echo.txt" /> | |||
<contains text="Simple text" /> | |||
</restrict> | |||
</resourcecount> | |||
@@ -78,11 +72,11 @@ | |||
</target> | |||
<target name="testOutputFile"> | |||
<echo output="${dest.dir}/echo.txt">Simple text</echo> | |||
<echo output="${output}/echo.txt">Simple text</echo> | |||
<au:assertTrue> | |||
<resourcecount count="1"> | |||
<restrict> | |||
<file file="${dest.dir}/echo.txt" /> | |||
<file file="${output}/echo.txt" /> | |||
<contains text="Simple text" /> | |||
</restrict> | |||
</resourcecount> | |||
@@ -90,12 +84,12 @@ | |||
</target> | |||
<target name="testAppend"> | |||
<echo file="${dest.dir}/echo.txt">Simple text</echo> | |||
<echo file="${dest.dir}/echo.txt" append="true">Appended</echo> | |||
<echo file="${output}/echo.txt">Simple text</echo> | |||
<echo file="${output}/echo.txt" append="true">Appended</echo> | |||
<au:assertTrue> | |||
<resourcecount count="1"> | |||
<restrict> | |||
<file file="${dest.dir}/echo.txt" /> | |||
<file file="${output}/echo.txt" /> | |||
<contains text="Simple text" /> | |||
<contains text="Appended" /> | |||
</restrict> | |||
@@ -104,11 +98,11 @@ | |||
</target> | |||
<target name="testEmptyEncoding"> | |||
<echo file="${dest.dir}/echo.txt" encoding="">Simple text</echo> | |||
<echo file="${output}/echo.txt" encoding="">Simple text</echo> | |||
<au:assertTrue> | |||
<resourcecount count="1"> | |||
<restrict> | |||
<file file="${dest.dir}/echo.txt" /> | |||
<file file="${output}/echo.txt" /> | |||
<contains text="Simple text" /> | |||
</restrict> | |||
</resourcecount> | |||
@@ -117,12 +111,12 @@ | |||
<target name="testUTF16Encoding"> | |||
<property name="char" value="©" /> | |||
<echo file="${dest.dir}/echo16.txt" encoding="UTF-16">${char}</echo> | |||
<echo file="${output}/echo16.txt" encoding="UTF-16">${char}</echo> | |||
<au:assertTrue> | |||
<resourcecount count="1"> | |||
<restrict> | |||
<concat encoding="UTF-16"> | |||
<file file="${dest.dir}/echo16.txt" /> | |||
<file file="${output}/echo16.txt" /> | |||
</concat> | |||
<contains text="${char}" /> | |||
</restrict> | |||
@@ -132,12 +126,12 @@ | |||
<target name="testUTF8Encoding"> | |||
<property name="char" value="©" /> | |||
<echo file="${dest.dir}/echo8.txt" encoding="UTF8">${char}</echo> | |||
<echo file="${output}/echo8.txt" encoding="UTF8">${char}</echo> | |||
<au:assertTrue> | |||
<resourcecount count="1"> | |||
<restrict> | |||
<concat encoding="UTF-8"> | |||
<file file="${dest.dir}/echo8.txt" /> | |||
<file file="${output}/echo8.txt" /> | |||
</concat> | |||
<contains text="${char}" /> | |||
</restrict> | |||
@@ -17,11 +17,12 @@ | |||
--> | |||
<project default="antunit" xmlns:au="antlib:org.apache.ant.antunit"> | |||
<!-- note relies on antunit built from svn trunk (1.1-alpha) --> | |||
<!-- note relies on antunit 1.1 --> | |||
<import file="../antunit-base.xml"/> | |||
<target name="setUp"> | |||
<property name="file" location="${java.io.tmpdir}/echoed.xml"/> | |||
<property name="file" location="${output}/echoed.xml"/> | |||
<mkdir dir="${output}"/> | |||
<echoxml file="${file}"> | |||
<project> | |||
<property name="foo" value="bar" /> | |||
@@ -34,12 +35,8 @@ | |||
</echoxml> | |||
</target> | |||
<target name="tearDown"> | |||
<delete file="${file}"/> | |||
</target> | |||
<target name="testPass"> | |||
<ant antfile="${file}"/> | |||
<ant antfile="${file}"/> | |||
</target> | |||
<target name="testFail"> | |||
@@ -17,34 +17,28 @@ | |||
--> | |||
<project default="antunit" xmlns:au="antlib:org.apache.ant.antunit"> | |||
<!-- note relies on antunit built from svn trunk (1.1-alpha) --> | |||
<!-- note relies on antunit 1.1 --> | |||
<import file="../antunit-base.xml" /> | |||
<target name="setUp"> | |||
<mkdir dir="${java.io.tmpdir}/gzip-test" /> | |||
<mkdir dir="${java.io.tmpdir}/gzip-test/empty" /> | |||
<touch file="${java.io.tmpdir}/gzip-test/fileone" /> | |||
<touch file="${java.io.tmpdir}/gzip-test/filetwo" /> | |||
</target> | |||
<target name="tearDown"> | |||
<delete includeemptydirs="true"> | |||
<fileset dir="${java.io.tmpdir}/gzip-test" /> | |||
</delete> | |||
<mkdir dir="${output}" /> | |||
<mkdir dir="${output}/empty" /> | |||
<touch file="${output}/fileone" /> | |||
<touch file="${output}/filetwo" /> | |||
</target> | |||
<target name="testFailNone"> | |||
<au:expectfailure expectedmessage="No resource selected, gzip needs exactly one resource." message="Should have thrown an exception"> | |||
<gzip destfile="${java.io.tmpdir}/gzip-test/file.gz"> | |||
<fileset dir="${java.io.tmpdir}/gzip-test/empty" /> | |||
<gzip destfile="${output}/file.gz"> | |||
<fileset dir="${output}/empty" /> | |||
</gzip> | |||
</au:expectfailure> | |||
</target> | |||
<target name="testFailTwo"> | |||
<au:expectfailure expectedmessage="gzip cannot handle multiple resources at once. (2 resources were selected.)" message="Should have thrown an exception"> | |||
<gzip destfile="${java.io.tmpdir}/gzip-test/file.gz"> | |||
<fileset dir="${java.io.tmpdir}/gzip-test" /> | |||
<gzip destfile="${output}/file.gz"> | |||
<fileset dir="${output}" /> | |||
</gzip> | |||
</au:expectfailure> | |||
</target> | |||
@@ -1,4 +1,4 @@ | |||
<?xml version="1.0"?> | |||
<?xml version="1.0"?> | |||
<!-- | |||
Licensed to the Apache Software Foundation (ASF) under one or more | |||
contributor license agreements. See the NOTICE file distributed with | |||
@@ -15,19 +15,19 @@ | |||
See the License for the specific language governing permissions and | |||
limitations under the License. | |||
--> | |||
<project name="test-input" default="antunit" xmlns:au="antlib:org.apache.ant.antunit"> | |||
<import file="../antunit-base.xml"/> | |||
<target name="setUp"> | |||
<available property="jdk1.6+" classname="java.util.ServiceLoader"/> | |||
</target> | |||
<target name="test-secure-input" if="jdk1.6+"> | |||
<input message="secure-input:>" addproperty="the.password"> | |||
<handler classname="org.apache.tools.ant.input.SecureInputHandler"/> | |||
</input> | |||
<au:assertPropertySet name="the.password"/> | |||
</target> | |||
</project> | |||
<project name="test-input" default="antunit" xmlns:au="antlib:org.apache.ant.antunit"> | |||
<import file="../antunit-base.xml"/> | |||
<target name="setUp"> | |||
<available property="jdk1.6+" classname="java.util.ServiceLoader"/> | |||
</target> | |||
<target name="test-secure-input" if="jdk1.6+"> | |||
<input message="secure-input:>" addproperty="the.password"> | |||
<handler classname="org.apache.tools.ant.input.SecureInputHandler"/> | |||
</input> | |||
<au:assertPropertySet name="the.password"/> | |||
</target> | |||
</project> |
@@ -18,13 +18,10 @@ | |||
<project default="antunit" xmlns:au="antlib:org.apache.ant.antunit"> | |||
<import file="../antunit-base.xml" /> | |||
<property name="index.jar" location="index.jar" /> | |||
<target name="tearDown"> | |||
<delete file="${index.jar}" /> | |||
</target> | |||
<target name="testIndexOnlyUpdate"> | |||
<mkdir dir="${output}"/> | |||
<property name="index.jar" location="${output}/index.jar" /> | |||
<jar destfile="${index.jar}" index="false"> | |||
<fileset dir="${basedir}" includes="*-test.xml" /> | |||
</jar> | |||
@@ -18,8 +18,7 @@ | |||
<project default="antunit" xmlns:au="antlib:org.apache.ant.antunit"> | |||
<import file="../antunit-base.xml" /> | |||
<property name="ant-build" location="../../../../build"/> | |||
<property name="javac-dir" location="${ant-build}/ant-unit/javac-dir"/> | |||
<property name="javac-dir" location="${output}/javac-dir"/> | |||
<property name="build-dir" location="${javac-dir}/build"/> | |||
<target name="test-includeDestClasses"> | |||
@@ -20,12 +20,12 @@ | |||
<import file="../antunit-base.xml" /> | |||
<property name="dir" location="lengthtestdir" /> | |||
<property name="dir.a" location="${dir}/a" /> | |||
<property name="dir.b" location="${dir}/b" /> | |||
<property name="zipfile" location="lengthtest.zip" /> | |||
<property name="dir.a" location="${input}/a" /> | |||
<property name="dir.b" location="${input}/b" /> | |||
<property name="zipfile" location="${output}/lengthtest.zip" /> | |||
<target name="setUp"> | |||
<mkdir dir="${output}" /> | |||
<mkdir dir="${dir.a}" /> | |||
<mkdir dir="${dir.b}" /> | |||
<property name="foo" location="${dir.a}/foo" /> | |||
@@ -34,14 +34,9 @@ | |||
<echo file="${bar}" message="bar" /> | |||
</target> | |||
<target name="tearDown"> | |||
<delete dir="${dir}" /> | |||
<delete file="${zipfile}" /> | |||
</target> | |||
<target name="testEach" depends="setUp"> | |||
<length mode="each" property="length.each"> | |||
<fileset id="fs" dir="${dir}" /> | |||
<fileset id="fs" dir="${input}" /> | |||
</length> | |||
<length string="${length.each}" property="length.length.each" /> | |||
<length string="${foo}${bar}........${line.separator}" | |||
@@ -60,7 +55,7 @@ | |||
<target name="testEachCondition" depends="setUp"> | |||
<length mode="each" property="length.each"> | |||
<fileset id="fs" dir="${dir}" /> | |||
<fileset id="fs" dir="${input}" /> | |||
</length> | |||
<length string="${foo}${bar}........${line.separator}" | |||
property="length.expected" /> | |||
@@ -126,7 +121,7 @@ | |||
<target name="testDupes" depends="setUp"> | |||
<length property="length.foo" file="${dir.a}/foo"> | |||
<fileset dir="${dir}" /> | |||
<fileset dir="${input}" /> | |||
</length> | |||
<au:assertTrue> | |||
<equals arg1="9" arg2="${length.foo}" /> | |||
@@ -136,7 +131,7 @@ | |||
<target name="testDupesCondition" depends="setUp"> | |||
<au:assertTrue> | |||
<length length="9" file="${dir.a}/foo"> | |||
<fileset dir="${dir}" /> | |||
<fileset dir="${input}" /> | |||
</length> | |||
</au:assertTrue> | |||
</target> | |||
@@ -1,20 +1,20 @@ | |||
<?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. | |||
--> | |||
<?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 default="antunit" xmlns:au="antlib:org.apache.ant.antunit"> | |||
<import file="../antunit-base.xml" /> | |||
@@ -20,11 +20,7 @@ | |||
<import file="../antunit-base.xml" /> | |||
<property name="file" location="test.mf"/> | |||
<target name="tearDown"> | |||
<delete file="${file}"/> | |||
</target> | |||
<property name="file" location="${output}test.mf"/> | |||
<target name="test8IsAllowed" | |||
description="https://issues.apache.org/bugzilla/show_bug.cgi?id=45675" | |||
@@ -15,22 +15,20 @@ | |||
See the License for the specific language governing permissions and | |||
limitations under the License. | |||
--> | |||
<project default="antunit" xmlns:au="antlib:org.apache.ant.antunit"> | |||
<import file="../antunit-base.xml" /> | |||
<target name="test-move-caseonly"> | |||
<!-- this test is inspired by bugzilla 41948 --> | |||
<!-- Especially interesting if executed on case-insensitive file systems --> | |||
<touch file="${java.io.tmpdir}/abc"/> | |||
<move file="${java.io.tmpdir}/abc" tofile="${java.io.tmpdir}/aBc"/> | |||
<fileset dir="${java.io.tmpdir}" id="myfs"> | |||
<include name="aBc"/> | |||
</fileset> | |||
<pathconvert refid="myfs" property="myproperty" setonempty="false"/> | |||
<au:assertPropertySet name="myproperty" message="abc was not renamed aBc"/> | |||
</target> | |||
<target name="tearDown"> | |||
<delete file="${java.io.tmpdir}/aBc"/> | |||
</target> | |||
</project> | |||
<project default="antunit" xmlns:au="antlib:org.apache.ant.antunit"> | |||
<import file="../antunit-base.xml" /> | |||
<target name="test-move-caseonly"> | |||
<!-- this test is inspired by bugzilla 41948 --> | |||
<!-- Especially interesting if executed on case-insensitive file systems --> | |||
<mkdir dir="${output}"/> | |||
<touch file="${output}/abc"/> | |||
<move file="${output}/abc" tofile="${output}/aBc"/> | |||
<fileset dir="${output}" id="myfs"> | |||
<include name="aBc"/> | |||
</fileset> | |||
<pathconvert refid="myfs" property="myproperty" setonempty="false"/> | |||
<au:assertPropertySet name="myproperty" message="abc was not renamed aBc"/> | |||
</target> | |||
</project> |
@@ -18,18 +18,10 @@ | |||
<project default="antunit" xmlns:au="antlib:org.apache.ant.antunit"> | |||
<import file="../../../antunit-base.xml" /> | |||
<property name="input" location="in"/> | |||
<property name="output" location="out"/> | |||
<path id="junit"> | |||
<fileset dir="../../../../../../lib/optional" includes="junit*"/> | |||
</path> | |||
<target name="tearDown"> | |||
<delete dir="${input}"/> | |||
<delete dir="${output}"/> | |||
</target> | |||
<macrodef name="empty-test"> | |||
<attribute name="classname"/> | |||
<sequential> | |||
@@ -25,9 +25,6 @@ | |||
additions on Java6+. | |||
</description> | |||
<target name="tearDown"> | |||
</target> | |||
<condition property="prereqs-ok"> | |||
<or> | |||
<available classname="org.apache.bsf.BSFManager"/> | |||
@@ -19,8 +19,6 @@ | |||
default="antunit" xmlns:au="antlib:org.apache.ant.antunit"> | |||
<import file="../../../antunit-base.xml"/> | |||
<property name="build.dir" location="build" /> | |||
<target name="setUp"> | |||
<condition property="isUnix"> | |||
<os family="unix" /> | |||
@@ -29,42 +27,38 @@ | |||
<target name="os"> | |||
<mkdir dir="${build.dir}" /> | |||
<mkdir dir="${output}" /> | |||
<condition property="unix"> | |||
<os family="unix" /> | |||
</condition> | |||
<property name="file_ref" | |||
location="${build.dir}/file"/> | |||
location="${output}/file"/> | |||
<property name="hanging_ref" | |||
location="${build.dir}/hanging_ref"/> | |||
location="${output}/hanging_ref"/> | |||
</target> | |||
<target name="init" depends="os" if="unix"> | |||
<touch file="${file_ref}" /> | |||
</target> | |||
<target name="tearDown"> | |||
<delete dir="${build.dir}" /> | |||
</target> | |||
<target name="testCreateDouble" depends="init" if="unix"> | |||
<symlink overwrite="true" link="${build.dir}/link" | |||
<symlink overwrite="true" link="${output}/link" | |||
resource="${file_ref}"/> | |||
<symlink overwrite="true" link="${build.dir}/link" | |||
<symlink overwrite="true" link="${output}/link" | |||
resource="${file_ref}"/> | |||
</target> | |||
<target name="testCreateDoubleHanging" depends="init" if="unix"> | |||
<symlink overwrite="true" link="${build.dir}/link2" | |||
<symlink overwrite="true" link="${output}/link2" | |||
resource="${hanging_ref}"/> | |||
<symlink overwrite="true" link="${build.dir}/link2" | |||
<symlink overwrite="true" link="${output}/link2" | |||
resource="${hanging_ref}"/> | |||
</target> | |||
<target name="testCreateOverFile" depends="init" if="unix"> | |||
<touch file="${build.dir}/link3" /> | |||
<symlink overwrite="true" link="${build.dir}/link3" | |||
<touch file="${output}/link3" /> | |||
<symlink overwrite="true" link="${output}/link3" | |||
resource="${file_ref}"/> | |||
</target> | |||
@@ -1,4 +1,4 @@ | |||
<?xml version="1.0" encoding="utf-8"?> | |||
<?xml version="1.0" encoding="utf-8"?> | |||
<!-- | |||
Licensed to the Apache Software Foundation (ASF) under one or more | |||
contributor license agreements. See the NOTICE file distributed with | |||
@@ -15,29 +15,29 @@ | |||
See the License for the specific language governing permissions and | |||
limitations under the License. | |||
--> | |||
<project name="retry-test" default="antunit" xmlns:au="antlib:org.apache.ant.antunit"> | |||
<import file="../antunit-base.xml"/> | |||
<target name="test-fail-and-retry"> | |||
<property name="i" value="3"/> | |||
<property name="dest" value="${java.io.tmpdir}/dest"/> | |||
<!-- just in case this ever becomes a legit url... --> | |||
<property name="src" value="http://iojasodjojaosdj"/> | |||
<au:expectfailure expectedmessage="Task [get] failed after [${i}] attempts; giving up"> | |||
<retry retrycount="${i}"> | |||
<get src="${src}" dest="${dest}"/> | |||
</retry> | |||
</au:expectfailure> | |||
<au:assertLogContains text="Attempt [1]: error occurred; retrying..."/> | |||
</target> | |||
<target name="test-success"> | |||
<property name="i" value="3"/> | |||
<property name="dest" value="${java.io.tmpdir}/dest"/> | |||
<retry retrycount="${i}"> | |||
<touch file="${dest}"/> | |||
</retry> | |||
<au:assertLogDoesntContain text="Attempt [1]: error occurred; retrying..."/> | |||
</target> | |||
</project> | |||
<project name="retry-test" default="antunit" xmlns:au="antlib:org.apache.ant.antunit"> | |||
<import file="../antunit-base.xml"/> | |||
<target name="test-fail-and-retry"> | |||
<property name="i" value="3"/> | |||
<property name="dest" value="${java.io.tmpdir}/dest"/> | |||
<!-- just in case this ever becomes a legit url... --> | |||
<property name="src" value="http://iojasodjojaosdj"/> | |||
<au:expectfailure expectedmessage="Task [get] failed after [${i}] attempts; giving up"> | |||
<retry retrycount="${i}"> | |||
<get src="${src}" dest="${dest}"/> | |||
</retry> | |||
</au:expectfailure> | |||
<au:assertLogContains text="Attempt [1]: error occurred; retrying..."/> | |||
</target> | |||
<target name="test-success"> | |||
<property name="i" value="3"/> | |||
<property name="dest" value="${java.io.tmpdir}/dest"/> | |||
<retry retrycount="${i}"> | |||
<touch file="${dest}"/> | |||
</retry> | |||
<au:assertLogDoesntContain text="Attempt [1]: error occurred; retrying..."/> | |||
</target> | |||
</project> |
@@ -22,11 +22,6 @@ | |||
</description> | |||
<import file="../antunit-base.xml" /> | |||
<target name="tearDown"> | |||
<delete file="binaryAppendDest" /> | |||
<delete file="encodeStringDest" /> | |||
</target> | |||
<target name="assertProperties"> | |||
<au:assertPropertySet name="ant.version" /> | |||
<au:assertPropertySet name="java.home" /> | |||
@@ -20,35 +20,27 @@ | |||
xmlns:au="antlib:org.apache.ant.antunit"> | |||
<import file="../antunit-base.xml" /> | |||
<property name="dest.dir" location="unzip.dest"/> | |||
<target name="setUp"> | |||
<mkdir dir="${dest.dir}" /> | |||
</target> | |||
<target name="tearDown"> | |||
<delete dir="${dest.dir}"/> | |||
<mkdir dir="${output}" /> | |||
</target> | |||
<target name="testFailureOnBrokenCentralDirectoryStructure"> | |||
<au:expectfailure | |||
expectedmessage="central directory is empty, can't expand corrupt archive."> | |||
<unzip src="broken_cd.zip" dest="${dest.dir}"/> | |||
<unzip src="broken_cd.zip" dest="${output}"/> | |||
</au:expectfailure> | |||
</target> | |||
<!-- Issue 28911 --> | |||
<target name="testStrippingOfPathsep"> | |||
<property name="in" location="${dest.dir}/input"/> | |||
<property name="out" location="${dest.dir}/out"/> | |||
<mkdir dir="${in}"/> | |||
<mkdir dir="${out}"/> | |||
<touch file="${in}/file"/> | |||
<zip destfile="${dest.dir}/a.zip"> | |||
<zipfileset dir="${dest.dir}/input" prefix="/foo"/> | |||
<mkdir dir="${input}"/> | |||
<mkdir dir="${output}"/> | |||
<touch file="${input}/file"/> | |||
<zip destfile="${output}/a.zip"> | |||
<zipfileset dir="${input}" prefix="/foo"/> | |||
</zip> | |||
<unzip src="${dest.dir}/a.zip" stripAbsolutePathSpec="true" | |||
dest="${out}"/> | |||
<au:assertFileExists file="${out}/foo/file"/> | |||
<unzip src="${output}/a.zip" stripAbsolutePathSpec="true" | |||
dest="${output}"/> | |||
<au:assertFileExists file="${output}/foo/file"/> | |||
</target> | |||
</project> |
@@ -18,15 +18,11 @@ | |||
<project default="antunit" xmlns:au="antlib:org.apache.ant.antunit"> | |||
<import file="../antunit-base.xml" /> | |||
<property name="ant-build" location="../../../../build"/> | |||
<property name="build-dir" | |||
location="${ant-build}/ant-unit/whichresource/build"/> | |||
<target name="init"> | |||
<delete quiet="yes" dir="${build-dir}"/> | |||
<mkdir dir="${build-dir}"/> | |||
<javac srcdir="javac-dir/good-src" destdir="${build-dir}"/> | |||
<path id="whichresource-build" path="${build-dir}"/> | |||
<delete quiet="yes" dir="${output}"/> | |||
<mkdir dir="${output}"/> | |||
<javac srcdir="javac-dir/good-src" destdir="${output}"/> | |||
<path id="whichresource-build" path="${output}"/> | |||
</target> | |||
<target name="test-reference" depends="init"> | |||
@@ -22,7 +22,8 @@ | |||
<property name="br" value="${line.separator}" /> | |||
<target name="testRecursionRegression"> | |||
<copy todir="${basedir}"> | |||
<mkdir dir="${output}"/> | |||
<copy todir="${output}"> | |||
<string value="@a@${br}@b@${br}@c@${br}@d@${br}" /> | |||
<mergemapper to="filterset-output.txt" /> | |||
<filterset> | |||
@@ -33,15 +34,11 @@ | |||
</filterset> | |||
</copy> | |||
<loadfile property="afterfiltering" srcFile="filterset-output.txt"/> | |||
<loadfile property="afterfiltering" srcFile="${output}/filterset-output.txt"/> | |||
<au:assertEquals | |||
expected="aaa${br}bbb${br}aaa:bbb${br}aaa:bbb:aaa:bbb${br}" | |||
actual="${afterfiltering}"/> | |||
</target> | |||
<target name="tearDown"> | |||
<delete file="filterset-output.txt" /> | |||
</target> | |||
</project> |
@@ -22,30 +22,22 @@ | |||
<import file="../antunit-base.xml" /> | |||
<dirname property="glob-test.dir" | |||
file="${ant.file.glob-test}"/> | |||
<target name="tearDown"> | |||
<delete dir="${glob-test.dir}/src"/> | |||
<delete dir="${glob-test.dir}/dst"/> | |||
</target> | |||
<target name="test-move"> | |||
<property | |||
name="glob-test-out-dir" | |||
location="${glob-test.dir}/../../../../../build/antunit/glob-test"/> | |||
<echo>${glob-test-out-dir}</echo> | |||
<!-- the following should work --> | |||
<delete dir="${glob-test.dir}/src"/> | |||
<delete dir="${glob-test.dir}/dst"/> | |||
<mkdir dir="${glob-test.dir}/src"/> | |||
<mkdir dir="${glob-test.dir}/dst"/> | |||
<touch file="${glob-test.dir}/src/foobar-1.2.3.jar"/> | |||
<touch file="${glob-test.dir}/src/foobar-janfu-1.2.3.jar"/> | |||
<touch file="${glob-test.dir}/src/foobar--1.2.3.jar"/> | |||
<touch file="${glob-test.dir}/src/foobar-x-1.2.3.jar"/> | |||
<move todir="${glob-test.dir}/dst"> | |||
<fileset dir="${glob-test.dir}/src"> | |||
<delete dir="${input}"/> | |||
<delete dir="${output}"/> | |||
<mkdir dir="${input}"/> | |||
<mkdir dir="${output}"/> | |||
<touch file="${input}/foobar-1.2.3.jar"/> | |||
<touch file="${input}/foobar-janfu-1.2.3.jar"/> | |||
<touch file="${input}/foobar--1.2.3.jar"/> | |||
<touch file="${input}/foobar-x-1.2.3.jar"/> | |||
<move todir="${output}"> | |||
<fileset dir="${input}"> | |||
<include name="**/*.jar"/> | |||
</fileset> | |||
<mapper type="glob" from="foobar-*-1.2.3.jar" to="*.jar"/> | |||
@@ -18,22 +18,20 @@ | |||
<project xmlns:au="antlib:org.apache.ant.antunit" default="antunit"> | |||
<import file="../antunit-base.xml"/> | |||
<property name="test-build-dir" | |||
location="../../../../build/ant-unit/modified-selector"/> | |||
<target name="test-one-file"> | |||
<delete dir="${test-build-dir}"/> | |||
<mkdir dir="${test-build-dir}"/> | |||
<copy todir="${test-build-dir}" overwrite="yes"> | |||
<delete dir="${output}"/> | |||
<mkdir dir="${output}"/> | |||
<copy todir="${output}" overwrite="yes"> | |||
<fileset dir="." includes="modified-selector-test.xml"> | |||
<modified update="true"> | |||
<param name="cache.cachefile" value="${test-build-dir}/cc.properties"/> | |||
<param name="cache.cachefile" value="${output}/cc.properties"/> | |||
</modified> | |||
</fileset> | |||
</copy> | |||
<au:assertTrue> | |||
<available file="${test-build-dir}/cc.properties"/> | |||
<available file="${output}/cc.properties"/> | |||
</au:assertTrue> | |||
</target> | |||
</project> |
@@ -15,28 +15,28 @@ | |||
See the License for the specific language governing permissions and | |||
limitations under the License. | |||
--> | |||
<project xmlns:au="antlib:org.apache.ant.antunit" default="antunit"> | |||
<import file="../antunit-base.xml" /> | |||
<property name="existingFile" value="${basedir}/build.xml" /> | |||
<files id="files"> | |||
<include name="${existingFile}" /> | |||
</files> | |||
<target name="test-directUse" description="Bug 42397 - works fine"> | |||
<path id="path"> | |||
<files> | |||
<include name="${existingFile}" /> | |||
</files> | |||
</path> | |||
</target> | |||
<target name="test-refid" description="Bug 42397"> | |||
<path id="path"> | |||
<files refid="files" /> | |||
</path> | |||
</target> | |||
</project> | |||
<project xmlns:au="antlib:org.apache.ant.antunit" default="antunit"> | |||
<import file="../antunit-base.xml" /> | |||
<property name="existingFile" value="${basedir}/build.xml" /> | |||
<files id="files"> | |||
<include name="${existingFile}" /> | |||
</files> | |||
<target name="test-directUse" description="Bug 42397 - works fine"> | |||
<path id="path"> | |||
<files> | |||
<include name="${existingFile}" /> | |||
</files> | |||
</path> | |||
</target> | |||
<target name="test-refid" description="Bug 42397"> | |||
<path id="path"> | |||
<files refid="files" /> | |||
</path> | |||
</target> | |||
</project> |
@@ -24,12 +24,6 @@ | |||
<property name="br" value="${line.separator}" /> | |||
<property name="world" value="World" /> | |||
<property name="out.dir" location="tempdir"/> | |||
<target name="tearDown"> | |||
<delete dir="${out.dir}" quiet="true"/> | |||
</target> | |||
<target name="testCountEquals1"> | |||
<au:assertTrue> | |||
<resourcecount count="1"> | |||
@@ -74,15 +68,15 @@ | |||
</target> | |||
<target name="testEncoding"> | |||
<mkdir dir="${out.dir}"/> | |||
<copy file="utf-16.in" toDir="${out.dir}" encoding="utf-16"> | |||
<mkdir dir="${output}"/> | |||
<copy file="utf-16.in" toDir="${output}" encoding="utf-16"> | |||
<filterchain> | |||
<fixcrlf/> | |||
</filterchain> | |||
</copy> | |||
<au:assertTrue> | |||
<resourcesmatch astext="true"> | |||
<file file="${out.dir}/utf-16.in" /> | |||
<file file="${output}/utf-16.in" /> | |||
<concat outputEncoding="utf-16">foo${br}bar${br}baz${br}</concat> | |||
<concat outputEncoding="utf-16" fixlastline="true"> | |||
<string value="foo" /> | |||
@@ -20,23 +20,18 @@ | |||
<import file="../../../antunit-base.xml" /> | |||
<property name="dir" location="testdir"/> | |||
<property name="file" value="testfile"/> | |||
<target name="createTestdir"> | |||
<mkdir dir="${dir}"/> | |||
<touch file="${dir}/${file}"/> | |||
</target> | |||
<target name="tearDown"> | |||
<delete dir="${dir}"/> | |||
<mkdir dir="${output}"/> | |||
<touch file="${output}/${file}"/> | |||
</target> | |||
<target name="testPattern" depends="createTestdir"> | |||
<au:assertTrue> | |||
<resourcecount when="equal" count="1"> | |||
<restrict> | |||
<fileset dir="${dir}"/> | |||
<fileset dir="${output}"/> | |||
<rsel:name name="*"/> | |||
</restrict> | |||
</resourcecount> | |||
@@ -44,7 +39,7 @@ | |||
<au:assertTrue> | |||
<resourcecount when="equal" count="0"> | |||
<restrict> | |||
<fileset dir="${dir}"/> | |||
<fileset dir="${output}"/> | |||
<rsel:name name=".*"/> | |||
</restrict> | |||
</resourcecount> | |||
@@ -55,7 +50,7 @@ | |||
<au:assertTrue> | |||
<resourcecount when="equal" count="1"> | |||
<restrict> | |||
<fileset dir="${dir}"/> | |||
<fileset dir="${output}"/> | |||
<rsel:name regex=".*"/> | |||
</restrict> | |||
</resourcecount> | |||
@@ -28,19 +28,15 @@ | |||
</condition> | |||
<target name="createTestdir"> | |||
<mkdir dir="${dir}"/> | |||
<touch file="${dir}/${file}"/> | |||
</target> | |||
<target name="tearDown"> | |||
<delete dir="${dir}"/> | |||
<mkdir dir="${output}"/> | |||
<touch file="${output}/${file}"/> | |||
</target> | |||
<target name="testReadable" depends="createTestdir"> | |||
<au:assertTrue> | |||
<resourcecount when="equal" count="1"> | |||
<restrict> | |||
<fileset dir="${dir}"/> | |||
<fileset dir="${output}"/> | |||
<rsel:readable/> | |||
</restrict> | |||
</resourcecount> | |||
@@ -48,7 +44,7 @@ | |||
<au:assertTrue> | |||
<resourcecount when="equal" count="0"> | |||
<restrict> | |||
<fileset dir="${dir}" excludes="${file}"/> | |||
<fileset dir="${output}" excludes="${file}"/> | |||
<rsel:readable/> | |||
</restrict> | |||
</resourcecount> | |||
@@ -59,7 +55,7 @@ | |||
<au:assertTrue> | |||
<resourcecount when="equal" count="1"> | |||
<restrict> | |||
<fileset dir="${dir}"/> | |||
<fileset dir="${output}"/> | |||
<rsel:writable/> | |||
</restrict> | |||
</resourcecount> | |||
@@ -67,7 +63,7 @@ | |||
<au:assertTrue> | |||
<resourcecount when="equal" count="0"> | |||
<restrict> | |||
<fileset dir="${dir}" excludes="${file}"/> | |||
<fileset dir="${output}" excludes="${file}"/> | |||
<rsel:writable/> | |||
</restrict> | |||
</resourcecount> | |||
@@ -77,17 +73,17 @@ | |||
<target name="makeFileUnwritable" | |||
depends="createTestdir,makeFileUnwritable-Unix,makeFileUnwritable-Windows"/> | |||
<target name="makeFileUnwritable-Unix" id="unix"> | |||
<chmod file="${dir}/${file}" perm="444"/> | |||
<chmod file="${output}/${file}" perm="444"/> | |||
</target> | |||
<target name="makeFileUnwritable-Windows" unless="unix"> | |||
<attrib file="${dir}/${file}" readonly="true"/> | |||
<attrib file="${output}/${file}" readonly="true"/> | |||
</target> | |||
<target name="testUnwritable" depends="makeFileUnwritable"> | |||
<au:assertTrue> | |||
<resourcecount when="equal" count="0"> | |||
<restrict> | |||
<fileset dir="${dir}"/> | |||
<fileset dir="${output}"/> | |||
<rsel:writable/> | |||
</restrict> | |||
</resourcecount> | |||
@@ -96,12 +92,12 @@ | |||
<target name="testAsConditions" depends="makeFileUnwritable"> | |||
<au:assertTrue> | |||
<isfileselected file="${dir}/${file}"> | |||
<isfileselected file="${output}/${file}"> | |||
<rsel:readable/> | |||
</isfileselected> | |||
</au:assertTrue> | |||
<au:assertFalse> | |||
<isfileselected file="${dir}/${file}"> | |||
<isfileselected file="${output}/${file}"> | |||
<rsel:writable/> | |||
</isfileselected> | |||
</au:assertFalse> | |||
@@ -19,36 +19,31 @@ | |||
<import file="../../antunit-base.xml" /> | |||
<property name="dir" location="testdir"/> | |||
<property name="file" value="testfile"/> | |||
<target name="createTestdir"> | |||
<mkdir dir="${dir}"/> | |||
<touch file="${dir}/${file}"/> | |||
</target> | |||
<target name="tearDown"> | |||
<delete dir="${dir}"/> | |||
<mkdir dir="${output}"/> | |||
<touch file="${output}/${file}"/> | |||
</target> | |||
<target name="testPattern" depends="createTestdir"> | |||
<au:assertTrue> | |||
<resourcecount when="equal" count="1"> | |||
<fileset dir="${dir}"> | |||
<fileset dir="${output}"> | |||
<filename name="*"/> | |||
</fileset> | |||
</resourcecount> | |||
</au:assertTrue> | |||
<au:assertTrue> | |||
<resourcecount when="equal" count="0"> | |||
<fileset dir="${dir}"> | |||
<fileset dir="${output}"> | |||
<filename name="*" negate="true"/> | |||
</fileset> | |||
</resourcecount> | |||
</au:assertTrue> | |||
<au:assertTrue> | |||
<resourcecount when="equal" count="0"> | |||
<fileset dir="${dir}"> | |||
<fileset dir="${output}"> | |||
<filename name=".*"/> | |||
</fileset> | |||
</resourcecount> | |||
@@ -58,14 +53,14 @@ | |||
<target name="testRegex" depends="createTestdir"> | |||
<au:assertTrue> | |||
<resourcecount when="equal" count="1"> | |||
<fileset dir="${dir}"> | |||
<fileset dir="${output}"> | |||
<filename regex=".*"/> | |||
</fileset> | |||
</resourcecount> | |||
</au:assertTrue> | |||
<au:assertTrue> | |||
<resourcecount when="equal" count="0"> | |||
<fileset dir="${dir}"> | |||
<fileset dir="${output}"> | |||
<filename regex=".*" negate="true"/> | |||
</fileset> | |||
</resourcecount> | |||
@@ -19,7 +19,6 @@ | |||
<import file="../../antunit-base.xml" /> | |||
<property name="dir" location="testdir"/> | |||
<property name="file" value="testfile"/> | |||
<condition property="unix"> | |||
@@ -27,25 +26,21 @@ | |||
</condition> | |||
<target name="createTestdir"> | |||
<mkdir dir="${dir}"/> | |||
<touch file="${dir}/${file}"/> | |||
</target> | |||
<target name="tearDown"> | |||
<delete dir="${dir}"/> | |||
<mkdir dir="${output}"/> | |||
<touch file="${output}/${file}"/> | |||
</target> | |||
<target name="testReadable" depends="createTestdir"> | |||
<au:assertTrue> | |||
<resourcecount when="equal" count="1"> | |||
<fileset dir="${dir}"> | |||
<fileset dir="${output}"> | |||
<readable/> | |||
</fileset> | |||
</resourcecount> | |||
</au:assertTrue> | |||
<au:assertTrue> | |||
<resourcecount when="equal" count="0"> | |||
<fileset dir="${dir}" excludes="${file}"> | |||
<fileset dir="${output}" excludes="${file}"> | |||
<readable/> | |||
</fileset> | |||
</resourcecount> | |||
@@ -55,14 +50,14 @@ | |||
<target name="testWritable" depends="createTestdir"> | |||
<au:assertTrue> | |||
<resourcecount when="equal" count="1"> | |||
<fileset dir="${dir}"> | |||
<fileset dir="${output}"> | |||
<writable/> | |||
</fileset> | |||
</resourcecount> | |||
</au:assertTrue> | |||
<au:assertTrue> | |||
<resourcecount when="equal" count="0"> | |||
<fileset dir="${dir}" excludes="${file}"> | |||
<fileset dir="${output}" excludes="${file}"> | |||
<writable/> | |||
</fileset> | |||
</resourcecount> | |||
@@ -72,16 +67,16 @@ | |||
<target name="makeFileUnwritable" | |||
depends="createTestdir,makeFileUnwritable-Unix,makeFileUnwritable-Windows"/> | |||
<target name="makeFileUnwritable-Unix" id="unix"> | |||
<chmod file="${dir}/${file}" perm="444"/> | |||
<chmod file="${output}/${file}" perm="444"/> | |||
</target> | |||
<target name="makeFileUnwritable-Windows" unless="unix"> | |||
<attrib file="${dir}/${file}" readonly="true"/> | |||
<attrib file="${output}/${file}" readonly="true"/> | |||
</target> | |||
<target name="testUnwritable" depends="makeFileUnwritable"> | |||
<au:assertTrue> | |||
<resourcecount when="equal" count="0"> | |||
<fileset dir="${dir}"> | |||
<fileset dir="${output}"> | |||
<writable/> | |||
</fileset> | |||
</resourcecount> | |||
@@ -90,12 +85,12 @@ | |||
<target name="testAsConditions" depends="makeFileUnwritable"> | |||
<au:assertTrue> | |||
<isfileselected file="${dir}/${file}"> | |||
<isfileselected file="${output}/${file}"> | |||
<readable/> | |||
</isfileselected> | |||
</au:assertTrue> | |||
<au:assertFalse> | |||
<isfileselected file="${dir}/${file}"> | |||
<isfileselected file="${output}/${file}"> | |||
<writable/> | |||
</isfileselected> | |||
</au:assertFalse> | |||