This is the mail archive of the
mauve-patches@sourceware.org
mailing list for the Mauve project.
Reformat of some files
- From: Anthony Balkissoon <abalkiss at redhat dot com>
- To: mauve-patches at sources dot redhat dot com
- Date: Tue, 21 Mar 2006 11:17:19 -0500
- Subject: Reformat of some files
I reformatted the three files mentioned below in preparation for some
work I will be doing on them.
2006-03-21 Anthony Balkissoon <abalkiss@redhat.com>
* gnu/testlet/SimpleTestHarness.java: Reformatted.
* gnu/testlet/TestHarness.java: Reformatted, removed unused imports.
* gnu/testlet/TestReport.java: Reformatted.
--Tony
Index: gnu/testlet/SimpleTestHarness.java
===================================================================
RCS file: /cvs/mauve/mauve/gnu/testlet/SimpleTestHarness.java,v
retrieving revision 1.44
diff -u -r1.44 SimpleTestHarness.java
--- gnu/testlet/SimpleTestHarness.java 8 Nov 2005 21:49:38 -0000 1.44
+++ gnu/testlet/SimpleTestHarness.java 21 Mar 2006 16:13:29 -0000
@@ -29,150 +29,162 @@
import java.util.Vector;
public class SimpleTestHarness
- extends TestHarness
+ extends TestHarness
{
private int count = 0;
+
private int failures = 0;
+
private static Vector expected_xfails = new Vector();
+
private int xfailures = 0;
+
private int xpasses = 0;
+
private int total = 0;
+
private boolean verbose = false;
+
private boolean debug = false;
- private boolean results_only=false;
- private boolean exceptions=false;
+
+ private boolean results_only = false;
+
+ private boolean exceptions = false;
+
private String description;
+
private String last_check;
+
private TestReport report = null;
+
private TestResult currentResult = null;
- private final String getDescription (String pf)
+ private final String getDescription(String pf)
{
- return (pf + ": " + description +
- ((last_check == null) ? "" : (": " + last_check)) +
- " (number " + (count + 1) + ")");
+ return (pf + ": " + description
+ + ((last_check == null) ? "" : (": " + last_check)) + " (number "
+ + (count + 1) + ")");
}
-
- protected int getFailures() {
+ protected int getFailures()
+ {
return failures;
}
- public void check (boolean result)
+ public void check(boolean result)
{
- if (!result)
+ if (! result)
{
- String desc;
- currentResult.addFail((last_check == null ? "" : last_check) +
- " (number " + (count + 1) + ")");
- if (!expected_xfails.contains(desc = getDescription("FAIL")))
- {
- System.out.println(desc);
- ++failures;
- }
- else if (verbose || results_only)
- {
- System.out.println("X" + desc);
- ++xfailures;
- }
+ String desc;
+ currentResult.addFail((last_check == null ? "" : last_check)
+ + " (number " + (count + 1) + ")");
+ if (! expected_xfails.contains(desc = getDescription("FAIL")))
+ {
+ System.out.println(desc);
+ ++failures;
+ }
+ else if (verbose || results_only)
+ {
+ System.out.println("X" + desc);
+ ++xfailures;
+ }
}
else
{
- currentResult.addPass();
+ currentResult.addPass();
if (verbose || results_only)
- {
- if (expected_xfails.contains(getDescription("FAIL")))
- {
- System.out.println(getDescription("XPASS"));
- ++xpasses;
- }
- else
- {
- System.out.println(getDescription("PASS"));
- }
+ {
+ if (expected_xfails.contains(getDescription("FAIL")))
+ {
+ System.out.println(getDescription("XPASS"));
+ ++xpasses;
+ }
+ else
+ {
+ System.out.println(getDescription("PASS"));
+ }
}
}
++count;
++total;
}
- public Reader getResourceReader (String name)
- throws ResourceNotFoundException
+ public Reader getResourceReader(String name) throws ResourceNotFoundException
{
return new BufferedReader(new InputStreamReader(getResourceStream(name)));
}
-
- public InputStream getResourceStream (String name)
- throws ResourceNotFoundException
+
+ public InputStream getResourceStream(String name)
+ throws ResourceNotFoundException
{
// The following code assumes File.separator is a single character.
if (File.separator.length() > 1)
- throw new Error ("File.separator length is greater than 1");
+ throw new Error("File.separator length is greater than 1");
String realName = name.replace('#', File.separator.charAt(0));
try
{
- return new FileInputStream(getSourceDirectory() +
- File.separator + realName);
+ return new FileInputStream(getSourceDirectory() + File.separator
+ + realName);
}
catch (FileNotFoundException ex)
{
- throw new ResourceNotFoundException(ex.getLocalizedMessage() +
- ": " + getSourceDirectory() +
- File.separator + realName);
+ throw new ResourceNotFoundException(ex.getLocalizedMessage() + ": "
+ + getSourceDirectory()
+ + File.separator + realName);
}
}
-
- public File getResourceFile (String name) throws ResourceNotFoundException
+
+ public File getResourceFile(String name) throws ResourceNotFoundException
{
// The following code assumes File.separator is a single character.
- if (File.separator.length () > 1)
- throw new Error ("File.separator length is greater than 1");
- String realName = name.replace ('#', File.separator.charAt (0));
+ if (File.separator.length() > 1)
+ throw new Error("File.separator length is greater than 1");
+ String realName = name.replace('#', File.separator.charAt(0));
File f = new File(getSourceDirectory() + File.separator + realName);
- if (!f.exists())
+ if (! f.exists())
{
- throw new ResourceNotFoundException("cannot find mauve resource file" +
- ": " + getSourceDirectory() +
- File.separator + realName);
+ throw new ResourceNotFoundException("cannot find mauve resource file"
+ + ": " + getSourceDirectory()
+ + File.separator + realName);
}
return f;
}
-
- public void checkPoint (String name)
+
+ public void checkPoint(String name)
{
last_check = name;
count = 0;
}
-
- public void verbose (String message)
+
+ public void verbose(String message)
{
if (verbose)
System.out.println(message);
}
-
- public void debug (String message)
+
+ public void debug(String message)
{
debug(message, true);
}
-
- public void debug (String message, boolean newline)
+
+ public void debug(String message, boolean newline)
{
if (debug)
{
- if (newline)
- System.out.println(message);
- else
- System.out.print(message);
+ if (newline)
+ System.out.println(message);
+ else
+ System.out.print(message);
}
}
-
- public void debug (Throwable ex)
+
+ public void debug(Throwable ex)
{
if (debug)
ex.printStackTrace(System.out);
}
-
- public void debug (Object[] o, String desc)
+
+ public void debug(Object[] o, String desc)
{
debug("Dumping Object Array: " + desc);
if (o == null)
@@ -181,12 +193,13 @@
return;
}
- for (int i = 0; i < o.length; i++) {
- if (o[i] instanceof Object[])
- debug((Object[]) o[i], desc + " element " + i);
- else
- debug(" Element " + i + ": " + o[i]);
- }
+ for (int i = 0; i < o.length; i++)
+ {
+ if (o[i] instanceof Object[])
+ debug((Object[]) o[i], desc + " element " + i);
+ else
+ debug(" Element " + i + ": " + o[i]);
+ }
}
private void removeSecurityManager()
@@ -194,130 +207,131 @@
SecurityManager m = System.getSecurityManager();
if (m instanceof TestSecurityManager)
{
- TestSecurityManager tsm = (TestSecurityManager) m;
- tsm.setRunChecks(false);
- System.setSecurityManager(null);
+ TestSecurityManager tsm = (TestSecurityManager) m;
+ tsm.setRunChecks(false);
+ System.setSecurityManager(null);
}
}
-
- protected void runtest (String name)
+
+ protected void runtest(String name)
{
// Try to ensure we start off with a reasonably clean slate.
System.gc();
System.runFinalization();
currentResult = new TestResult(name);
-
+
checkPoint(null);
-
+
Testlet t = null;
try
{
- Class k = Class.forName(name);
-
- Object o = k.newInstance();
- if (!(o instanceof Testlet))
- return;
-
- t = (Testlet) o;
+ Class k = Class.forName(name);
+
+ Object o = k.newInstance();
+ if (! (o instanceof Testlet))
+ return;
+
+ t = (Testlet) o;
}
catch (Throwable ex)
{
- String d = "FAIL: uncaught exception loading " + name;
- currentResult.addException(ex, "failed loading class " + name);
- if (verbose || exceptions)
- d += ": " + ex.toString();
- System.out.println(d);
- if (exceptions)
- ex.printStackTrace(System.out);
- debug(ex);
- if (ex instanceof InstantiationException ||
- ex instanceof IllegalAccessException)
- debug("Hint: is the code we just loaded a public non-abstract " +
- "class with a public nullary constructor???");
- ++failures;
- ++total;
+ String d = "FAIL: uncaught exception loading " + name;
+ currentResult.addException(ex, "failed loading class " + name);
+ if (verbose || exceptions)
+ d += ": " + ex.toString();
+ System.out.println(d);
+ if (exceptions)
+ ex.printStackTrace(System.out);
+ debug(ex);
+ if (ex instanceof InstantiationException
+ || ex instanceof IllegalAccessException)
+ debug("Hint: is the code we just loaded a public non-abstract "
+ + "class with a public nullary constructor???");
+ ++failures;
+ ++total;
}
-
+
if (t != null)
{
- description = name;
- try
- {
- t.test (this);
- removeSecurityManager();
- }
- catch (Throwable ex)
- {
- removeSecurityManager();
- String s = (last_check == null ? "" : " at \"" + last_check +
- "\" number " + (count + 1));
- String d = "FAIL: " + description + ": uncaught exception" + s;
- currentResult.addException(ex, "uncaught exception" + s);
- if (verbose || exceptions)
- d += ": " + ex.toString();
- System.out.println(d);
- if (exceptions)
- ex.printStackTrace(System.out);
- debug(ex);
- ++failures;
- ++total;
- }
+ description = name;
+ try
+ {
+ t.test(this);
+ removeSecurityManager();
+ }
+ catch (Throwable ex)
+ {
+ removeSecurityManager();
+ String s = (last_check == null ? "" : " at \"" + last_check
+ + "\" number " + (count + 1));
+ String d = "FAIL: " + description + ": uncaught exception" + s;
+ currentResult.addException(ex, "uncaught exception" + s);
+ if (verbose || exceptions)
+ d += ": " + ex.toString();
+ System.out.println(d);
+ if (exceptions)
+ ex.printStackTrace(System.out);
+ debug(ex);
+ ++failures;
+ ++total;
+ }
}
if (report != null)
report.addTestResult(currentResult);
}
-
- protected int done ()
+
+ protected int done()
{
- if (!results_only)
+ if (! results_only)
{
- System.out.println(failures + " of " + total + " tests failed");
- if (xpasses > 0)
- System.out.println(xpasses + " of " + total +
- " tests unexpectedly passed");
- if (xfailures > 0)
- System.out.println(xfailures + " of " + total +
- " tests expectedly failed");
+ System.out.println(failures + " of " + total + " tests failed");
+ if (xpasses > 0)
+ System.out.println(xpasses + " of " + total
+ + " tests unexpectedly passed");
+ if (xfailures > 0)
+ System.out.println(xfailures + " of " + total
+ + " tests expectedly failed");
}
return failures > 0 ? 1 : 0;
-
+
}
-
- protected SimpleTestHarness (boolean verbose, boolean debug)
+
+ protected SimpleTestHarness(boolean verbose, boolean debug)
{
this(verbose, debug, false, false, null);
}
-
- protected SimpleTestHarness (boolean verbose, boolean debug,
- boolean results_only, boolean exceptions,
- TestReport report)
+
+ protected SimpleTestHarness(boolean verbose, boolean debug,
+ boolean results_only, boolean exceptions,
+ TestReport report)
{
this.verbose = verbose;
this.debug = debug;
this.results_only = results_only;
this.exceptions = exceptions;
this.report = report;
-
+
try
{
- BufferedReader xfile = new BufferedReader(new FileReader("xfails"));
- String str;
- while ((str = xfile.readLine()) != null) {
- expected_xfails.addElement(str);
- }
+ BufferedReader xfile = new BufferedReader(new FileReader("xfails"));
+ String str;
+ while ((str = xfile.readLine()) != null)
+ {
+ expected_xfails.addElement(str);
+ }
}
catch (FileNotFoundException ex)
{
- // Nothing.
+ // Nothing.
}
catch (IOException ex)
{
- // Nothing.
+ // Nothing.
}
}
-
- public static void main (String[] args)
+
+ public static void main(String[] args)
{
boolean verbose = false;
boolean debug = false;
@@ -327,42 +341,45 @@
String xmlfile = null;
TestReport report = null;
int i;
-
+
for (i = 0; i < args.length; i++)
{
- if (args[i].equals("-verbose"))
- verbose = true;
- else if (args[i].equals("-debug"))
- debug = true;
- else if (args[i].equals("-resultsonly"))
- {
- results_only = true;
- verbose = false;
- debug = false;
- }
- else if (args[i].equals("-exceptions"))
- exceptions = true;
- else if (args[i].equalsIgnoreCase("-file")) {
- if (++i >= args.length)
- throw new RuntimeException("No file path after '-file'. Exit");
- file = args[i];
- }
- else if (args[i].equals("-xmlout"))
- {
- if (++i >= args.length)
- throw new RuntimeException("No file path after '-xmlout'.");
- xmlfile = args[i];
- }
- else
- break;
- }
- if (xmlfile != null) {
- report = new TestReport(System.getProperties());
- }
-
- SimpleTestHarness harness =
- new SimpleTestHarness(verbose, debug, results_only, exceptions, report);
-
+ if (args[i].equals("-verbose"))
+ verbose = true;
+ else if (args[i].equals("-debug"))
+ debug = true;
+ else if (args[i].equals("-resultsonly"))
+ {
+ results_only = true;
+ verbose = false;
+ debug = false;
+ }
+ else if (args[i].equals("-exceptions"))
+ exceptions = true;
+ else if (args[i].equalsIgnoreCase("-file"))
+ {
+ if (++i >= args.length)
+ throw new RuntimeException("No file path after '-file'. Exit");
+ file = args[i];
+ }
+ else if (args[i].equals("-xmlout"))
+ {
+ if (++i >= args.length)
+ throw new RuntimeException("No file path after '-xmlout'.");
+ xmlfile = args[i];
+ }
+ else
+ break;
+ }
+ if (xmlfile != null)
+ {
+ report = new TestReport(System.getProperties());
+ }
+
+ SimpleTestHarness harness = new SimpleTestHarness(verbose, debug,
+ results_only, exceptions,
+ report);
+
BufferedReader r = null;
if (file != null)
try
@@ -378,38 +395,38 @@
while (true)
{
- String cname = null;
- try
- {
- cname = r.readLine();
- if (cname == null)
- break;
- if (verbose)
- System.out.println(cname);
- }
- catch (IOException x)
- {
- // Nothing.
- }
- if (verbose)
- System.out.println("----");
- harness.runtest(cname);
+ String cname = null;
+ try
+ {
+ cname = r.readLine();
+ if (cname == null)
+ break;
+ if (verbose)
+ System.out.println(cname);
+ }
+ catch (IOException x)
+ {
+ // Nothing.
+ }
+ if (verbose)
+ System.out.println("----");
+ harness.runtest(cname);
}
int retval = harness.done();
-
+
if (report != null)
{
- File f = new File(xmlfile);
- try
- {
- report.writeXml(f);
- }
- catch (IOException e)
- {
- throw new Error("Failed to write data to xml file: " +
- e.getMessage());
- }
+ File f = new File(xmlfile);
+ try
+ {
+ report.writeXml(f);
+ }
+ catch (IOException e)
+ {
+ throw new Error("Failed to write data to xml file: "
+ + e.getMessage());
+ }
}
System.exit(retval);
}
Index: gnu/testlet/TestHarness.java
===================================================================
RCS file: /cvs/mauve/mauve/gnu/testlet/TestHarness.java,v
retrieving revision 1.23
diff -u -r1.23 TestHarness.java
--- gnu/testlet/TestHarness.java 22 Feb 2006 17:45:35 -0000 1.23
+++ gnu/testlet/TestHarness.java 21 Mar 2006 16:13:29 -0000
@@ -22,8 +22,6 @@
package gnu.testlet;
import java.awt.AWTException;
-import java.awt.Color;
-import java.awt.Rectangle;
import java.awt.Robot;
import java.io.File;
@@ -52,127 +50,131 @@
* @param result the actual result.
* @param expected the expected result.
*/
- public void check (Object result, Object expected)
- {
- boolean ok = (result == null
- ? expected == null
- : result.equals(expected));
- check (ok);
- // This debug message may be misleading, depending on whether
- // string conversion produces same results for unequal objects.
- if (! ok)
- debug ("got " + result + " but expected " + expected);
- }
+ public void check(Object result, Object expected)
+ {
+ boolean ok = (result == null ? expected == null : result.equals(expected));
+ check(ok);
+ // This debug message may be misleading, depending on whether
+ // string conversion produces same results for unequal objects.
+ if (! ok)
+ debug("got " + result + " but expected " + expected);
+ }
/**
* Checks two booleans for equality and records the result of the check.
- *
- * @param result the actual result.
- * @param expected the expected result.
+ *
+ * @param result the actual result.
+ * @param expected the expected result.
*/
- public void check (boolean result, boolean expected)
- {
- boolean ok = (result == expected);
- check (ok);
- if (! ok)
- debug ("got " + result + " but expected " + expected);
- }
+ public void check(boolean result, boolean expected)
+ {
+ boolean ok = (result == expected);
+ check(ok);
+ if (! ok)
+ debug("got " + result + " but expected " + expected);
+ }
/**
* Checks two ints for equality and records the result of the check.
- *
- * @param result the actual result.
- * @param expected the expected result.
+ *
+ * @param result the actual result.
+ * @param expected the expected result.
*/
- public void check (int result, int expected)
- {
- boolean ok = (result == expected);
- check (ok);
- if (! ok)
- debug ("got " + result + " but expected " + expected);
- }
+ public void check(int result, int expected)
+ {
+ boolean ok = (result == expected);
+ check(ok);
+ if (! ok)
+ debug("got " + result + " but expected " + expected);
+ }
/**
* Checks two longs for equality and records the result of the check.
- *
- * @param result the actual result.
- * @param expected the expected result.
+ *
+ * @param result the actual result.
+ * @param expected the expected result.
*/
- public void check (long result, long expected)
- {
- boolean ok = (result == expected);
- check (ok);
- if (! ok)
- debug ("got " + result + " but expected " + expected);
- }
+ public void check(long result, long expected)
+ {
+ boolean ok = (result == expected);
+ check(ok);
+ if (! ok)
+ debug("got " + result + " but expected " + expected);
+ }
/**
* Checks two doubles for equality and records the result of the check.
- *
- * @param result the actual result.
- * @param expected the expected result.
+ *
+ * @param result the actual result.
+ * @param expected the expected result.
*/
- public void check (double result, double expected)
- {
- // This triple check overcomes the fact that == does not
- // compare NaNs, and cannot tell between 0.0 and -0.0;
- // and all without relying on java.lang.Double (which may
- // itself be buggy - else why would we be testing it? ;)
- // For 0, we switch to infinities, and for NaN, we rely
- // on the identity in JLS 15.21.1 that NaN != NaN is true.
- boolean ok = (result == expected
- ? (result != 0) || (1/result == 1/expected)
- : (result != result) && (expected != expected));
- check (ok);
- if (! ok)
- // If Double.toString() is buggy, this debug statement may
- // accidentally show the same string for two different doubles!
- debug ("got " + result + " but expected " + expected);
- }
+ public void check(double result, double expected)
+ {
+ // This triple check overcomes the fact that == does not
+ // compare NaNs, and cannot tell between 0.0 and -0.0;
+ // and all without relying on java.lang.Double (which may
+ // itself be buggy - else why would we be testing it? ;)
+ // For 0, we switch to infinities, and for NaN, we rely
+ // on the identity in JLS 15.21.1 that NaN != NaN is true.
+ boolean ok = (result == expected ? (result != 0)
+ || (1 / result == 1 / expected)
+ : (result != result)
+ && (expected != expected));
+ check(ok);
+ if (! ok)
+ // If Double.toString() is buggy, this debug statement may
+ // accidentally show the same string for two different doubles!
+ debug("got " + result + " but expected " + expected);
+ }
// These methods are like the above, but checkpoint first.
- public void check (boolean result, String name)
- {
- checkPoint (name);
- check (result);
- }
- public void check (Object result, Object expected, String name)
- {
- checkPoint (name);
- check (result, expected);
- }
- public void check (boolean result, boolean expected, String name)
- {
- checkPoint (name);
- check (result, expected);
- }
- public void check (int result, int expected, String name)
- {
- checkPoint (name);
- check (result, expected);
- }
- public void check (long result, long expected, String name)
- {
- checkPoint (name);
- check (result, expected);
- }
- public void check (double result, double expected, String name)
- {
- checkPoint (name);
- check (result, expected);
- }
+ public void check(boolean result, String name)
+ {
+ checkPoint(name);
+ check(result);
+ }
+
+ public void check(Object result, Object expected, String name)
+ {
+ checkPoint(name);
+ check(result, expected);
+ }
+
+ public void check(boolean result, boolean expected, String name)
+ {
+ checkPoint(name);
+ check(result, expected);
+ }
+
+ public void check(int result, int expected, String name)
+ {
+ checkPoint(name);
+ check(result, expected);
+ }
+
+ public void check(long result, long expected, String name)
+ {
+ checkPoint(name);
+ check(result, expected);
+ }
- public Robot createRobot ()
+ public void check(double result, double expected, String name)
+ {
+ checkPoint(name);
+ check(result, expected);
+ }
+
+ public Robot createRobot()
{
Robot r = null;
try
{
- r = new Robot ();
+ r = new Robot();
}
catch (AWTException e)
{
- fail ("TestHarness: couldn't create Robot: " + e.getMessage ());
+ fail("TestHarness: couldn't create Robot: " + e.getMessage());
}
return r;
@@ -184,13 +186,13 @@
*
* @param name the checkpoint name.
*/
- public void fail (String name)
- {
- checkPoint (name);
- check (false);
- }
+ public void fail(String name)
+ {
+ checkPoint(name);
+ check(false);
+ }
- // Given a resource name, return a Reader on it. Resource names are
+ // Given a resource name, return a Reader on it. Resource names are
// just like file names. They are relative to the top level Mauve
// directory, but '#' characters are used in place of directory
// separators.
Index: gnu/testlet/TestReport.java
===================================================================
RCS file: /cvs/mauve/mauve/gnu/testlet/TestReport.java,v
retrieving revision 1.1
diff -u -r1.1 TestReport.java
--- gnu/testlet/TestReport.java 5 Nov 2004 07:52:13 -0000 1.1
+++ gnu/testlet/TestReport.java 21 Mar 2006 16:13:29 -0000
@@ -62,45 +62,44 @@
*
* @param f the file where the xml stream gets written
*/
- public void writeXml(File f)
- throws IOException
+ public void writeXml(File f) throws IOException
{
Writer out = new OutputStreamWriter(new FileOutputStream(f), ENCODING);
out.write("<?xml version='1.0' encoding='" + ENCODING + "'?>\n");
- out.write("<testreport version='0.1'>\n <jvm name='" +
- escAttrib(systemProperties.get("java.vm.vendor")) +
- "'\n version='" +
- escAttrib(systemProperties.get("java.vm.version")) + "' \n" +
- " os='" + escAttrib(systemProperties.get("os.name")) + " " +
- escAttrib(systemProperties.get("os.version")) + " " +
- escAttrib(systemProperties.get("os.arch")) + "' />\n");
+ out.write("<testreport version='0.1'>\n <jvm name='"
+ + escAttrib(systemProperties.get("java.vm.vendor"))
+ + "'\n version='"
+ + escAttrib(systemProperties.get("java.vm.version")) + "' \n"
+ + " os='" + escAttrib(systemProperties.get("os.name")) + " "
+ + escAttrib(systemProperties.get("os.version")) + " "
+ + escAttrib(systemProperties.get("os.arch")) + "' />\n");
Collections.sort(testResults);
Iterator results = testResults.iterator();
while (results.hasNext())
{
- TestResult tr = (TestResult) results.next();
- String[] failures = tr.getFailMessags();
- out.write(" <testresult testlet='" + escAttrib(tr.getTestletName()) +
- "' passcount='" + tr.getPassCount());
- if (failures.length > 0 || tr.getException() != null)
- out.write("'>\n");
- else
- out.write("'/>\n");
+ TestResult tr = (TestResult) results.next();
+ String[] failures = tr.getFailMessags();
+ out.write(" <testresult testlet='" + escAttrib(tr.getTestletName())
+ + "' passcount='" + tr.getPassCount());
+ if (failures.length > 0 || tr.getException() != null)
+ out.write("'>\n");
+ else
+ out.write("'/>\n");
- for (int i = 0; i < failures.length; i++)
- out.write(" <failure>" + esc(failures[i]) + "</failure>\n");
+ for (int i = 0; i < failures.length; i++)
+ out.write(" <failure>" + esc(failures[i]) + "</failure>\n");
- if (tr.getException() != null)
- {
- Throwable t = tr.getException();
- out.write(" <exception class='" +
- escAttrib(t.getClass().getName()) +
- "'>\n <reason>" + esc(tr.getExceptionMessage()) +
- "</reason>\n <message>" + esc(t.getMessage()) +
- "</message>\n </exception>\n");
- }
- if (failures.length > 0 || tr.getException() != null)
- out.write(" </testresult>\n");
+ if (tr.getException() != null)
+ {
+ Throwable t = tr.getException();
+ out.write(" <exception class='"
+ + escAttrib(t.getClass().getName())
+ + "'>\n <reason>" + esc(tr.getExceptionMessage())
+ + "</reason>\n <message>" + esc(t.getMessage())
+ + "</message>\n </exception>\n");
+ }
+ if (failures.length > 0 || tr.getException() != null)
+ out.write(" </testresult>\n");
}
out.write("</testreport>\n");
out.close();