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-ffa450edef68master
@@ -38,12 +38,19 @@ | |||||
--> | --> | ||||
</target> | </target> | ||||
<target name="test_single_file_fileset"> | |||||
<copy tofile="copytest_single_file_fileset.tmp"> | |||||
<fileset dir="." includes="copy.xml"/> | |||||
</copy> | |||||
</target> | |||||
<target name="cleanup"> | <target name="cleanup"> | ||||
<delete file="copytest1.tmp"/> | <delete file="copytest1.tmp"/> | ||||
<delete file="copytest3.tmp"/> | <delete file="copytest3.tmp"/> | ||||
<delete file="copytest3a.tmp"/> | <delete file="copytest3a.tmp"/> | ||||
<delete file="copytest3b.tmp"/> | <delete file="copytest3b.tmp"/> | ||||
<delete file="copytest3c.tmp"/> | <delete file="copytest3c.tmp"/> | ||||
<delete file="copytest_single_file_fileset.tmp"/> | |||||
<delete dir="copytest1dir"/> | <delete dir="copytest1dir"/> | ||||
</target> | </target> | ||||
@@ -326,7 +326,7 @@ public class Copy extends Task { | |||||
if (srcFiles.length > 0) { | if (srcFiles.length > 0) { | ||||
if (file == null) { | if (file == null) { | ||||
file = new File(srcFiles[0]); | |||||
file = new File(ds.getBasedir(), srcFiles[0]); | |||||
filesets.removeElementAt(0); | filesets.removeElementAt(0); | ||||
} else { | } else { | ||||
throw new BuildException( | throw new BuildException( | ||||
@@ -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()); | |||||
} | |||||
} | } |