mbenson 2005/01/06 16:36:04
Modified: src/etc/testcases/taskdefs length.xml
src/testcases/org/apache/tools/ant/taskdefs LengthTest.java
Log:
Remove order assumption from testEach.
Revision Changes Path
1.2 +14 -6 ant/src/etc/testcases/taskdefs/length.xml
Index: length.xml
===================================================================
RCS file: /home/cvs/ant/src/etc/testcases/taskdefs/length.xml,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- length.xml 4 Jan 2005 22:20:44 -0000 1.1
+++ length.xml 7 Jan 2005 00:36:04 -0000 1.2
@@ -6,21 +6,29 @@
<target name="init">
<mkdir dir="${dir.a}" />
<mkdir dir="${dir.b}" />
- <concat destfile="${dir.a}/foo">foo</concat>
- <concat destfile="${dir.b}/bar">bar</concat>
+ <property name="foo" location="${dir.a}/foo" />
+ <property name="bar" location="${dir.b}/bar" />
+ <echo file="${foo}" message="foo" />
+ <echo file="${bar}" message="bar" />
</target>
<target name="testEach" depends="init">
<length mode="each" property="length.each">
<fileset id="fs" dir="${dir}" />
</length>
- <pathconvert property="expected" refid="fs" pathsep="${line.separator}">
- <globmapper from="*" to="* : 3" />
- </pathconvert>
+ <length string="${length.each}" property="length.length.each" />
+ <length string="${foo}${bar}........${line.separator}"
+ property="length.expected" />
<fail>
+ <!-- test that both files are represented, and that the
+ output is the expected length; do not assume order. -->
<condition>
<not>
- <equals arg1="${expected}" arg2="${length.each}" />
+ <and>
+ <contains string="${length.each}" substring="${foo} : 3" />
+ <contains string="${length.each}" substring="${bar} : 3" />
+ <equals arg1="${length.length.each}" arg2="${length.expected}" />
+ </and>
</not>
</condition>
</fail>
1.3 +1 -3 ant/src/testcases/org/apache/tools/ant/taskdefs/LengthTest.java
Index: LengthTest.java
===================================================================
RCS file: /home/cvs/ant/src/testcases/org/apache/tools/ant/taskdefs/LengthTest.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- LengthTest.java 6 Jan 2005 15:20:10 -0000 1.2
+++ LengthTest.java 7 Jan 2005 00:36:04 -0000 1.3
@@ -34,9 +34,7 @@
}
public void testEach() {
- // Disable this test as the order of files in a fileset is
- // not specified
- // executeTarget("testEach");
+ executeTarget("testEach");
}
public void testAll() {
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@ant.apache.org
For additional commands, e-mail: dev-help@ant.apache.org
|