ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ste...@apache.org
Subject svn commit: r412531 - in /ant/antlibs/antunit/trunk/src: etc/testcases/ etc/testcases/antunit/ main/org/apache/ant/antunit/ testcases/org/apache/ant/antunit/
Date Wed, 07 Jun 2006 20:47:35 GMT
Author: stevel
Date: Wed Jun  7 13:47:34 2006
New Revision: 412531

URL: http://svn.apache.org/viewvc?rev=412531&view=rev
Log:
-Fix the test to expect the failure that is now thrown on an error. 
-added 'all' targets to the various testcase build files that run antunit against themselves
(neat trick, huh?)
Gump should be working now...

Modified:
    ant/antlibs/antunit/trunk/src/etc/testcases/antunit.xml
    ant/antlibs/antunit/trunk/src/etc/testcases/antunit/base.xml
    ant/antlibs/antunit/trunk/src/etc/testcases/antunit/copy.xml
    ant/antlibs/antunit/trunk/src/etc/testcases/assert.xml
    ant/antlibs/antunit/trunk/src/etc/testcases/expectfailure.xml
    ant/antlibs/antunit/trunk/src/main/org/apache/ant/antunit/AntUnit.java
    ant/antlibs/antunit/trunk/src/testcases/org/apache/ant/antunit/AntUnitTest.java
    ant/antlibs/antunit/trunk/src/testcases/org/apache/ant/antunit/ExpectFailureTest.java

Modified: ant/antlibs/antunit/trunk/src/etc/testcases/antunit.xml
URL: http://svn.apache.org/viewvc/ant/antlibs/antunit/trunk/src/etc/testcases/antunit.xml?rev=412531&r1=412530&r2=412531&view=diff
==============================================================================
--- ant/antlibs/antunit/trunk/src/etc/testcases/antunit.xml (original)
+++ ant/antlibs/antunit/trunk/src/etc/testcases/antunit.xml Wed Jun  7 13:47:34 2006
@@ -1,7 +1,7 @@
 <?xml version="1.0"?>
 
 <!--
- Copyright  2005 The Apache Software Foundation
+ Copyright  2005-2006 The Apache Software Foundation
  
   Licensed under the Apache License, Version 2.0 (the "License");
   you may not use this file except in compliance with the License.
@@ -17,8 +17,11 @@
 -->
 
 <project name="antunit-test"
-         default="all" xmlns:au="antlib:org.apache.ant.antunit">
+      default="all"
+         xmlns:au="antlib:org.apache.ant.antunit">
 
+  <target name="all" depends="antunit-basetest,antunit-copy" />
+  
   <target name="antunit-basetest">
     <au:antunit>
       <fileset dir="antunit" includes="base.xml"/>

Modified: ant/antlibs/antunit/trunk/src/etc/testcases/antunit/base.xml
URL: http://svn.apache.org/viewvc/ant/antlibs/antunit/trunk/src/etc/testcases/antunit/base.xml?rev=412531&r1=412530&r2=412531&view=diff
==============================================================================
--- ant/antlibs/antunit/trunk/src/etc/testcases/antunit/base.xml (original)
+++ ant/antlibs/antunit/trunk/src/etc/testcases/antunit/base.xml Wed Jun  7 13:47:34 2006
@@ -1,7 +1,7 @@
 <?xml version="1.0"?>
 
 <!--
- Copyright  2005 The Apache Software Foundation
+ Copyright  2005-2006 The Apache Software Foundation
  
   Licensed under the Apache License, Version 2.0 (the "License");
   you may not use this file except in compliance with the License.
@@ -17,7 +17,15 @@
 -->
 
 <project name="antunit-base-test"
-         default="all" xmlns:au="antlib:org.apache.ant.antunit">
+    default="all"
+         xmlns:au="antlib:org.apache.ant.antunit">
+
+  <target name="all">
+    <au:antunit>
+      <fileset file="${ant.file}"/>
+      <au:plainlistener/>
+    </au:antunit>
+  </target>
 
   <target name="setUp">
     <echo>setup</echo>

Modified: ant/antlibs/antunit/trunk/src/etc/testcases/antunit/copy.xml
URL: http://svn.apache.org/viewvc/ant/antlibs/antunit/trunk/src/etc/testcases/antunit/copy.xml?rev=412531&r1=412530&r2=412531&view=diff
==============================================================================
--- ant/antlibs/antunit/trunk/src/etc/testcases/antunit/copy.xml (original)
+++ ant/antlibs/antunit/trunk/src/etc/testcases/antunit/copy.xml Wed Jun  7 13:47:34 2006
@@ -1,7 +1,7 @@
 <?xml version="1.0"?>
 
 <!--
- Copyright  2005 The Apache Software Foundation
+ Copyright  2005-2006 The Apache Software Foundation
  
   Licensed under the Apache License, Version 2.0 (the "License");
   you may not use this file except in compliance with the License.
@@ -16,8 +16,14 @@
   limitations under the License.
 -->
 
-<project name="copy-test" basedir="." default="test1"
+<project name="copy-test" basedir="." default="all"
   xmlns:au="antlib:org.apache.ant.antunit">
+  <target name="all">
+    <au:antunit>
+      <fileset file="${ant.file}"/>
+      <au:plainlistener/>
+    </au:antunit>
+  </target>
 
   <target name="test1">
     <au:assertFileDoesntExist file="copytest1.tmp"/>

Modified: ant/antlibs/antunit/trunk/src/etc/testcases/assert.xml
URL: http://svn.apache.org/viewvc/ant/antlibs/antunit/trunk/src/etc/testcases/assert.xml?rev=412531&r1=412530&r2=412531&view=diff
==============================================================================
--- ant/antlibs/antunit/trunk/src/etc/testcases/assert.xml (original)
+++ ant/antlibs/antunit/trunk/src/etc/testcases/assert.xml Wed Jun  7 13:47:34 2006
@@ -1,7 +1,7 @@
 <?xml version="1.0"?>
 
 <!--
- Copyright  2005 The Apache Software Foundation
+ Copyright  2005-2006 The Apache Software Foundation
  
   Licensed under the Apache License, Version 2.0 (the "License");
   you may not use this file except in compliance with the License.
@@ -20,7 +20,10 @@
          default="all" xmlns:au="antlib:org.apache.ant.antunit">
 
   <target name="all">
-    <fail>Only run via JUnit</fail>
+    <au:antunit>
+      <fileset file="${ant.file}"/>
+      <au:plainlistener/>
+    </au:antunit>
   </target>
 
   <target name="assertTruePass">

Modified: ant/antlibs/antunit/trunk/src/etc/testcases/expectfailure.xml
URL: http://svn.apache.org/viewvc/ant/antlibs/antunit/trunk/src/etc/testcases/expectfailure.xml?rev=412531&r1=412530&r2=412531&view=diff
==============================================================================
--- ant/antlibs/antunit/trunk/src/etc/testcases/expectfailure.xml (original)
+++ ant/antlibs/antunit/trunk/src/etc/testcases/expectfailure.xml Wed Jun  7 13:47:34 2006
@@ -1,7 +1,7 @@
 <?xml version="1.0"?>
 
 <!--
- Copyright  2005 The Apache Software Foundation
+ Copyright  2005-2006 The Apache Software Foundation
  
   Licensed under the Apache License, Version 2.0 (the "License");
   you may not use this file except in compliance with the License.
@@ -17,7 +17,13 @@
 -->
 
 <project name="antunit-test"
-         default="all" xmlns:au="antlib:org.apache.ant.antunit">
+         xmlns:au="antlib:org.apache.ant.antunit">
+  <target name="all">
+    <au:antunit>
+      <fileset file="${ant.file}"/>
+      <au:plainlistener/>
+    </au:antunit>
+  </target>
 
   <target name="passNoMessage">
     <au:expectfailure>

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=412531&r1=412530&r2=412531&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 Wed Jun  7 13:47:34
2006
@@ -58,7 +58,10 @@
     private int failures=0;
     private int errors=0;
     private boolean failOnError=true;
-    
+    public static final String ERROR_TESTS_FAILED = "Tests failed with ";
+    public static final String ERROR_NO_FILESET = "You must specify at least one nested"
+                            + " fileset.";
+
     public void add(FileSet fs) {
         filesets.add(fs);
     }
@@ -73,15 +76,14 @@
 
     public void execute() {
         if (filesets.size() == 0) {
-            throw new BuildException("You must specify at least one nested"
-                                     + " fileset.");
+            throw new BuildException(ERROR_NO_FILESET);
         }
         Iterator iter = filesets.iterator();
         while (iter.hasNext()) {
             doFileSet((FileSet) iter.next());
         }
         if (failOnError && (failures > 0 || errors > 0)) {
-            throw new BuildException("Tests failed with "
+            throw new BuildException(ERROR_TESTS_FAILED
                     + failures + " failure" + (failures != 1 ? "s" : "")
                     + " and "
                     + errors + " error" + (errors != 1 ? "s" : ""));

Modified: ant/antlibs/antunit/trunk/src/testcases/org/apache/ant/antunit/AntUnitTest.java
URL: http://svn.apache.org/viewvc/ant/antlibs/antunit/trunk/src/testcases/org/apache/ant/antunit/AntUnitTest.java?rev=412531&r1=412530&r2=412531&view=diff
==============================================================================
--- ant/antlibs/antunit/trunk/src/testcases/org/apache/ant/antunit/AntUnitTest.java (original)
+++ ant/antlibs/antunit/trunk/src/testcases/org/apache/ant/antunit/AntUnitTest.java Wed Jun
 7 13:47:34 2006
@@ -25,12 +25,15 @@
         super(name);
     }
 
-    public void setUp() {
+    public void setUp() throws Exception {
+        super.setUp();
         configureProject("src/etc/testcases/antunit.xml");
     }
 
     public void testBase() {
-        executeTarget("antunit-basetest");
+        expectBuildExceptionContaining("antunit-basetest",
+            "expected basetest to fail",
+            AntUnit.ERROR_TESTS_FAILED);
         String log = getLog();
         int index = log.indexOf("Build File: ");
         assertTrue("start recorded", index > -1);

Modified: ant/antlibs/antunit/trunk/src/testcases/org/apache/ant/antunit/ExpectFailureTest.java
URL: http://svn.apache.org/viewvc/ant/antlibs/antunit/trunk/src/testcases/org/apache/ant/antunit/ExpectFailureTest.java?rev=412531&r1=412530&r2=412531&view=diff
==============================================================================
--- ant/antlibs/antunit/trunk/src/testcases/org/apache/ant/antunit/ExpectFailureTest.java
(original)
+++ ant/antlibs/antunit/trunk/src/testcases/org/apache/ant/antunit/ExpectFailureTest.java
Wed Jun  7 13:47:34 2006
@@ -25,7 +25,8 @@
         super(name);
     }
 
-    public void setUp() {
+    public void setUp() throws Exception {
+        super.setUp();
         configureProject("src/etc/testcases/expectfailure.xml");
     }
 



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@ant.apache.org
For additional commands, e-mail: dev-help@ant.apache.org


Mime
View raw message