Author: bodewig
Date: Mon Aug 31 04:24:33 2009
New Revision: 809458
URL: http://svn.apache.org/viewvc?rev=809458&view=rev
Log:
Merge core gzip's JUnit tests as AntUnit tests (and fix a few bugs on the way)
Modified:
ant/sandbox/antlibs/compress/trunk/src/main/org/apache/ant/compress/taskdefs/PackBase.java
ant/sandbox/antlibs/compress/trunk/src/tests/antunit/gzip-test.xml
Modified:
ant/sandbox/antlibs/compress/trunk/src/main/org/apache/ant/compress/taskdefs/PackBase.java
URL:
http://svn.apache.org/viewvc/ant/sandbox/antlibs/compress/trunk/src/main/org/apache/ant/compress/taskdefs/PackBase.java?rev=809458&r1=809457&r2=809458&view=diff
==============================================================================
---
ant/sandbox/antlibs/compress/trunk/src/main/org/apache/ant/compress/taskdefs/PackBase.java
(original)
+++
ant/sandbox/antlibs/compress/trunk/src/main/org/apache/ant/compress/taskdefs/PackBase.java
Mon Aug 31 04:24:33 2009
@@ -91,7 +91,7 @@
* @param src resource to expand
*/
public void setSrc(Resource src) {
- if (this.dest != null) {
+ if (this.src != null) {
throw new BuildException("Can only have one source resource.");
}
if (src.isDirectory()) {
@@ -148,7 +148,7 @@
public void execute() throws BuildException {
validate();
- if (dest.isExists() && dest.getLastModified() < src.getLastModified())
{
+ if (dest.isExists() && dest.getLastModified() > src.getLastModified())
{
log("Nothing to do: " + dest.getName() + " is up to date.");
} else {
log("Building: " + dest.getName());
Modified: ant/sandbox/antlibs/compress/trunk/src/tests/antunit/gzip-test.xml
URL:
http://svn.apache.org/viewvc/ant/sandbox/antlibs/compress/trunk/src/tests/antunit/gzip-test.xml?rev=809458&r1=809457&r2=809458&view=diff
==============================================================================
--- ant/sandbox/antlibs/compress/trunk/src/tests/antunit/gzip-test.xml
(original)
+++ ant/sandbox/antlibs/compress/trunk/src/tests/antunit/gzip-test.xml Mon Aug
31 04:24:33 2009
@@ -28,7 +28,7 @@
<touch file="${output}/filetwo" />
</target>
- <target name="testFailNone">
+ <target name="testFailNone" depends="setUp">
<au:expectfailure expectedmessage="source resource is required.">
<cmp:gzip destfile="${output}/file.gz">
<fileset dir="${output}/empty" />
@@ -36,7 +36,7 @@
</au:expectfailure>
</target>
- <target name="testFailTwo">
+ <target name="testFailTwo" depends="setUp">
<au:expectfailure expectedmessage="Can only have one source resource.">
<cmp:gzip destfile="${output}/file.gz">
<fileset dir="${output}" />
@@ -44,7 +44,7 @@
</au:expectfailure>
</target>
- <target name="testFailNoDest">
+ <target name="testFailNoDest" depends="setUp">
<au:expectfailure expectedmessage="dest resource is required.">
<cmp:gzip src="${output}/fileone">
<dest>
@@ -54,7 +54,7 @@
</au:expectfailure>
</target>
- <target name="testFailTwoDests">
+ <target name="testFailTwoDests" depends="setUp">
<au:expectfailure expectedmessage="Can only have one destination
resource.">
<cmp:gzip src="${output}/fileone">
<dest>
@@ -64,4 +64,25 @@
</au:expectfailure>
</target>
+ <target name="testRealTest" depends="setUp">
+ <cmp:gzip src="../resources/asf-logo.gif"
+ destfile="${output}/asf-logo.gif.gz" />
+ <au:assertLogContains text="Building: asf-logo.gif.gz"/>
+ <au:assertFileExists file="${output}/asf-logo.gif.gz"/>
+ </target>
+
+ <target name="testRealTestWithResource" depends="setUp">
+ <cmp:gzip destfile="${output}/asf-logo.gif.gz">
+ <file file="../resources/asf-logo.gif"/>
+ </cmp:gzip>
+ <au:assertLogContains text="Building: asf-logo.gif.gz"/>
+ <au:assertFileExists file="${output}/asf-logo.gif.gz"/>
+ </target>
+
+ <target name="testDateCheck" depends="setUp">
+ <touch file="${output}/asf-logo.gif.gz"/>
+ <cmp:gzip src="../resources/asf-logo.gif"
+ destfile="${output}/asf-logo.gif.gz" />
+ <au:assertLogContains text="Nothing to do: asf-logo.gif.gz is up to
date."/>
+ </target>
</project>