Browse Source

Demonstrate bug 18414

git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@274332 13f79535-47bb-0310-9956-ffa450edef68
master
Stefan Bodewig 22 years ago
parent
commit
2b6e7767df
2 changed files with 42 additions and 0 deletions
  1. +22
    -0
      src/etc/testcases/taskdefs/copy.xml
  2. +20
    -0
      src/testcases/org/apache/tools/ant/taskdefs/CopyTest.java

+ 22
- 0
src/etc/testcases/taskdefs/copy.xml View File

@@ -67,6 +67,28 @@
encoding="ISO8859_1" outputencoding="UTF8"/>
</target>

<target name="testMissingFileIgnore">
<copy file="not-there" tofile="copytest1.tmp"
failonerror="false"/>
</target>

<target name="testMissingFileBail">
<copy file="not-there" tofile="copytest1.tmp"
failonerror="true"/>
</target>

<target name="testMissingDirIgnore">
<copy todir="copytest1dir" failonerror="false">
<fileset dir="not-there"/>
</copy>
</target>

<target name="testMissingDirBail">
<copy todir="copytest1dir" failonerror="false">
<fileset dir="not-there"/>
</copy>
</target>

<target name="cleanup">
<delete file="copytest1.tmp"/>
<delete file="copytest3.tmp"/>


+ 20
- 0
src/testcases/org/apache/tools/ant/taskdefs/CopyTest.java View File

@@ -158,4 +158,24 @@ public class CopyTest extends BuildFileTest {
File f2 = getProject().resolveFile("copytest1.tmp");
assertTrue(fileUtils.contentEquals(f1, f2));
}

public void testMissingFileIgnore() {
expectLogContaining("testMissingFileIgnore",
"Warning: Could not find file ");
}

public void testMissingFileBail() {
expectBuildException("testMissingFileBail", "not-there doesn't exist");
assertTrue(getBuildException().getMessage()
.startsWith("Warning: Could not find file "));
}

public void testMissingDirIgnore() {
expectLogContaining("testMissingDirIgnore", "Warning: ");
}

public void testMissingDirBail() {
expectBuildException("testMissingDirBail", "not-there doesn't exist");
assertTrue(getBuildException().getMessage().endsWith(" not found."));
}
}

Loading…
Cancel
Save