This is the mail archive of the
mauve-patches@sourceware.org
mailing list for the Mauve project.
FYI: A Few Test Fixes
- From: Joshua Sumali <jsumali at redhat dot com>
- To: mauve-patches at sources dot redhat dot com
- Date: Mon, 09 Jul 2007 14:37:12 -0400
- Subject: FYI: A Few Test Fixes
These few patches add a few lines fixing mostly time zones and locales
to match with the pre-existing test cases. The tests now pass with openJDK.
2007-07-09 Joshua Sumali <jsumali@redhat.com>
* gnu/testlet/java/text/SimpleDateFormat/attribute.java:
(test): Added a timezone change to match the test date
* gnu/testlet/java/text/SimpleDateFormat/parse.java:
(test): Added a timezone change and Locale to match test
* gnu/testlet/java/text/SimpleDateFormat/cloning.java:
(test): Changed equality operator from != to .equals
Index: attribute.java
===================================================================
RCS file: /cvs/mauve/mauve/gnu/testlet/java/text/SimpleDateFormat/attribute.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- attribute.java 13 Apr 2004 17:44:45 -0000 1.2
+++ attribute.java 9 Jul 2007 18:04:49 -0000 1.3
@@ -44,6 +44,9 @@
import java.util.Date;
import java.util.Map;
import java.util.Set;
+import java.util.Locale;
+import java.util.TimeZone;
+
public class attribute implements Testlet {
@@ -109,11 +112,15 @@
try
{
Date date = new Date(1471228928L);
- SimpleDateFormat format2 = new SimpleDateFormat("yyyy.MM.dd hh:kk:mm:ss 'zone' zzzz");
+ SimpleDateFormat format2 = new SimpleDateFormat("yyyy.MM.dd hh:kk:mm:ss 'zone' zzzz", Locale.UK);
+ format2.setTimeZone(TimeZone.getTimeZone("UTC"));
AttributedCharacterIterator iterator =
format2.formatToCharacterIterator(date);
+
+ //Needed a larger range since time zones can have extended formats
+ //i.e. 'Coordinated Universal Time' or UTC, GMT, etc.
int[] range = new int[]
- { 4, 5, 7, 8, 10, 11, 13, 14, 16, 17, 19, 20, 22, 28, 37};
+ { 4, 5, 7, 8, 10, 11, 13, 14, 16, 17, 19, 20, 22, 28, 70};
Object[] attrs = new Object[] {
DateFormat.Field.YEAR, null, DateFormat.Field.MONTH, null, DateFormat.Field.DAY_OF_MONTH,
null, DateFormat.Field.HOUR1, null, DateFormat.Field.HOUR_OF_DAY1, null,
Index: parse.java
===================================================================
RCS file: /cvs/mauve/mauve/gnu/testlet/java/text/SimpleDateFormat/parse.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- parse.java 17 May 2005 17:00:22 -0000 1.3
+++ parse.java 9 Jul 2007 18:07:56 -0000 1.4
@@ -30,7 +30,7 @@
{
public void test(TestHarness harness)
{
- SimpleDateFormat sdf = new SimpleDateFormat("MMMM yyyy", Locale.US);
+ SimpleDateFormat sdf = new SimpleDateFormat("MMMM yyyy", Locale.UK);
sdf.setTimeZone(TimeZone.getTimeZone("UTC"));
Map toTest = new HashMap();
@@ -59,16 +59,18 @@
doParse(harness, sdf, toTest);
// long and short names should both work.
- sdf.applyPattern("EEE MMM");
+ sdf = new SimpleDateFormat("EEE MMM", Locale.UK);
+ sdf.setTimeZone(TimeZone.getTimeZone("UTC"));
toTest.clear();
- toTest.put("Sat Jun", new Date(13478400000L));
+ toTest.put("Sat Jun", new Date(13478400000L)); //saturday, june 6th, 1970, 02:00:00
toTest.put("Saturday June", new Date(13478400000L));
doParse(harness, sdf, toTest);
sdf.applyPattern("EEEE MMMM");
doParse(harness, sdf, toTest);
/* Test case from bug #11583 */
- SimpleDateFormat sdf1 = new SimpleDateFormat("MMM dd, yyyy");
+ SimpleDateFormat sdf1 = new SimpleDateFormat("MMM dd, yyyy", Locale.UK);
+ sdf1.setTimeZone(TimeZone.getTimeZone("UTC"));
toTest = new HashMap();
toTest.put("dec 31, 2004", new Date(1104451200000L));
doParse(harness, sdf1, toTest);
Index: Cloning.java
===================================================================
RCS file: /cvs/mauve/mauve/gnu/testlet/java/text/SimpleDateFormat/Cloning.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- Cloning.java 16 Jan 2005 01:25:20 -0000 1.1
+++ Cloning.java 9 Jul 2007 18:08:40 -0000 1.2
@@ -25,6 +25,7 @@
import gnu.testlet.Testlet;
import java.text.SimpleDateFormat;
+import java.util.Date;
/**
* Check for correct cloning behaviour in the SimpleDateFormat
@@ -46,8 +47,8 @@
harness.check(format1.getDateFormatSymbols() !=
format2.getDateFormatSymbols(),
"Cloned symbols");
- harness.check(format1.get2DigitYearStart() !=
- format2.get2DigitYearStart(),
+
+ harness.check(format1.get2DigitYearStart().equals(format2.get2DigitYearStart()),
"Cloned 2 digit year start date");
}