From: Andrew John Hughes <gnu_andrew@member.fsf.org>
To: mauve-patches@sources.redhat.com
Subject: FYI: Fix Calendar.ampm test to use localised strings
Date: Wed, 31 Dec 2008 10:41:00 -0000 [thread overview]
Message-ID: <20081231104005.GA17760@rivendell.middle-earth.co.uk> (raw)
[-- Attachment #1: Type: text/plain, Size: 613 bytes --]
This fixes the Calendar.ampm test so it passes on both
GNU Classpath and OpenJDK. The AM/PM strings are localised
and so should be retrieved from the locale data.
ChangeLog:
2008-12-31 Andrew John Hughes <gnu_andrew@member.fsf.org>
* gnu/testlet/java/util/Calendar/ampm.java:
Use the localised am/pm strings from DateFormatSymbols
rather than hardcoding.
--
Andrew :)
Support Free Java!
Contribute to GNU Classpath and the OpenJDK
http://www.gnu.org/software/classpath
http://openjdk.java.net
PGP Key: 94EFD9D8 (http://subkeys.pgp.net)
Fingerprint = F8EF F1EA 401E 2E60 15FA 7927 142C 2591 94EF D9D8
[-- Attachment #2: calendar-01.diff --]
[-- Type: text/plain, Size: 2260 bytes --]
Index: gnu/testlet/java/util/Calendar/ampm.java
===================================================================
RCS file: /cvs/mauve/mauve/gnu/testlet/java/util/Calendar/ampm.java,v
retrieving revision 1.2
diff -u -u -r1.2 ampm.java
--- gnu/testlet/java/util/Calendar/ampm.java 21 Mar 2005 08:26:05 -0000 1.2
+++ gnu/testlet/java/util/Calendar/ampm.java 31 Dec 2008 10:36:26 -0000
@@ -13,13 +13,14 @@
public class ampm implements Testlet
{
- private DateFormat format;
+ private SimpleDateFormat format;
private TestHarness harness;
public void test (TestHarness harness)
{
// AM/PM mark is locale-dependent. We use Locale.US.
format = new SimpleDateFormat("hh:mm a", Locale.US);
+ String[] ampm = format.getDateFormatSymbols().getAmPmStrings();
this.harness = harness;
// According to the API document of java.util.Calendar,
@@ -31,19 +32,19 @@
// Whereas the 'h' flag is 1-12 time
// I.e. 12 AM (midnight), 1 AM, .. , 12 PM (midday), 1 PM, .. 11 PM
- checkTime("12:00 AM", "12:00 AM");
- checkTime("12:10 AM", "12:10 AM");
- checkTime(0, 0, Calendar.AM, "12:00 AM");
- checkTime("0:00 AM", "12:00 AM");
- checkTime(0, 10, Calendar.AM, "12:10 AM");
- checkTime("0:10 AM", "12:10 AM");
-
- checkTime("12:00 PM", "12:00 PM");
- checkTime("12:10 PM", "12:10 PM");
- checkTime(0, 0, Calendar.PM, "12:00 PM");
- checkTime("0:00 PM", "12:00 PM");
- checkTime(0, 10, Calendar.PM, "12:10 PM");
- checkTime("0:10 PM", "12:10 PM");
+ checkTime("12:00 " + ampm[0], "12:00 " + ampm[0]);
+ checkTime("12:10 " + ampm[0], "12:10 " + ampm[0]);
+ checkTime(0, 0, Calendar.AM, "12:00 " + ampm[0]);
+ checkTime("0:00 " + ampm[0], "12:00 " + ampm[0]);
+ checkTime(0, 10, Calendar.AM, "12:10 " + ampm[0]);
+ checkTime("0:10 " + ampm[0], "12:10 " + ampm[0]);
+
+ checkTime("12:00 " + ampm[1], "12:00 " + ampm[1]);
+ checkTime("12:10 " + ampm[1], "12:10 " + ampm[1]);
+ checkTime(0, 0, Calendar.PM, "12:00 " + ampm[1]);
+ checkTime("0:00 " + ampm[1], "12:00 " + ampm[1]);
+ checkTime(0, 10, Calendar.PM, "12:10 " + ampm[1]);
+ checkTime("0:10 " + ampm[1], "12:10 " + ampm[1]);
}
private void checkTime(int hh, int mm, int ampm, String expect)
reply other threads:[~2008-12-31 10:41 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20081231104005.GA17760@rivendell.middle-earth.co.uk \
--to=gnu_andrew@member.fsf.org \
--cc=mauve-patches@sources.redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).