Author: peterreilly
Date: Mon Sep 25 14:33:59 2006
New Revision: 449821

URL: http://svn.apache.org/viewvc?view=rev&rev=449821
Log:
tests for matches

Added:
    ant/core/trunk/src/tests/antunit/types/conditions/
    ant/core/trunk/src/tests/antunit/types/conditions/matches-test.xml

Added: 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=auto&rev=449821
==============================================================================
--- ant/core/trunk/src/tests/antunit/types/conditions/matches-test.xml (added)
+++ ant/core/trunk/src/tests/antunit/types/conditions/matches-test.xml Mon Sep 
25 14:33:59 2006
@@ -0,0 +1,79 @@
+<project xmlns:au="antlib:org.apache.ant.antunit">

+  <!-- NB: ant's interface to JDK14 regex enables UNIX_LINES -->

+  <property name="NL" value="&#10;"/>

+  <regexp id="myid" pattern="^[a-z]{3,4}$"/>

+

+  <target name="test-refid">

+    <au:assertTrue>

+      <matches string="abc">

+        <regexp refid="myid"/>

+      </matches>

+    </au:assertTrue>

+  </target>

+

+  <target name="test-simple">

+    <au:assertTrue>

+      <matches string="abc" pattern="^[a-z]{3,4}$"/>

+    </au:assertTrue>

+  </target>

+

+  <target name="test-nomatch">

+    <au:assertFalse>

+      <matches string="abc" pattern="^b.*" />

+    </au:assertFalse>

+  </target>

+

+  <target name="test-date">

+    <tstamp>

+      <format property="today" pattern="dd-MM-yyyy" locale="en"/>

+    </tstamp>

+    <au:assertTrue>

+      <matches string="${today}">

+        <regexp pattern="^[0123]\d-[01]\d-[12]\d\d\d$" />

+      </matches>

+    </au:assertTrue>

+  </target>

+

+  <target name="test-abc">

+    <au:assertTrue>

+      <matches string="abc" pattern="ab?"/>

+    </au:assertTrue>

+    <au:assertTrue>

+      <matches string="ab" pattern="ab?"/>

+    </au:assertTrue>

+    <au:assertFalse>

+      <matches string="acb" pattern="ab?"/>

+    </au:assertFalse>

+  </target>

+

+  <target name="test-caseinsensitive">

+    <au:assertTrue>

+      <matches string="ABC" pattern="ab?" casesensitive="false"/>

+    </au:assertTrue>

+  </target>

+

+  <target name="test-singleline">

+    <au:assertTrue>

+      <matches string="AB${line.separator}C" pattern="^ab.*C$"

+               casesensitive="false"

+               singleline="true"/>

+    </au:assertTrue>

+    <au:assertFalse>

+      <matches string="AB${line.separator}C" pattern="^ab.*C$"

+               casesensitive="false"

+               singleline="false"/>

+    </au:assertFalse>

+  </target>

+

+  <target name="test-multiline">

+    <au:assertTrue>

+      <matches string="AB${NL}C" pattern="^C$"

+               multiline="true"/>

+    </au:assertTrue>

+    <au:assertTrue>

+      <matches string="AB${NL}C" pattern="^AB$"

+               multiline="true"/>

+    </au:assertTrue>

+  </target>

+

+</project>




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

Reply via email to