[EMAIL PROTECTED] wrote:
Author: stevel
Date: Sun Jun  4 15:34:30 2006
New Revision: 411613

URL: http://svn.apache.org/viewvc?rev=411613&view=rev
Log:
1. typos in assertTask
2. ExpectFailure now does a substring check for the expectedMessage, not a 
simple exact match
3. AntUnit actually fails the build if the tests failed.



Modified: ant/antlibs/antunit/trunk/src/main/org/apache/ant/antunit/AntUnit.java
URL: 
http://svn.apache.org/viewvc/ant/antlibs/antunit/trunk/src/main/org/apache/ant/antunit/AntUnit.java?rev=411613&r1=411612&r2=411613&view=diff
==============================================================================
--- ant/antlibs/antunit/trunk/src/main/org/apache/ant/antunit/AntUnit.java 
(original)
+++ ant/antlibs/antunit/trunk/src/main/org/apache/ant/antunit/AntUnit.java Sun 
Jun  4 15:34:30 2006
@@ -55,6 +55,10 @@
private ArrayList listeners = new ArrayList(); + private int failures=0;
+    private int errors=0;
+    private boolean failOnError=true;
+ public void add(FileSet fs) {
         filesets.add(fs);
     }
@@ -63,6 +67,10 @@
         listeners.add(al);
     }
+ public void setFailOnError(boolean failOnError) {
+        this.failOnError = failOnError;
+    }
+
     public void execute() {
         if (filesets.size() == 0) {
             throw new BuildException("You must specify at least one nested"
@@ -72,6 +80,12 @@
         while (iter.hasNext()) {
             doFileSet((FileSet) iter.next());
         }
+        if (failOnError && (failures > 0 || errors > 0)) {
+            throw new BuildException("Tests failed with "
+                    + failures + " failure" + (failures != 1 ? "s" : "")
+                    + " and "
+                    + errors + " error" + (errors != 1 ? "s" : ""));
+        }
     }



There is one big change here; a failing antunit test does now actually halt the build. the other one matters less, as it makes the expectedMessage string in <expectFailure> a substring search on the failure message, not a complete match. this is useful if part of the message varies depending upon the target platform

what is the release status of Antunit? Is is formally released? There is no obvious JAR on the web page...

-steve

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

Reply via email to