Browse Source

Remove order assumption from testEach.

git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@277307 13f79535-47bb-0310-9956-ffa450edef68
master
Matthew Jason Benson 20 years ago
parent
commit
5451feff7d
2 changed files with 15 additions and 9 deletions
  1. +14
    -6
      src/etc/testcases/taskdefs/length.xml
  2. +1
    -3
      src/testcases/org/apache/tools/ant/taskdefs/LengthTest.java

+ 14
- 6
src/etc/testcases/taskdefs/length.xml View File

@@ -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
src/testcases/org/apache/tools/ant/taskdefs/LengthTest.java View File

@@ -34,9 +34,7 @@ public class LengthTest extends BuildFileTest {
}

public void testEach() {
// Disable this test as the order of files in a fileset is
// not specified
// executeTarget("testEach");
executeTarget("testEach");
}

public void testAll() {


Loading…
Cancel
Save