ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From peterrei...@apache.org
Subject cvs commit: ant/src/main/org/apache/tools/ant/taskdefs/optional/junit BriefJUnitResultFormatter.java PlainJUnitResultFormatter.java
Date Mon, 15 Nov 2004 10:41:44 GMT
peterreilly    2004/11/15 02:41:44

  Modified:    .        WHATSNEW
               src/main/org/apache/tools/ant/taskdefs/optional/junit
                        BriefJUnitResultFormatter.java
                        PlainJUnitResultFormatter.java
  Log:
  Junit task -- display suite first
  PR: 31962
  Obtained from: Kevin Jackson
  
  Revision  Changes    Path
  1.683     +4 -1      ant/WHATSNEW
  
  Index: WHATSNEW
  ===================================================================
  RCS file: /home/cvs/ant/WHATSNEW,v
  retrieving revision 1.682
  retrieving revision 1.683
  diff -u -r1.682 -r1.683
  --- WHATSNEW	11 Nov 2004 17:49:45 -0000	1.682
  +++ WHATSNEW	15 Nov 2004 10:41:43 -0000	1.683
  @@ -81,7 +81,10 @@
   * New task <getlibraries> can retrieve library files from a maven repository.
   
   * unzip/unwar/unjar/untar now supports a nested mapper, which lets you unzip
  -  in useful ways. 
  +  in useful ways.
  +
  +* Junit task -- display suite first.
  +  Bugzilla report 31962.
   
   Changes from Ant 1.6.2 to current Ant 1.6 CVS version
   =====================================================
  
  
  
  1.16      +14 -6     ant/src/main/org/apache/tools/ant/taskdefs/optional/junit/BriefJUnitResultFormatter.java
  
  Index: BriefJUnitResultFormatter.java
  ===================================================================
  RCS file: /home/cvs/ant/src/main/org/apache/tools/ant/taskdefs/optional/junit/BriefJUnitResultFormatter.java,v
  retrieving revision 1.15
  retrieving revision 1.16
  diff -u -r1.15 -r1.16
  --- BriefJUnitResultFormatter.java	9 Mar 2004 16:48:31 -0000	1.15
  +++ BriefJUnitResultFormatter.java	15 Nov 2004 10:41:43 -0000	1.16
  @@ -94,19 +94,27 @@
   
       /**
        * The whole testsuite started.
  +     * @param suite the test suite
        */
  -    public void startTestSuite(JUnitTest suite) throws BuildException {
  +    public void startTestSuite(JUnitTest suite) {
  +        if (output == null) {
  +            return; // Quick return - no output do nothing.
  +        }
  +        String newLine = System.getProperty("line.separator");
  +        StringBuffer sb = new StringBuffer("Testsuite: ");
  +        sb.append(suite.getName());
  +        sb.append(newLine);
  +        output.write(sb.toString());
  +        output.flush();
       }
   
       /**
        * The whole testsuite ended.
  +     * @param suite the test suite
        */
  -    public void endTestSuite(JUnitTest suite) throws BuildException {
  +    public void endTestSuite(JUnitTest suite) {
           String newLine = System.getProperty("line.separator");
  -        StringBuffer sb = new StringBuffer("Testsuite: ");
  -        sb.append(suite.getName());
  -        sb.append(newLine);
  -        sb.append("Tests run: ");
  +        StringBuffer sb = new StringBuffer("Tests run: ");
           sb.append(suite.runCount());
           sb.append(", Failures: ");
           sb.append(suite.failureCount());
  
  
  
  1.26      +20 -6     ant/src/main/org/apache/tools/ant/taskdefs/optional/junit/PlainJUnitResultFormatter.java
  
  Index: PlainJUnitResultFormatter.java
  ===================================================================
  RCS file: /home/cvs/ant/src/main/org/apache/tools/ant/taskdefs/optional/junit/PlainJUnitResultFormatter.java,v
  retrieving revision 1.25
  retrieving revision 1.26
  diff -u -r1.25 -r1.26
  --- PlainJUnitResultFormatter.java	9 Mar 2004 16:48:31 -0000	1.25
  +++ PlainJUnitResultFormatter.java	15 Nov 2004 10:41:43 -0000	1.26
  @@ -81,20 +81,34 @@
       }
   
       /**
  -     * Empty.
  +     * The whole testsuite started.
  +     * @param suite the test suite
  +     * @throws BuildException if unable to write the output
        */
  -    public void startTestSuite(JUnitTest suite) {
  +    public void startTestSuite(JUnitTest suite) throws BuildException {
  +        if (out == null) {
  +            return; // Quick return - no output do nothing.
  +        }
  +        String newLine = System.getProperty("line.separator");
  +        StringBuffer sb = new StringBuffer("Testsuite: ");
  +        sb.append(suite.getName());
  +        sb.append(newLine);
  +        try {
  +            out.write(sb.toString().getBytes());
  +            out.flush();
  +        } catch (IOException ex) {
  +            throw new BuildException("Unable to write output", ex);
  +        }
       }
   
       /**
        * The whole testsuite ended.
  +     * @param suite the test suite
  +     * @throws BuildException if unable to write the output
        */
       public void endTestSuite(JUnitTest suite) throws BuildException {
           String newLine = System.getProperty("line.separator");
  -        StringBuffer sb = new StringBuffer("Testsuite: ");
  -        sb.append(suite.getName());
  -        sb.append(newLine);
  -        sb.append("Tests run: ");
  +        StringBuffer sb = new StringBuffer("Tests run: ");
           sb.append(suite.runCount());
           sb.append(", Failures: ");
           sb.append(suite.failureCount());
  
  
  

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


Mime
View raw message