|
|
@@ -1,79 +1,79 @@ |
|
|
|
<project xmlns:au="antlib:org.apache.ant.antunit">
|
|
|
|
<!-- NB: ant's interface to JDK14 regex enables UNIX_LINES -->
|
|
|
|
<property name="NL" value=" "/>
|
|
|
|
<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>
|
|
|
|
<project xmlns:au="antlib:org.apache.ant.antunit"> |
|
|
|
<!-- NB: ant's interface to JDK14 regex enables UNIX_LINES --> |
|
|
|
<property name="NL" value=" "/> |
|
|
|
<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> |