git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@489097 13f79535-47bb-0310-9956-ffa450edef68master
@@ -3,6 +3,15 @@ | |||
<property name="jar.dir" location="jar_spi_dir"/> | |||
<property name="jar.src.dir" location="jar_spi_dir/src"/> | |||
<property name="jar.src.file" location="jar_spi_dir/src/a_file"/> | |||
<available property="jdk1.4+" classname="java.lang.CharSequence"/> | |||
<condition property="some.regexp.support"> | |||
<or> | |||
<isset property="jdk1.4+"/> | |||
<isset property="apache.regexp.present"/> | |||
<isset property="apache.oro.present"/> | |||
</or> | |||
</condition> | |||
<target name="init"> | |||
<mkdir dir="${jar.src.dir}"/> | |||
@@ -12,7 +21,7 @@ | |||
<delete quiet="yes" dir="${jar.dir}/output"/> | |||
</target> | |||
<target name="test-simple" depends="init"> | |||
<target name="test-simple" depends="init" if="some.regexp.support"> | |||
<jar jarfile="${jar.dir}/file.jar"> | |||
<fileset dir="${jar.src.dir}"/> | |||
@@ -32,7 +41,7 @@ | |||
</target> | |||
<target name="test-providers" depends="init"> | |||
<target name="test-providers" depends="init" if="some.regexp.support"> | |||
<jar jarfile="${jar.dir}/file.jar"> | |||
<fileset dir="${jar.src.dir}"/> | |||
@@ -54,7 +63,7 @@ | |||
</target> | |||
<target name="test-multi" depends="init"> | |||
<target name="test-multi" depends="init" if="some.regexp.support"> | |||
<jar jarfile="${jar.dir}/file.jar"> | |||
<fileset dir="${jar.src.dir}"/> | |||
@@ -3,7 +3,16 @@ | |||
<property name="NL" value=" "/> | |||
<regexp id="myid" pattern="^[a-z]{3,4}$"/> | |||
<target name="test-refid"> | |||
<available property="jdk1.4+" classname="java.lang.CharSequence"/> | |||
<condition property="some.regexp.support"> | |||
<or> | |||
<isset property="jdk1.4+"/> | |||
<isset property="apache.regexp.present"/> | |||
<isset property="apache.oro.present"/> | |||
</or> | |||
</condition> | |||
<target name="test-refid" if="some.regexp.support"> | |||
<au:assertTrue> | |||
<matches string="abc"> | |||
<regexp refid="myid"/> | |||
@@ -11,19 +20,19 @@ | |||
</au:assertTrue> | |||
</target> | |||
<target name="test-simple"> | |||
<target name="test-simple" if="some.regexp.support"> | |||
<au:assertTrue> | |||
<matches string="abc" pattern="^[a-z]{3,4}$"/> | |||
</au:assertTrue> | |||
</target> | |||
<target name="test-nomatch"> | |||
<target name="test-nomatch" if="some.regexp.support"> | |||
<au:assertFalse> | |||
<matches string="abc" pattern="^b.*" /> | |||
</au:assertFalse> | |||
</target> | |||
<target name="test-date"> | |||
<target name="test-date" if="some.regexp.support"> | |||
<tstamp> | |||
<format property="today" pattern="dd-MM-yyyy" locale="en"/> | |||
</tstamp> | |||
@@ -34,7 +43,7 @@ | |||
</au:assertTrue> | |||
</target> | |||
<target name="test-abc"> | |||
<target name="test-abc" if="some.regexp.support"> | |||
<au:assertTrue> | |||
<matches string="abc" pattern="ab?"/> | |||
</au:assertTrue> | |||
@@ -55,13 +64,13 @@ | |||
</au:assertFalse> | |||
</target> | |||
<target name="test-caseinsensitive"> | |||
<target name="test-caseinsensitive" if="some.regexp.support"> | |||
<au:assertTrue> | |||
<matches string="ABC" pattern="ab?" casesensitive="false"/> | |||
</au:assertTrue> | |||
</target> | |||
<target name="test-singleline"> | |||
<target name="test-singleline" if="some.regexp.support"> | |||
<au:assertTrue> | |||
<matches string="AB${line.separator}C" pattern="^ab.*C$" | |||
casesensitive="false" | |||
@@ -74,7 +83,7 @@ | |||
</au:assertFalse> | |||
</target> | |||
<target name="test-multiline"> | |||
<target name="test-multiline" if="some.regexp.support"> | |||
<au:assertTrue> | |||
<matches string="AB${NL}C" pattern="^C$" | |||
multiline="true"/> | |||
@@ -2,6 +2,15 @@ | |||
xmlns:rsel="antlib:org.apache.tools.ant.types.resources.selectors" | |||
xmlns:rcmp="antlib:org.apache.tools.ant.types.resources.comparators"> | |||
<available property="jdk1.4+" classname="java.lang.CharSequence"/> | |||
<condition property="some.regexp.support"> | |||
<or> | |||
<isset property="jdk1.4+"/> | |||
<isset property="apache.regexp.present"/> | |||
<isset property="apache.oro.present"/> | |||
</or> | |||
</condition> | |||
<target name="testname1"> | |||
<au:assertTrue> | |||
<resourcecount when="equal" count="2"> | |||
@@ -343,7 +352,7 @@ | |||
</au:assertTrue> | |||
</target> | |||
<target name="testcontainsregexp"> | |||
<target name="testcontainsregexp" if="some.regexp.support"> | |||
<au:assertTrue> | |||
<resourcecount when="equal" count="2"> | |||
<restrict> | |||
@@ -19,6 +19,7 @@ | |||
package org.apache.tools.ant.taskdefs.optional; | |||
import org.apache.tools.ant.BuildFileTest; | |||
import org.apache.tools.ant.util.regexp.RegexpMatcherFactory; | |||
import java.io.IOException; | |||
import java.io.File; | |||
@@ -172,6 +173,10 @@ public class EchoPropertiesTest extends BuildFileTest { | |||
} | |||
public void testWithRegex() throws Exception { | |||
if (!RegexpMatcherFactory.regexpMatcherPresent(project)) { | |||
System.out.println("Test 'testWithRegex' skipped because no regexp matcher is present."); | |||
return; | |||
} | |||
executeTarget("testWithRegex"); | |||
assertDebuglogContaining("ant.home="); | |||
} | |||