Browse Source

Fix single-file fileset functionality. Did this ever work (,Peter)?

XP-style: added test case to detect bug, then fixed it. Also, trying to break out of the mould of the "testN" test case names - too brittle and non-descriptive.


git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@271143 13f79535-47bb-0310-9956-ffa450edef68
master
Erik Hatcher 23 years ago
parent
commit
a7f0867fda
3 changed files with 15 additions and 1 deletions
  1. +7
    -0
      src/etc/testcases/taskdefs/copy.xml
  2. +1
    -1
      src/main/org/apache/tools/ant/taskdefs/Copy.java
  3. +7
    -0
      src/testcases/org/apache/tools/ant/taskdefs/CopyTest.java

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

@@ -38,12 +38,19 @@
-->
</target>
<target name="test_single_file_fileset">
<copy tofile="copytest_single_file_fileset.tmp">
<fileset dir="." includes="copy.xml"/>
</copy>
</target>
<target name="cleanup">
<delete file="copytest1.tmp"/>
<delete file="copytest3.tmp"/>
<delete file="copytest3a.tmp"/>
<delete file="copytest3b.tmp"/>
<delete file="copytest3c.tmp"/>
<delete file="copytest_single_file_fileset.tmp"/>
<delete dir="copytest1dir"/>
</target>



+ 1
- 1
src/main/org/apache/tools/ant/taskdefs/Copy.java View File

@@ -326,7 +326,7 @@ public class Copy extends Task {

if (srcFiles.length > 0) {
if (file == null) {
file = new File(srcFiles[0]);
file = new File(ds.getBasedir(), srcFiles[0]);
filesets.removeElementAt(0);
} else {
throw new BuildException(


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

@@ -122,4 +122,11 @@ public class CopyTest extends BuildFileTest {
}

}
public void testSingleFileFileset() {
executeTarget("test_single_file_fileset");
File file = new File(getProjectDir(),
"copytest_single_file_fileset.tmp");
assertTrue(file.exists());
}
}

Loading…
Cancel
Save