Author: mbenson
Date: Thu May 10 15:30:36 2007
New Revision: 537021

URL: http://svn.apache.org/viewvc?view=rev&rev=537021
Log:
striplinecomments comment nested text value

Added:
    ant/core/trunk/src/tests/antunit/filters/
    ant/core/trunk/src/tests/antunit/filters/striplinecomments-test.xml   (with 
props)
Modified:
    ant/core/trunk/WHATSNEW
    ant/core/trunk/src/main/org/apache/tools/ant/filters/StripLineComments.java

Modified: ant/core/trunk/WHATSNEW
URL: 
http://svn.apache.org/viewvc/ant/core/trunk/WHATSNEW?view=diff&rev=537021&r1=537020&r2=537021
==============================================================================
--- ant/core/trunk/WHATSNEW (original)
+++ ant/core/trunk/WHATSNEW Thu May 10 15:30:36 2007
@@ -128,6 +128,10 @@
 
 * <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
 ===================================

Modified: 
ant/core/trunk/src/main/org/apache/tools/ant/filters/StripLineComments.java
URL: 
http://svn.apache.org/viewvc/ant/core/trunk/src/main/org/apache/tools/ant/filters/StripLineComments.java?view=diff&rev=537021&r1=537020&r2=537021
==============================================================================
--- ant/core/trunk/src/main/org/apache/tools/ant/filters/StripLineComments.java 
(original)
+++ ant/core/trunk/src/main/org/apache/tools/ant/filters/StripLineComments.java 
Thu May 10 15:30:36 2007
@@ -219,5 +219,15 @@
         public final String getValue() {
             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);
+        }
     }
 }

Added: ant/core/trunk/src/tests/antunit/filters/striplinecomments-test.xml
URL: 
http://svn.apache.org/viewvc/ant/core/trunk/src/tests/antunit/filters/striplinecomments-test.xml?view=auto&rev=537021
==============================================================================
--- ant/core/trunk/src/tests/antunit/filters/striplinecomments-test.xml (added)
+++ ant/core/trunk/src/tests/antunit/filters/striplinecomments-test.xml Thu May 
10 15:30:36 2007
@@ -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>

Propchange: ant/core/trunk/src/tests/antunit/filters/striplinecomments-test.xml
------------------------------------------------------------------------------
    svn:eol-style = native



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to