Browse Source

make whenempty-related tests antunit-esque in preparation for their new friend

git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@437799 13f79535-47bb-0310-9956-ffa450edef68
master
Matthew Jason Benson 19 years ago
parent
commit
12de66bc12
2 changed files with 36 additions and 7 deletions
  1. +36
    -1
      src/etc/testcases/taskdefs/zip.xml
  2. +0
    -6
      src/testcases/org/apache/tools/ant/taskdefs/ZipTest.java

+ 36
- 1
src/etc/testcases/taskdefs/zip.xml View File

@@ -126,17 +126,52 @@
<target name="testEmptySkip"> <target name="testEmptySkip">
<mkdir dir="ziptest"/> <mkdir dir="ziptest"/>
<zip destfile="test3.zip" basedir="ziptest" whenempty="skip"/> <zip destfile="test3.zip" basedir="ziptest" whenempty="skip"/>
<fail message="archive should get skipped">
<condition>
<available file="test3.zip" />
</condition>
</fail>
</target> </target>


<!-- Bugzilla Report 30365 --> <!-- Bugzilla Report 30365 -->
<target name="zipEmptyDir"> <target name="zipEmptyDir">
<mkdir dir="empty/empty2"/> <mkdir dir="empty/empty2"/>
<zip destfile="test3.zip" basedir="empty" update="true"/>
<zip destfile="test3.zip" basedir="empty" update="true"/>
<fail message="single-directory archive should be created">
<condition>
<or>
<not>
<available file="test3.zip" />
</not>
<resourcecount when="gt" count="0">
<zipfileset src="test3.zip" />
</resourcecount>
<resourcecount when="ne" count="1">
<restrict>
<exists xmlns="antlib:org.apache.tools.ant.types.resources.selectors" />
<zipentry zipfile="test3.zip" name="empty2/" />
</restrict>
</resourcecount>
</or>
</condition>
</fail>
</target> </target>


<target name="zipEmptyCreate"> <target name="zipEmptyCreate">
<mkdir dir="empty"/> <mkdir dir="empty"/>
<zip destfile="test3.zip" basedir="empty" whenempty="create" includes="*.xyz"/> <zip destfile="test3.zip" basedir="empty" whenempty="create" includes="*.xyz"/>
<fail message="empty archive should be created">
<condition>
<or>
<not>
<available file="test3.zip" />
</not>
<resourcecount when="gt" count="0">
<zipfileset src="test3.zip" />
</resourcecount>
</or>
</condition>
</fail>
</target> </target>


<target name="testCompressionLevel" depends="test6"> <target name="testCompressionLevel" depends="test6">


+ 0
- 6
src/testcases/org/apache/tools/ant/taskdefs/ZipTest.java View File

@@ -132,19 +132,13 @@ public class ZipTest extends BuildFileTest {
// Bugzilla Report 22865 // Bugzilla Report 22865
public void testEmptySkip() { public void testEmptySkip() {
executeTarget("testEmptySkip"); executeTarget("testEmptySkip");
assertTrue("archive should get skipped",
!getProject().resolveFile("test3.zip").exists());
} }
// Bugzilla Report 30365 // Bugzilla Report 30365
public void testZipEmptyDir() { public void testZipEmptyDir() {
executeTarget("zipEmptyDir"); executeTarget("zipEmptyDir");
assertTrue("archive should be created",
getProject().resolveFile("test3.zip").exists());
} }
public void testZipEmptyCreate() { public void testZipEmptyCreate() {
expectLogContaining("zipEmptyCreate", "Note: creating empty"); expectLogContaining("zipEmptyCreate", "Note: creating empty");
assertTrue("archive should be created",
getProject().resolveFile("test3.zip").exists());
} }
// Bugzilla Report 25513 // Bugzilla Report 25513
public void testCompressionLevel() { public void testCompressionLevel() {


Loading…
Cancel
Save