git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@271727 13f79535-47bb-0310-9956-ffa450edef68master
| @@ -61,6 +61,31 @@ | |||||
| <echo>${testEvalProps}</echo> | <echo>${testEvalProps}</echo> | ||||
| </target> | </target> | ||||
| <target name="testFilterChain" | |||||
| depends="init"> | |||||
| <echo file="loadfile1.tmp">#Line 1 | |||||
| REM Line 2 | |||||
| --Line 3 | |||||
| Line 4 | |||||
| Hello World!</echo> | |||||
| <loadfile srcFile="loadfile1.tmp" | |||||
| property="testFilterChain"> | |||||
| <filterchain> | |||||
| <headfilter lines="5"/> | |||||
| <striplinecomments> | |||||
| <comment value="--"/> | |||||
| <comment value="REM "/> | |||||
| <comment value="#"/> | |||||
| </striplinecomments> | |||||
| <filterreader classname="org.apache.tools.ant.filters.TailFilter"> | |||||
| <param name="lines" value="1"/> | |||||
| </filterreader> | |||||
| <linecontains> | |||||
| <contains value="World!"/> | |||||
| </linecontains> | |||||
| </filterchain> | |||||
| </loadfile> | |||||
| </target> | |||||
| <target name="testOneLine" | <target name="testOneLine" | ||||
| depends="init"> | depends="init"> | ||||
| @@ -151,7 +151,7 @@ public class LoadFileTest extends BuildFileTest { | |||||
| } | } | ||||
| } | } | ||||
| /** | |||||
| /** | |||||
| * A unit test for JUnit | * A unit test for JUnit | ||||
| */ | */ | ||||
| public void testEvalProps() | public void testEvalProps() | ||||
| @@ -162,7 +162,19 @@ public class LoadFileTest extends BuildFileTest { | |||||
| } | } | ||||
| } | } | ||||
| /** | |||||
| /** | |||||
| * A unit test for JUnit | |||||
| */ | |||||
| public void testFilterChain() | |||||
| throws BuildException { | |||||
| executeTarget("testFilterChain"); | |||||
| if(project.getProperty("testFilterChain").indexOf("World!")<0) { | |||||
| fail("Filter Chain broken"); | |||||
| } | |||||
| } | |||||
| /** | |||||
| * A unit test for JUnit | * A unit test for JUnit | ||||
| */ | */ | ||||
| public void testOneLine() | public void testOneLine() | ||||
| @@ -171,5 +183,3 @@ public class LoadFileTest extends BuildFileTest { | |||||
| } | } | ||||
| } | } | ||||