You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ant.apache.org by jh...@apache.org on 2006/12/20 15:21:26 UTC
svn commit: r489097 - in /ant/core/trunk/src/tests:
antunit/taskdefs/jar-spi-test.xml antunit/types/conditions/matches-test.xml
antunit/types/resources/selectors/test.xml
junit/org/apache/tools/ant/taskdefs/optional/EchoPropertiesTest.java
Author: jhm
Date: Wed Dec 20 06:21:25 2006
New Revision: 489097
URL: http://svn.apache.org/viewvc?view=rev&rev=489097
Log:
Make the tests runnable on systems without regexp matchers (e.g. JDK 1.2 without ORO).
Modified:
ant/core/trunk/src/tests/antunit/taskdefs/jar-spi-test.xml
ant/core/trunk/src/tests/antunit/types/conditions/matches-test.xml
ant/core/trunk/src/tests/antunit/types/resources/selectors/test.xml
ant/core/trunk/src/tests/junit/org/apache/tools/ant/taskdefs/optional/EchoPropertiesTest.java
Modified: ant/core/trunk/src/tests/antunit/taskdefs/jar-spi-test.xml
URL: http://svn.apache.org/viewvc/ant/core/trunk/src/tests/antunit/taskdefs/jar-spi-test.xml?view=diff&rev=489097&r1=489096&r2=489097
==============================================================================
--- ant/core/trunk/src/tests/antunit/taskdefs/jar-spi-test.xml (original)
+++ ant/core/trunk/src/tests/antunit/taskdefs/jar-spi-test.xml Wed Dec 20 06:21:25 2006
@@ -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}"/>
Modified: ant/core/trunk/src/tests/antunit/types/conditions/matches-test.xml
URL: http://svn.apache.org/viewvc/ant/core/trunk/src/tests/antunit/types/conditions/matches-test.xml?view=diff&rev=489097&r1=489096&r2=489097
==============================================================================
--- ant/core/trunk/src/tests/antunit/types/conditions/matches-test.xml (original)
+++ ant/core/trunk/src/tests/antunit/types/conditions/matches-test.xml Wed Dec 20 06:21:25 2006
@@ -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"/>
Modified: ant/core/trunk/src/tests/antunit/types/resources/selectors/test.xml
URL: http://svn.apache.org/viewvc/ant/core/trunk/src/tests/antunit/types/resources/selectors/test.xml?view=diff&rev=489097&r1=489096&r2=489097
==============================================================================
--- ant/core/trunk/src/tests/antunit/types/resources/selectors/test.xml (original)
+++ ant/core/trunk/src/tests/antunit/types/resources/selectors/test.xml Wed Dec 20 06:21:25 2006
@@ -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>
Modified: ant/core/trunk/src/tests/junit/org/apache/tools/ant/taskdefs/optional/EchoPropertiesTest.java
URL: http://svn.apache.org/viewvc/ant/core/trunk/src/tests/junit/org/apache/tools/ant/taskdefs/optional/EchoPropertiesTest.java?view=diff&rev=489097&r1=489096&r2=489097
==============================================================================
--- ant/core/trunk/src/tests/junit/org/apache/tools/ant/taskdefs/optional/EchoPropertiesTest.java (original)
+++ ant/core/trunk/src/tests/junit/org/apache/tools/ant/taskdefs/optional/EchoPropertiesTest.java Wed Dec 20 06:21:25 2006
@@ -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 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=");
}
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@ant.apache.org
For additional commands, e-mail: dev-help@ant.apache.org