git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@537021 13f79535-47bb-0310-9956-ffa450edef68master
@@ -128,6 +128,10 @@ Other changes: | |||||
* <concat> is now usable as a single-element ResourceCollection. | * <concat> is now usable as a single-element ResourceCollection. | ||||
* It is now possible to provide the value of a <striplinecomments> filter's | |||||
<comment> nested element as nested text instead of using the 'value' | |||||
attribute. | |||||
Changes from Ant 1.6.5 to Ant 1.7.0 | Changes from Ant 1.6.5 to Ant 1.7.0 | ||||
=================================== | =================================== | ||||
@@ -219,5 +219,15 @@ public final class StripLineComments | |||||
public final String getValue() { | public final String getValue() { | ||||
return value; | return value; | ||||
} | } | ||||
/** | |||||
* Alt. syntax to set the prefix for this type of line comment. | |||||
* | |||||
* @param comment The prefix for a line comment of this type. | |||||
* Must not be <code>null</code>. | |||||
*/ | |||||
public void addText(String comment) { | |||||
setValue(comment); | |||||
} | |||||
} | } | ||||
} | } |
@@ -0,0 +1,58 @@ | |||||
<project default="antunit" xmlns:au="antlib:org.apache.ant.antunit"> | |||||
<import file="../antunit-base.xml" /> | |||||
<property name="br" value="${line.separator}" /> | |||||
<string id="input">foo | |||||
#pound | |||||
bar | |||||
//java sl | |||||
baz | |||||
REMark | |||||
</string> | |||||
<macrodef name="test"> | |||||
<attribute name="lines" /> | |||||
<element name="comments" implicit="true" /> | |||||
<sequential> | |||||
<au:assertTrue> | |||||
<resourcecount count="@{lines}"> | |||||
<tokens> | |||||
<concat> | |||||
<resource refid="input" /> | |||||
<filterchain> | |||||
<striplinecomments> | |||||
<comments /> | |||||
</striplinecomments> | |||||
<ignoreblank /> | |||||
</filterchain> | |||||
</concat> | |||||
</tokens> | |||||
</resourcecount> | |||||
</au:assertTrue> | |||||
</sequential> | |||||
</macrodef> | |||||
<target name="testBasic"> | |||||
<test lines="5"> | |||||
<comment value="#" /> | |||||
</test> | |||||
</target> | |||||
<target name="testMultiple"> | |||||
<test lines="3"> | |||||
<comment value="#" /> | |||||
<comment value="//" /> | |||||
<comment value="REM" /> | |||||
</test> | |||||
</target> | |||||
<target name="testNestedText"> | |||||
<test lines="3"> | |||||
<comment>#</comment> | |||||
<comment>//</comment> | |||||
<comment>REM</comment> | |||||
</test> | |||||
</target> | |||||
</project> |