diff --git a/contributors.xml b/contributors.xml
index 2d6c632..8256daa 100644
--- a/contributors.xml
+++ b/contributors.xml
@@ -18,6 +18,18 @@
Kevin
Jackson
+
+ Matt
+ Benson
+
+
+ Paul
+ King
+
+
+ Peter
+ Reilly
+
Stefan
Bodewig
@@ -26,8 +38,4 @@
Steve
Loughran
-
- Matt
- Benson
-
diff --git a/docs/assertions.html b/docs/assertions.html
index e90d8b4..455661c 100644
--- a/docs/assertions.html
+++ b/docs/assertions.html
@@ -464,6 +464,64 @@
<assertReferenceIsType refid="classpath" type="path"/>
+
+
+ Asserts that a string matches a given regular expression.
+
+
+
+ | Attribute |
+ Description |
+ Required |
+
+
+ | string |
+ The string to test. |
+ Yes |
+
+
+ | pattern |
+ The pattern to test the string against. |
+ Yes |
+
+
+ | casesensitive |
+
+ Perform a case sensitive match.
+ Default is true.
+ |
+ No. |
+
+
+ | multiline |
+
+ Perform a multi line match.
+ Default is false.
+ |
+ No. |
+
+
+ | singleline |
+
+ This allows '.' to match new lines.
+ SingleLine is not to be confused with multiline,
+ SingleLine is a perl
+ regex term, it corresponds to dotall in java regex.
+ Default is false.
+ |
+ No. |
+
+
+
+ Examples
+
+ Make the build fail if the property abc does not contain
+ "abc" regardless of case:
+
+
+ <assertMatches string="${abc}" pattern="abc"
+ casesensitive="false"/>
+
Asserts that the build log contains a given message.
diff --git a/src/etc/testcases/assert.xml b/src/etc/testcases/assert.xml
index 214f0b6..1755f62 100644
--- a/src/etc/testcases/assert.xml
+++ b/src/etc/testcases/assert.xml
@@ -184,4 +184,10 @@ under the License.
+
+
+
+
diff --git a/src/main/org/apache/ant/antunit/antlib.xml b/src/main/org/apache/ant/antunit/antlib.xml
index 35516ee..fff8277 100644
--- a/src/main/org/apache/ant/antunit/antlib.xml
+++ b/src/main/org/apache/ant/antunit/antlib.xml
@@ -224,4 +224,22 @@ under the License.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/tests/junit/org/apache/ant/antunit/AssertTest.java b/src/tests/junit/org/apache/ant/antunit/AssertTest.java
index 94af651..5a2f786 100644
--- a/src/tests/junit/org/apache/ant/antunit/AssertTest.java
+++ b/src/tests/junit/org/apache/ant/antunit/AssertTest.java
@@ -138,6 +138,10 @@ public class AssertTest extends BuildFileTest {
"Expected reference 'foo5' to be a 'fileset'");
}
+ public void testMatches() {
+ executeTarget("assertMatches");
+ }
+
private void testPass(String target) {
executeTarget(target);
}
@@ -153,8 +157,16 @@ public class AssertTest extends BuildFileTest {
} catch (AssertionFailedException e) {
assertEquals(message, e.getMessage());
} catch (Throwable t) {
- fail("Unexpected exception of type " + t.getClass()
- + ", message '" + t.getMessage() + "'");
+ if (t.getClass().getName().equals(
+ AssertionFailedException.class.getName())) {
+ // Some classloader issue!
+ assertEquals(message, t.getMessage());
+ } else {
+ fail("Unexpected exception of type " + t.getClass()
+ + ", message '" + t.getMessage() + "'"
+ + "\nexpected exception of type "
+ + AssertionFailedException.class);
+ }
} // end of try-catch
}
}
diff --git a/src/tests/junit/org/apache/ant/antunit/ExpectFailureTest.java b/src/tests/junit/org/apache/ant/antunit/ExpectFailureTest.java
index ce0ae0e..8467448 100644
--- a/src/tests/junit/org/apache/ant/antunit/ExpectFailureTest.java
+++ b/src/tests/junit/org/apache/ant/antunit/ExpectFailureTest.java
@@ -61,7 +61,18 @@ public class ExpectFailureTest extends BuildFileTest {
executeTarget(target);
fail("Expected an exception");
} catch (AssertionFailedException e) {
- assertEquals(message, e.getMessage());
- }
+ assertEquals(message, e.getMessage());
+ } catch (Throwable t) {
+ if (t.getClass().getName().equals(
+ AssertionFailedException.class.getName())) {
+ // Some classloader issue!
+ assertEquals(message, t.getMessage());
+ } else {
+ fail("Unexpected exception of type " + t.getClass()
+ + ", message '" + t.getMessage() + "'"
+ + "\nexpected exception of type "
+ + AssertionFailedException.class);
+ }
+ }
}
}