Browse Source

massive refactorings to Concat: fix failing testcases in HEAD, and implement ResourceCollection

git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@536579 13f79535-47bb-0310-9956-ffa450edef68
master
Matthew Jason Benson 18 years ago
parent
commit
b941f2ef44
5 changed files with 777 additions and 637 deletions
  1. +2
    -0
      WHATSNEW
  2. +671
    -637
      src/main/org/apache/tools/ant/taskdefs/Concat.java
  3. +14
    -0
      src/tests/antunit/taskdefs/concat-test.xml
  4. BIN
      src/tests/antunit/taskdefs/utf-16.expected
  5. +90
    -0
      src/tests/antunit/types/resources/concat-resource-test.xml

+ 2
- 0
WHATSNEW View File

@@ -118,6 +118,8 @@ Other changes:
* <scriptdef> now sources scripts from nested resources/resource collections. This lets you * <scriptdef> now sources scripts from nested resources/resource collections. This lets you
define scripts in JARs, remote URLs, or any other supported resource. Bugzilla report 41597. define scripts in JARs, remote URLs, or any other supported resource. Bugzilla report 41597.


* <concat> is now usable as a single-element ResourceCollection.



Changes from Ant 1.6.5 to Ant 1.7.0 Changes from Ant 1.6.5 to Ant 1.7.0
=================================== ===================================


+ 671
- 637
src/main/org/apache/tools/ant/taskdefs/Concat.java
File diff suppressed because it is too large
View File


+ 14
- 0
src/tests/antunit/taskdefs/concat-test.xml View File

@@ -1,6 +1,7 @@
<project xmlns:au="antlib:org.apache.ant.antunit"> <project xmlns:au="antlib:org.apache.ant.antunit">
<target name="tearDown"> <target name="tearDown">
<delete file="binaryAppendDest" /> <delete file="binaryAppendDest" />
<delete file="encodeStringDest" />
</target> </target>


<target name="testBinaryAppend"> <target name="testBinaryAppend">
@@ -21,4 +22,17 @@
<length file="binaryAppendDest" length="2" /> <length file="binaryAppendDest" length="2" />
</au:assertTrue> </au:assertTrue>
</target> </target>

<target name="testStringEncoding">
<property name="br" value="${line.separator}" />
<concat destfile="encodeStringDest"
outputEncoding="utf-16">foo${br}bar${br}baz${br}</concat>
<au:assertTrue>
<resourcesmatch astext="true">
<file file="utf-16.expected" />
<file file="encodeStringDest" />
</resourcesmatch>
</au:assertTrue>
</target>

</project> </project>

BIN
src/tests/antunit/taskdefs/utf-16.expected View File


+ 90
- 0
src/tests/antunit/types/resources/concat-resource-test.xml View File

@@ -0,0 +1,90 @@
<?xml version="1.0"?>

<project name="test-concat" basedir="." default="antunit"
xmlns:au="antlib:org.apache.ant.antunit">

<import file="../../antunit-base.xml" />

<property name="br" value="${line.separator}" />
<property name="world" value="World" />

<target name="testCountEquals1">
<au:assertTrue>
<resourcecount count="1">
<concat>Hello, ${world}!</concat>
</resourcecount>
</au:assertTrue>
</target>

<target name="testReplacement">
<au:assertTrue>
<resourcesmatch>
<string>Hello, ${world}!</string>
<concat>Hello, ${world}!</concat>
</resourcesmatch>
</au:assertTrue>
</target>

<target name="testResources">
<au:assertTrue>
<resourcesmatch>
<string>foobarbaz</string>
<concat>
<string value="foo" />
<string value="bar" />
<string value="baz" />
</concat>
</resourcesmatch>
</au:assertTrue>
</target>

<target name="testFixLastLineResources">
<au:assertTrue>
<resourcesmatch>
<string>foo${line.separator}bar${line.separator}baz${line.separator}</string>
<concat fixlastline="true">
<string value="foo" />
<string value="bar" />
<string value="baz" />
</concat>
</resourcesmatch>
</au:assertTrue>
</target>

<target name="testEncoding">
<au:assertTrue>
<resourcesmatch astext="true">
<file file="utf-16.in" />
<concat outputEncoding="utf-16">foo${br}bar${br}baz${br}</concat>
<concat outputEncoding="utf-16" fixlastline="true">
<string value="foo" />
<string value="bar" />
<string value="baz" />
</concat>
</resourcesmatch>
</au:assertTrue>
</target>

<target name="testFiltering">
<au:assertTrue>
<resourcesmatch>
<concat>foo${br}bar${br}baz${br}</concat>
<concat>
foo
#comment 1
bar
#comment 2
baz
#comment 3
<filterchain>
<striplinecomments>
<comment value="#" />
</striplinecomments>
<ignoreblank />
</filterchain>
</concat>
</resourcesmatch>
</au:assertTrue>
</target>

</project>

Loading…
Cancel
Save