Thu, 15 Jan 2015 15:55:04 +0100
Back out 97036ab72558 which inappropriately compared turds to third parties.
1 // Copyright 2012 Mozilla Corporation. All rights reserved.
2 // This code is governed by the license found in the LICENSE file.
4 /**
5 * @description Tests that the object returned by Intl.DateTimeFormat.prototype.resolvedOptions
6 * has the right properties.
7 * @author Norbert Lindenberg
8 */
10 $INCLUDE("testIntl.js");
12 var actual = new Intl.DateTimeFormat().resolvedOptions();
14 var actual2 = new Intl.DateTimeFormat().resolvedOptions();
15 if (actual2 === actual) {
16 $ERROR("resolvedOptions returned the same object twice.");
17 }
19 // source: CLDR file common/bcp47/calendar.xml; version CLDR 21.
20 var calendars = [
21 "buddhist",
22 "chinese",
23 "coptic",
24 "ethioaa",
25 "ethiopic",
26 "gregory",
27 "hebrew",
28 "indian",
29 "islamic",
30 "islamicc",
31 "iso8601",
32 "japanese",
33 "persian",
34 "roc"
35 ];
37 // this assumes the default values where the specification provides them
38 mustHaveProperty(actual, "locale", isCanonicalizedStructurallyValidLanguageTag);
39 mustHaveProperty(actual, "calendar", calendars);
40 mustHaveProperty(actual, "numberingSystem", isValidNumberingSystem);
41 mustHaveProperty(actual, "timeZone", [undefined]);
42 mustNotHaveProperty(actual, "weekday");
43 mustNotHaveProperty(actual, "era");
44 mustHaveProperty(actual, "year", ["2-digit", "numeric"]);
45 mustHaveProperty(actual, "month", ["2-digit", "numeric", "narrow", "short", "long"]);
46 mustHaveProperty(actual, "day", ["2-digit", "numeric"]);
47 mustNotHaveProperty(actual, "hour");
48 mustNotHaveProperty(actual, "minute");
49 mustNotHaveProperty(actual, "second");
50 mustNotHaveProperty(actual, "timeZoneName");
51 mustNotHaveProperty(actual, "hour12");