aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorNorbert Lindenberg <ecmascript@lindenbergsoftware.com>2012-10-04 23:19:33 -0700
committerNorbert Lindenberg <ecmascript@lindenbergsoftware.com>2012-10-04 23:19:33 -0700
commitffe73305c609529276e1e4a08e9c7c2768297e36 (patch)
tree08f1da31ff57323ecbd3bef18928d74d8d047650 /test
parent9d19c87e3ede843a95fbe590398aebc525818294 (diff)
New and improved tests for ECMAScript Internationalization API.
- Added test for proleptic Gregorian calendar with no year 0. - Spelled 𠮷野家 correctly with supplementary characters. - Fixed default value for useGrouping.
Diffstat (limited to 'test')
-rw-r--r--test/suite/intl402/ch10/10.3/10.3.2_1_c.js2
-rw-r--r--test/suite/intl402/ch11/11.3/11.3.3.js2
-rw-r--r--test/suite/intl402/ch12/12.3/12.3.2_FDT_7_a_iv.js32
-rw-r--r--test/suite/intl402/ch13/13.1/13.1.1_7.js2
4 files changed, 35 insertions, 3 deletions
diff --git a/test/suite/intl402/ch10/10.3/10.3.2_1_c.js b/test/suite/intl402/ch10/10.3/10.3.2_1_c.js
index 077961266..73f2bcf09 100644
--- a/test/suite/intl402/ch10/10.3/10.3.2_1_c.js
+++ b/test/suite/intl402/ch10/10.3/10.3.2_1_c.js
@@ -8,7 +8,7 @@
$INCLUDE("testIntl.js");
-var strings = ["d", "O", "od", "oe", "of", "ö", "o\u0308", "X", "y", "Z", "Z.", "\uD842\uDFB7野家", "吉野家", "!A", "A", "b", "C"];
+var strings = ["d", "O", "od", "oe", "of", "ö", "o\u0308", "X", "y", "Z", "Z.", "𠮷野家", "吉野家", "!A", "A", "b", "C"];
var locales = [undefined, ["de"], ["de-u-co-phonebk"], ["en"], ["ja"], ["sv"]];
var options = [
undefined,
diff --git a/test/suite/intl402/ch11/11.3/11.3.3.js b/test/suite/intl402/ch11/11.3/11.3.3.js
index 60f9bbbd8..5a220ccc9 100644
--- a/test/suite/intl402/ch11/11.3/11.3.3.js
+++ b/test/suite/intl402/ch11/11.3/11.3.3.js
@@ -27,5 +27,5 @@ mustHaveProperty(actual, "minimumFractionDigits", [0]);
mustHaveProperty(actual, "maximumFractionDigits", [3]);
mustNotHaveProperty(actual, "minimumSignificantDigits");
mustNotHaveProperty(actual, "maximumSignificantDigits");
-mustHaveProperty(actual, "useGrouping", [true, false]);
+mustHaveProperty(actual, "useGrouping", [true]);
diff --git a/test/suite/intl402/ch12/12.3/12.3.2_FDT_7_a_iv.js b/test/suite/intl402/ch12/12.3/12.3.2_FDT_7_a_iv.js
new file mode 100644
index 000000000..f13878403
--- /dev/null
+++ b/test/suite/intl402/ch12/12.3/12.3.2_FDT_7_a_iv.js
@@ -0,0 +1,32 @@
+// Copyright 2012 Mozilla Corporation. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/**
+ * @description Tests that format uses a proleptic Gregorian calendar with no year 0.
+ * @author Norbert Lindenberg
+ */
+
+var dates = [
+ 0, // January 1, 1970
+ -62151602400000, // in June 1 BC
+ -8640000000000000 // beginning of ECMAScript time
+];
+
+var format = new Intl.DateTimeFormat(["en-US"], {year: "numeric", month: "long", timeZone: "UTC"});
+
+// this test requires a Gregorian calendar, which we usually find in the US
+if (format.resolvedOptions().calendar !== "gregory") {
+ $ERROR("Internal error: Didn't find Gregorian calendar");
+}
+
+dates.forEach(function (date) {
+ var year = new Date(date).getUTCFullYear();
+ var expectedYear = year <= 0 ? 1 - year : year;
+ var expectedYearString = expectedYear.toLocaleString(["en-US"], {useGrouping: false});
+ var dateString = format.format(date);
+ if (dateString.indexOf(expectedYearString) === -1) {
+ $ERROR("Formatted year doesn't contain expected year – expected " +
+ expectedYearString + ", got " + dateString + ".");
+ }
+});
+
diff --git a/test/suite/intl402/ch13/13.1/13.1.1_7.js b/test/suite/intl402/ch13/13.1/13.1.1_7.js
index 417c5d2e2..f0c588f64 100644
--- a/test/suite/intl402/ch13/13.1/13.1.1_7.js
+++ b/test/suite/intl402/ch13/13.1/13.1.1_7.js
@@ -8,7 +8,7 @@
$INCLUDE("testIntl.js");
-var strings = ["d", "O", "od", "oe", "of", "ö", "o\u0308", "X", "y", "Z", "Z.", "\uD842\uDFB7野家", "吉野家", "!A", "A", "b", "C"];
+var strings = ["d", "O", "od", "oe", "of", "ö", "o\u0308", "X", "y", "Z", "Z.", "𠮷野家", "吉野家", "!A", "A", "b", "C"];
var locales = [undefined, ["de"], ["de-u-co-phonebk"], ["en"], ["ja"], ["sv"]];
var options = [
undefined,