js/src/tests/test262/intl402/ch12/12.3/12.3.3.js

branch
TOR_BUG_3246
changeset 6
8bccb770b82d
equal deleted inserted replaced
-1:000000000000 0:d1a0ed1a7228
1 // Copyright 2012 Mozilla Corporation. All rights reserved.
2 // This code is governed by the license found in the LICENSE file.
3
4 /**
5 * @description Tests that the object returned by Intl.DateTimeFormat.prototype.resolvedOptions
6 * has the right properties.
7 * @author Norbert Lindenberg
8 */
9
10 $INCLUDE("testIntl.js");
11
12 var actual = new Intl.DateTimeFormat().resolvedOptions();
13
14 var actual2 = new Intl.DateTimeFormat().resolvedOptions();
15 if (actual2 === actual) {
16 $ERROR("resolvedOptions returned the same object twice.");
17 }
18
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 ];
36
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");
52

mercurial