git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@540043 13f79535-47bb-0310-9956-ffa450edef68master
| @@ -15,7 +15,7 @@ | |||
| </target> | |||
| <target name="setUp"> | |||
| <mkdir dir="${classes.dir}"/> | |||
| <mkdir dir="${classes.dir}"/> | |||
| <javac srcdir="src" destdir="${classes.dir}" debug="yes"/> | |||
| <taskdef name="echo-location" classname="task.EchoLocation" | |||
| classpath="${classes.dir}"/> | |||
| @@ -46,7 +46,7 @@ | |||
| </target> | |||
| <target name="tearDown"> | |||
| <delete dir="${working.dir}"/> | |||
| <delete dir="${working.dir}"/> | |||
| </target> | |||
| <target name="test-plain-task"> | |||
| @@ -74,4 +74,4 @@ | |||
| <au:assertLogContains text="Line: "/> | |||
| </target> | |||
| </project> | |||
| </project> | |||
| @@ -1,11 +1,11 @@ | |||
| <?xml version="1.0"?> | |||
| <project name="delete-test" basedir="." default="antunit" | |||
| xmlns:au="antlib:org.apache.ant.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" /> | |||
| <target name="init"> | |||
| @@ -24,15 +24,15 @@ | |||
| <fileset dir="${nonexistent.dir}"/> | |||
| </delete> | |||
| <au:assertFileExists file="${existing.dir}" /> | |||
| <au:assertFileExists file="${existing.dir}" /> | |||
| <delete quiet="true" includeEmptyDirs="true"> | |||
| <fileset dir="${existing.dir}"/> | |||
| </delete> | |||
| <au:assertFileDoesntExist file="${existing.dir}" /> | |||
| <au:assertFileDoesntExist file="${existing.dir}" /> | |||
| <mkdir dir="${existing.dir}"/> | |||
| <delete quiet="true" includeEmptyDirs="true"> | |||
| @@ -41,7 +41,7 @@ | |||
| </delete> | |||
| <au:assertFileDoesntExist file="${existing.dir}" /> | |||
| <au:assertFileDoesntExist file="${existing.dir}" /> | |||
| <mkdir dir="${existing.dir}"/> | |||
| @@ -51,7 +51,7 @@ | |||
| </delete> | |||
| <au:assertFileDoesntExist file="${existing.dir}" /> | |||
| <au:assertFileDoesntExist file="${existing.dir}" /> | |||
| </target> | |||
| @@ -4,40 +4,40 @@ | |||
| <import file="../antunit-base.xml"/> | |||
| <target name="test1"> | |||
| <au:expectfailure expectedmessage="property attribute required"> | |||
| <au:expectfailure expectedmessage="property attribute required"> | |||
| <dirname/> | |||
| </au:expectfailure> | |||
| </au:expectfailure> | |||
| </target> | |||
| <target name="test2"> | |||
| <au:expectfailure expectedmessage="file attribute required"> | |||
| <dirname property="propname"/> | |||
| </au:expectfailure> | |||
| <au:expectfailure expectedmessage="file attribute required"> | |||
| <dirname property="propname"/> | |||
| </au:expectfailure> | |||
| </target> | |||
| <target name="test3"> | |||
| <au:expectfailure expectedmessage="property attribute required"> | |||
| <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> | |||
| <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${file.separator}foo.txt"/> | |||
| <dirname property="local.dir" file="/usr/local/foo.txt"/> | |||
| <au:assertPropertyEquals name="local.dir" | |||
| value="${file.separator}usr${file.separator}local${file.separator}foo.txt"/> | |||
| </target> | |||
| <target name="test5"> | |||
| <dirname property="base.dir" file="foo.txt"/> | |||
| <au:assertPropertyEquals name="base.dir" value="${basedir}"/> | |||
| <au:assertPropertyEquals name="base.dir" value="${basedir}"/> | |||
| </target> | |||
| </project> | |||
| </project> | |||
| @@ -3,47 +3,47 @@ | |||
| <!-- note relies on antunit built from svn trunk (1.1-alpha) --> | |||
| <import file="../antunit-base.xml"/> | |||
| <target name="setUp"> | |||
| <property name="file" location="${java.io.tmpdir}/echoed.xml"/> | |||
| <echoxml file="${file}"> | |||
| <project> | |||
| <property name="foo" value="bar" /> | |||
| <fail message="$$$${foo}=$${foo}"> | |||
| <condition> | |||
| <istrue value="${mustfail}" /> | |||
| </condition> | |||
| </fail> | |||
| </project> | |||
| </echoxml> | |||
| <property name="file" location="${java.io.tmpdir}/echoed.xml"/> | |||
| <echoxml file="${file}"> | |||
| <project> | |||
| <property name="foo" value="bar" /> | |||
| <fail message="$$$${foo}=$${foo}"> | |||
| <condition> | |||
| <istrue value="${mustfail}" /> | |||
| </condition> | |||
| </fail> | |||
| </project> | |||
| </echoxml> | |||
| </target> | |||
| <target name="tearDown"> | |||
| <delete file="${file}"/> | |||
| </target> | |||
| </target> | |||
| <target name="testPass"> | |||
| <ant antfile="${file}"/> | |||
| <ant antfile="${file}"/> | |||
| </target> | |||
| <target name="testFail"> | |||
| <au:expectfailure expectedmessage="${foo}=bar" message="Should have thrown an exception"> | |||
| <au:expectfailure expectedmessage="${foo}=bar" message="Should have thrown an exception"> | |||
| <ant antfile="${file}"> | |||
| <property name="mustfail" value="true" /> | |||
| </ant> | |||
| </au:expectfailure> | |||
| </au:expectfailure> | |||
| </target> | |||
| <target name="testEmpty"> | |||
| <au:expectfailure expectedmessage="No nested XML specified" message="Should have thrown an exception"> | |||
| <au:expectfailure expectedmessage="No nested XML specified" message="Should have thrown an exception"> | |||
| <echoxml /> | |||
| </au:expectfailure> | |||
| </au:expectfailure> | |||
| </target> | |||
| <target name="test-ns"> <!-- comment this if you don't have the svn trunk of antunit --> | |||
| <echoxml file="${file}" xmlns:a="antlib:a"> | |||
| <a:something /> | |||
| </echoxml> | |||
| <au:assertResourceContains resource="${file}" value="a:something"/> | |||
| <echoxml file="${file}" xmlns:a="antlib:a"> | |||
| <a:something /> | |||
| </echoxml> | |||
| <au:assertResourceContains resource="${file}" value="a:something"/> | |||
| </target> | |||
| </project> | |||
| </project> | |||
| @@ -3,7 +3,7 @@ | |||
| <target name="test-move-caseonly"> | |||
| <!-- this test is inspired by bugzilla 41948 --> | |||
| <!-- Especially intresting if executed on case-insensitive file systems --> | |||
| <!-- Especially intresting 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"> | |||
| @@ -16,4 +16,4 @@ | |||
| <target name="tearDown"> | |||
| <delete file="${java.io.tmpdir}/aBc"/> | |||
| </target> | |||
| </project> | |||
| </project> | |||
| @@ -1,26 +1,27 @@ | |||
| <?xml version="1.0" encoding="utf-8"?> | |||
| <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 occured, retrying..."/> | |||
| <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 occured, 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 occured, retrying..."/> | |||
| <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 occured, retrying..."/> | |||
| </target> | |||
| </project> | |||
| </project> | |||
| @@ -57,5 +57,4 @@ | |||
| </au:antunit> | |||
| </target> | |||
| </project> | |||