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