This is the mail archive of the mauve-patches@sourceware.org mailing list for the Mauve project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

FYI: gnu.testlet.runner.Mauve


This patch saves the default locale before running the tests, and restores it after. This fixes a problem where the run date in the generated HTML report is formatted in the wrong locale due to a test changing the default:

2005-10-30 David Gilbert <david.gilbert@object-refinery.com>

   * gnu/testlet/runner/Mauve.java
   (execute): save default locale before running tests and restore it
   after,
   (getSourceDirectory): removed inappropriate return value,
   (main): removed redundant code.

Regards,

Dave
Index: gnu/testlet/runner/Mauve.java
===================================================================
RCS file: /cvs/mauve/mauve/gnu/testlet/runner/Mauve.java,v
retrieving revision 1.2
diff -u -r1.2 Mauve.java
--- gnu/testlet/runner/Mauve.java	30 Oct 2005 20:11:03 -0000	1.2
+++ gnu/testlet/runner/Mauve.java	30 Oct 2005 20:49:08 -0000
@@ -1,4 +1,4 @@
-// Copyright (C) 2004 by Object Refinery Limited
+// Copyright (C) 2004, 2005 by Object Refinery Limited
 // Copyright (C) 2005 by <zander@kde.org>
 // Written by David Gilbert (david.gilbert@object-refinery.com)
 // Written by Thomas Zander <zander@kde.org>
@@ -39,6 +39,7 @@
 import java.io.LineNumberReader;
 import java.io.PrintWriter;
 import java.io.Reader;
+import java.util.Locale;
 
 /**
  * An application that runs a collection of Mauve tests and creates a report 
@@ -62,6 +63,9 @@
    */
   public synchronized void execute(String file, String prefix, String output) 
   {
+    // save the default locale, some tests change the default and we want
+    // to restore it before generating the HTML report...
+    Locale savedLocale = Locale.getDefault();
     File out = new File(output);
     if (out.exists() && !out.isDirectory())
       throw new IllegalArgumentException("Output should be a directory");
@@ -169,6 +173,10 @@
     catch (IOException e) {
       e.printStackTrace(System.out);
     }
+
+    // tests are complete so restore the default locale
+    Locale.setDefault(savedLocale);
+    
     // write results to HTML
     System.out.println("Creating HTML report...");
     try 
@@ -417,7 +425,7 @@
 
   public String getSourceDirectory () 
   {
-    return "/home/dgilbert/workspace/mauve-latest"; // TODO
+    return null; // TODO
   }
 
   public File getResourceFile (String name) throws ResourceNotFoundException 
@@ -459,7 +467,6 @@
     String file = "tests";
     String prefix = "gnu.testlet.";
     String output = "results";
-    boolean error = false;
     for (int i = 0; i < args.length; i++) 
       {
         String a = args[i];

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]