Bug 1212076 - Make unit tests for timezone definition work; r=philipp
This commit is contained in:
Родитель
4c92473d78
Коммит
a289f0830d
|
@ -0,0 +1,551 @@
|
|||
{
|
||||
"version": "2.2015e",
|
||||
"aliases": [
|
||||
"AUS Central Standard Time",
|
||||
"AUS Eastern Standard Time",
|
||||
"Afghanistan Standard Time",
|
||||
"Africa/Asmera",
|
||||
"Africa/Timbuktu",
|
||||
"Alaskan Standard Time",
|
||||
"America/Argentina/ComodRivadavia",
|
||||
"America/Buenos_Aires",
|
||||
"America/Louisville",
|
||||
"America/Montreal",
|
||||
"Arab Standard Time",
|
||||
"Arabian Standard Time",
|
||||
"Arabic Standard Time",
|
||||
"Argentina Standard Time",
|
||||
"Asia/Calcutta",
|
||||
"Asia/Katmandu",
|
||||
"Asia/Saigon",
|
||||
"Atlantic Standard Time",
|
||||
"Atlantic/Faeroe",
|
||||
"Atlantic/Jan_Mayen",
|
||||
"Azerbaijan Standard Time",
|
||||
"Azores Standard Time",
|
||||
"Bahia Standard Time",
|
||||
"Bangladesh Standard Time",
|
||||
"Belarus Standard Time",
|
||||
"Canada Central Standard Time",
|
||||
"Cape Verde Standard Time",
|
||||
"Caucasus Standard Time",
|
||||
"Cen. Australia Standard Time",
|
||||
"Central America Standard Time",
|
||||
"Central Asia Standard Time",
|
||||
"Central Brazilian Standard Time",
|
||||
"Central Europe Standard Time",
|
||||
"Central European Standard Time",
|
||||
"Central Pacific Standard Time",
|
||||
"Central Standard Time",
|
||||
"Central Standard Time (Mexico)",
|
||||
"China Standard Time",
|
||||
"E. Africa Standard Time",
|
||||
"E. Australia Standard Time",
|
||||
"E. South America Standard Time",
|
||||
"Eastern Standard Time",
|
||||
"Egypt Standard Time",
|
||||
"Ekaterinburg Standard Time",
|
||||
"Etc/GMT",
|
||||
"Etc/GMT+0",
|
||||
"Etc/UCT",
|
||||
"Etc/UTC",
|
||||
"Etc/Unversal",
|
||||
"Etc/Zulu",
|
||||
"Europe/Belfast",
|
||||
"FLE Standard Time",
|
||||
"Fiji Standard Time",
|
||||
"GMT",
|
||||
"GMT Standard Time",
|
||||
"GMT+0",
|
||||
"GMT0",
|
||||
"GTB Standard Time",
|
||||
"Georgian Standard Time",
|
||||
"Greenland Standard Time",
|
||||
"Greenwich",
|
||||
"Greenwich Standard Time",
|
||||
"Hawaiian Standard Time",
|
||||
"India Standard Time",
|
||||
"Iran Standard Time",
|
||||
"Israel Standard Time",
|
||||
"Jordan Standard Time",
|
||||
"Kaliningrad Standard Time",
|
||||
"Korea Standard Time",
|
||||
"Libya Standard Time",
|
||||
"Line Islands Standard Time",
|
||||
"Magadan Standard Time",
|
||||
"Mauritius Standard Time",
|
||||
"Middle East Standard Time",
|
||||
"Montevideo Standard Time",
|
||||
"Morocco Standard Time",
|
||||
"Mountain Standard Time",
|
||||
"Mountain Standard Time (Mexico)",
|
||||
"Myanmar Standard Time",
|
||||
"N. Central Asia Standard Time",
|
||||
"Namibia Standard Time",
|
||||
"Nepal Standard Time",
|
||||
"New Zealand Standard Time",
|
||||
"Newfoundland Standard Time",
|
||||
"North Asia East Standard Time",
|
||||
"North Asia Standard Time",
|
||||
"Pacific SA Standard Time",
|
||||
"Pacific Standard Time",
|
||||
"Pacific Standard Time (Mexico)",
|
||||
"Pakistan Standard Time",
|
||||
"Paraguay Standard Time",
|
||||
"Romance Standard Time",
|
||||
"Russia Time Zone 10",
|
||||
"Russia Time Zone 11",
|
||||
"Russia Time Zone 3",
|
||||
"Russian Standard Time",
|
||||
"SA Eastern Standard Time",
|
||||
"SA Pacific Standard Time",
|
||||
"SA Western Standard Time",
|
||||
"SE Asia Standard Time",
|
||||
"Samoa Standard Time",
|
||||
"Singapore Standard Time",
|
||||
"South Africa Standard Time",
|
||||
"Sri Lanka Standard Time",
|
||||
"Syria Standard Time",
|
||||
"Taipei Standard Time",
|
||||
"Tasmania Standard Time",
|
||||
"Tokyo Standard Time",
|
||||
"Tonga Standard Time",
|
||||
"Turkey Standard Time",
|
||||
"UCT",
|
||||
"US Eastern Standard Time",
|
||||
"US Mountain Standard Time",
|
||||
"Ulaanbaatar Standard Time",
|
||||
"Universal",
|
||||
"Venezuela Standard Time",
|
||||
"Vladivostok Standard Time",
|
||||
"W. Australia Standard Time",
|
||||
"W. Central Africa Standard Time",
|
||||
"W. Europe Standard Time",
|
||||
"West Asia Standard Time",
|
||||
"West Pacific Standard Time",
|
||||
"Yakutsk Standard Time",
|
||||
"Z",
|
||||
"Zulu",
|
||||
"utc"
|
||||
],
|
||||
"zones": [
|
||||
"Africa/Abidjan",
|
||||
"Africa/Accra",
|
||||
"Africa/Addis_Ababa",
|
||||
"Africa/Algiers",
|
||||
"Africa/Asmara",
|
||||
"Africa/Bamako",
|
||||
"Africa/Bangui",
|
||||
"Africa/Banjul",
|
||||
"Africa/Bissau",
|
||||
"Africa/Blantyre",
|
||||
"Africa/Brazzaville",
|
||||
"Africa/Bujumbura",
|
||||
"Africa/Cairo",
|
||||
"Africa/Casablanca",
|
||||
"Africa/Ceuta",
|
||||
"Africa/Conakry",
|
||||
"Africa/Dakar",
|
||||
"Africa/Dar_es_Salaam",
|
||||
"Africa/Djibouti",
|
||||
"Africa/Douala",
|
||||
"Africa/El_Aaiun",
|
||||
"Africa/Freetown",
|
||||
"Africa/Gaborone",
|
||||
"Africa/Harare",
|
||||
"Africa/Johannesburg",
|
||||
"Africa/Juba",
|
||||
"Africa/Kampala",
|
||||
"Africa/Khartoum",
|
||||
"Africa/Kigali",
|
||||
"Africa/Kinshasa",
|
||||
"Africa/Lagos",
|
||||
"Africa/Libreville",
|
||||
"Africa/Lome",
|
||||
"Africa/Luanda",
|
||||
"Africa/Lubumbashi",
|
||||
"Africa/Lusaka",
|
||||
"Africa/Malabo",
|
||||
"Africa/Maputo",
|
||||
"Africa/Maseru",
|
||||
"Africa/Mbabane",
|
||||
"Africa/Mogadishu",
|
||||
"Africa/Monrovia",
|
||||
"Africa/Nairobi",
|
||||
"Africa/Ndjamena",
|
||||
"Africa/Niamey",
|
||||
"Africa/Nouakchott",
|
||||
"Africa/Ouagadougou",
|
||||
"Africa/Porto-Novo",
|
||||
"Africa/Sao_Tome",
|
||||
"Africa/Tripoli",
|
||||
"Africa/Tunis",
|
||||
"Africa/Windhoek",
|
||||
"America/Adak",
|
||||
"America/Anchorage",
|
||||
"America/Anguilla",
|
||||
"America/Antigua",
|
||||
"America/Araguaina",
|
||||
"America/Argentina/Buenos_Aires",
|
||||
"America/Argentina/Catamarca",
|
||||
"America/Argentina/Cordoba",
|
||||
"America/Argentina/Jujuy",
|
||||
"America/Argentina/La_Rioja",
|
||||
"America/Argentina/Mendoza",
|
||||
"America/Argentina/Rio_Gallegos",
|
||||
"America/Argentina/Salta",
|
||||
"America/Argentina/San_Juan",
|
||||
"America/Argentina/San_Luis",
|
||||
"America/Argentina/Tucuman",
|
||||
"America/Argentina/Ushuaia",
|
||||
"America/Aruba",
|
||||
"America/Asuncion",
|
||||
"America/Atikokan",
|
||||
"America/Bahia",
|
||||
"America/Bahia_Banderas",
|
||||
"America/Barbados",
|
||||
"America/Belem",
|
||||
"America/Belize",
|
||||
"America/Blanc-Sablon",
|
||||
"America/Boa_Vista",
|
||||
"America/Bogota",
|
||||
"America/Boise",
|
||||
"America/Cambridge_Bay",
|
||||
"America/Campo_Grande",
|
||||
"America/Cancun",
|
||||
"America/Caracas",
|
||||
"America/Cayenne",
|
||||
"America/Cayman",
|
||||
"America/Chicago",
|
||||
"America/Chihuahua",
|
||||
"America/Costa_Rica",
|
||||
"America/Creston",
|
||||
"America/Cuiaba",
|
||||
"America/Curacao",
|
||||
"America/Danmarkshavn",
|
||||
"America/Dawson",
|
||||
"America/Dawson_Creek",
|
||||
"America/Denver",
|
||||
"America/Detroit",
|
||||
"America/Dominica",
|
||||
"America/Edmonton",
|
||||
"America/Eirunepe",
|
||||
"America/El_Salvador",
|
||||
"America/Fortaleza",
|
||||
"America/Glace_Bay",
|
||||
"America/Godthab",
|
||||
"America/Goose_Bay",
|
||||
"America/Grand_Turk",
|
||||
"America/Grenada",
|
||||
"America/Guadeloupe",
|
||||
"America/Guatemala",
|
||||
"America/Guayaquil",
|
||||
"America/Guyana",
|
||||
"America/Halifax",
|
||||
"America/Havana",
|
||||
"America/Hermosillo",
|
||||
"America/Indiana/Indianapolis",
|
||||
"America/Indiana/Knox",
|
||||
"America/Indiana/Marengo",
|
||||
"America/Indiana/Petersburg",
|
||||
"America/Indiana/Tell_City",
|
||||
"America/Indiana/Vevay",
|
||||
"America/Indiana/Vincennes",
|
||||
"America/Indiana/Winamac",
|
||||
"America/Inuvik",
|
||||
"America/Iqaluit",
|
||||
"America/Jamaica",
|
||||
"America/Juneau",
|
||||
"America/Kentucky/Louisville",
|
||||
"America/Kentucky/Monticello",
|
||||
"America/Kralendijk",
|
||||
"America/La_Paz",
|
||||
"America/Lima",
|
||||
"America/Los_Angeles",
|
||||
"America/Lower_Princes",
|
||||
"America/Maceio",
|
||||
"America/Managua",
|
||||
"America/Manaus",
|
||||
"America/Marigot",
|
||||
"America/Martinique",
|
||||
"America/Matamoros",
|
||||
"America/Mazatlan",
|
||||
"America/Menominee",
|
||||
"America/Merida",
|
||||
"America/Metlakatla",
|
||||
"America/Mexico_City",
|
||||
"America/Miquelon",
|
||||
"America/Moncton",
|
||||
"America/Monterrey",
|
||||
"America/Montevideo",
|
||||
"America/Montserrat",
|
||||
"America/Nassau",
|
||||
"America/New_York",
|
||||
"America/Nipigon",
|
||||
"America/Nome",
|
||||
"America/Noronha",
|
||||
"America/North_Dakota/Beulah",
|
||||
"America/North_Dakota/Center",
|
||||
"America/North_Dakota/New_Salem",
|
||||
"America/Ojinaga",
|
||||
"America/Panama",
|
||||
"America/Pangnirtung",
|
||||
"America/Paramaribo",
|
||||
"America/Phoenix",
|
||||
"America/Port-au-Prince",
|
||||
"America/Port_of_Spain",
|
||||
"America/Porto_Velho",
|
||||
"America/Puerto_Rico",
|
||||
"America/Rainy_River",
|
||||
"America/Rankin_Inlet",
|
||||
"America/Recife",
|
||||
"America/Regina",
|
||||
"America/Resolute",
|
||||
"America/Rio_Branco",
|
||||
"America/Santa_Isabel",
|
||||
"America/Santarem",
|
||||
"America/Santiago",
|
||||
"America/Santo_Domingo",
|
||||
"America/Sao_Paulo",
|
||||
"America/Scoresbysund",
|
||||
"America/Sitka",
|
||||
"America/St_Barthelemy",
|
||||
"America/St_Johns",
|
||||
"America/St_Kitts",
|
||||
"America/St_Lucia",
|
||||
"America/St_Thomas",
|
||||
"America/St_Vincent",
|
||||
"America/Swift_Current",
|
||||
"America/Tegucigalpa",
|
||||
"America/Thule",
|
||||
"America/Thunder_Bay",
|
||||
"America/Tijuana",
|
||||
"America/Toronto",
|
||||
"America/Tortola",
|
||||
"America/Vancouver",
|
||||
"America/Whitehorse",
|
||||
"America/Winnipeg",
|
||||
"America/Yakutat",
|
||||
"America/Yellowknife",
|
||||
"Antarctica/Casey",
|
||||
"Antarctica/Davis",
|
||||
"Antarctica/DumontDUrville",
|
||||
"Antarctica/Macquarie",
|
||||
"Antarctica/Mawson",
|
||||
"Antarctica/McMurdo",
|
||||
"Antarctica/Palmer",
|
||||
"Antarctica/Rothera",
|
||||
"Antarctica/Syowa",
|
||||
"Antarctica/Troll",
|
||||
"Antarctica/Vostok",
|
||||
"Arctic/Longyearbyen",
|
||||
"Asia/Aden",
|
||||
"Asia/Almaty",
|
||||
"Asia/Amman",
|
||||
"Asia/Anadyr",
|
||||
"Asia/Aqtau",
|
||||
"Asia/Aqtobe",
|
||||
"Asia/Ashgabat",
|
||||
"Asia/Baghdad",
|
||||
"Asia/Bahrain",
|
||||
"Asia/Baku",
|
||||
"Asia/Bangkok",
|
||||
"Asia/Beirut",
|
||||
"Asia/Bishkek",
|
||||
"Asia/Brunei",
|
||||
"Asia/Chita",
|
||||
"Asia/Choibalsan",
|
||||
"Asia/Colombo",
|
||||
"Asia/Damascus",
|
||||
"Asia/Dhaka",
|
||||
"Asia/Dili",
|
||||
"Asia/Dubai",
|
||||
"Asia/Dushanbe",
|
||||
"Asia/Gaza",
|
||||
"Asia/Hebron",
|
||||
"Asia/Ho_Chi_Minh",
|
||||
"Asia/Hong_Kong",
|
||||
"Asia/Hovd",
|
||||
"Asia/Irkutsk",
|
||||
"Asia/Istanbul",
|
||||
"Asia/Jakarta",
|
||||
"Asia/Jayapura",
|
||||
"Asia/Jerusalem",
|
||||
"Asia/Kabul",
|
||||
"Asia/Kamchatka",
|
||||
"Asia/Karachi",
|
||||
"Asia/Kathmandu",
|
||||
"Asia/Khandyga",
|
||||
"Asia/Kolkata",
|
||||
"Asia/Krasnoyarsk",
|
||||
"Asia/Kuala_Lumpur",
|
||||
"Asia/Kuching",
|
||||
"Asia/Kuwait",
|
||||
"Asia/Macau",
|
||||
"Asia/Magadan",
|
||||
"Asia/Makassar",
|
||||
"Asia/Manila",
|
||||
"Asia/Muscat",
|
||||
"Asia/Nicosia",
|
||||
"Asia/Novokuznetsk",
|
||||
"Asia/Novosibirsk",
|
||||
"Asia/Omsk",
|
||||
"Asia/Oral",
|
||||
"Asia/Phnom_Penh",
|
||||
"Asia/Pontianak",
|
||||
"Asia/Pyongyang",
|
||||
"Asia/Qatar",
|
||||
"Asia/Qyzylorda",
|
||||
"Asia/Rangoon",
|
||||
"Asia/Riyadh",
|
||||
"Asia/Sakhalin",
|
||||
"Asia/Samarkand",
|
||||
"Asia/Seoul",
|
||||
"Asia/Shanghai",
|
||||
"Asia/Singapore",
|
||||
"Asia/Srednekolymsk",
|
||||
"Asia/Taipei",
|
||||
"Asia/Tashkent",
|
||||
"Asia/Tbilisi",
|
||||
"Asia/Tehran",
|
||||
"Asia/Thimphu",
|
||||
"Asia/Tokyo",
|
||||
"Asia/Ulaanbaatar",
|
||||
"Asia/Urumqi",
|
||||
"Asia/Ust-Nera",
|
||||
"Asia/Vientiane",
|
||||
"Asia/Vladivostok",
|
||||
"Asia/Yakutsk",
|
||||
"Asia/Yekaterinburg",
|
||||
"Asia/Yerevan",
|
||||
"Atlantic/Azores",
|
||||
"Atlantic/Bermuda",
|
||||
"Atlantic/Canary",
|
||||
"Atlantic/Cape_Verde",
|
||||
"Atlantic/Faroe",
|
||||
"Atlantic/Madeira",
|
||||
"Atlantic/Reykjavik",
|
||||
"Atlantic/South_Georgia",
|
||||
"Atlantic/St_Helena",
|
||||
"Atlantic/Stanley",
|
||||
"Australia/Adelaide",
|
||||
"Australia/Brisbane",
|
||||
"Australia/Broken_Hill",
|
||||
"Australia/Currie",
|
||||
"Australia/Darwin",
|
||||
"Australia/Eucla",
|
||||
"Australia/Hobart",
|
||||
"Australia/Lindeman",
|
||||
"Australia/Lord_Howe",
|
||||
"Australia/Melbourne",
|
||||
"Australia/Perth",
|
||||
"Australia/Sydney",
|
||||
"Europe/Amsterdam",
|
||||
"Europe/Andorra",
|
||||
"Europe/Athens",
|
||||
"Europe/Belgrade",
|
||||
"Europe/Berlin",
|
||||
"Europe/Bratislava",
|
||||
"Europe/Brussels",
|
||||
"Europe/Bucharest",
|
||||
"Europe/Budapest",
|
||||
"Europe/Busingen",
|
||||
"Europe/Chisinau",
|
||||
"Europe/Copenhagen",
|
||||
"Europe/Dublin",
|
||||
"Europe/Gibraltar",
|
||||
"Europe/Guernsey",
|
||||
"Europe/Helsinki",
|
||||
"Europe/Isle_of_Man",
|
||||
"Europe/Istanbul",
|
||||
"Europe/Jersey",
|
||||
"Europe/Kaliningrad",
|
||||
"Europe/Kiev",
|
||||
"Europe/Lisbon",
|
||||
"Europe/Ljubljana",
|
||||
"Europe/London",
|
||||
"Europe/Luxembourg",
|
||||
"Europe/Madrid",
|
||||
"Europe/Malta",
|
||||
"Europe/Mariehamn",
|
||||
"Europe/Minsk",
|
||||
"Europe/Monaco",
|
||||
"Europe/Moscow",
|
||||
"Europe/Nicosia",
|
||||
"Europe/Oslo",
|
||||
"Europe/Paris",
|
||||
"Europe/Podgorica",
|
||||
"Europe/Prague",
|
||||
"Europe/Riga",
|
||||
"Europe/Rome",
|
||||
"Europe/Samara",
|
||||
"Europe/San_Marino",
|
||||
"Europe/Sarajevo",
|
||||
"Europe/Simferopol",
|
||||
"Europe/Skopje",
|
||||
"Europe/Sofia",
|
||||
"Europe/Stockholm",
|
||||
"Europe/Tallinn",
|
||||
"Europe/Tirane",
|
||||
"Europe/Uzhgorod",
|
||||
"Europe/Vaduz",
|
||||
"Europe/Vatican",
|
||||
"Europe/Vienna",
|
||||
"Europe/Vilnius",
|
||||
"Europe/Volgograd",
|
||||
"Europe/Warsaw",
|
||||
"Europe/Zagreb",
|
||||
"Europe/Zaporozhye",
|
||||
"Europe/Zurich",
|
||||
"Indian/Antananarivo",
|
||||
"Indian/Chagos",
|
||||
"Indian/Christmas",
|
||||
"Indian/Cocos",
|
||||
"Indian/Comoro",
|
||||
"Indian/Kerguelen",
|
||||
"Indian/Mahe",
|
||||
"Indian/Maldives",
|
||||
"Indian/Mauritius",
|
||||
"Indian/Mayotte",
|
||||
"Indian/Reunion",
|
||||
"Pacific/Apia",
|
||||
"Pacific/Auckland",
|
||||
"Pacific/Bougainville",
|
||||
"Pacific/Chatham",
|
||||
"Pacific/Chuuk",
|
||||
"Pacific/Easter",
|
||||
"Pacific/Efate",
|
||||
"Pacific/Enderbury",
|
||||
"Pacific/Fakaofo",
|
||||
"Pacific/Fiji",
|
||||
"Pacific/Funafuti",
|
||||
"Pacific/Galapagos",
|
||||
"Pacific/Gambier",
|
||||
"Pacific/Guadalcanal",
|
||||
"Pacific/Guam",
|
||||
"Pacific/Honolulu",
|
||||
"Pacific/Johnston",
|
||||
"Pacific/Kiritimati",
|
||||
"Pacific/Kosrae",
|
||||
"Pacific/Kwajalein",
|
||||
"Pacific/Majuro",
|
||||
"Pacific/Marquesas",
|
||||
"Pacific/Midway",
|
||||
"Pacific/Nauru",
|
||||
"Pacific/Niue",
|
||||
"Pacific/Norfolk",
|
||||
"Pacific/Noumea",
|
||||
"Pacific/Pago_Pago",
|
||||
"Pacific/Palau",
|
||||
"Pacific/Pitcairn",
|
||||
"Pacific/Pohnpei",
|
||||
"Pacific/Port_Moresby",
|
||||
"Pacific/Rarotonga",
|
||||
"Pacific/Saipan",
|
||||
"Pacific/Tahiti",
|
||||
"Pacific/Tarawa",
|
||||
"Pacific/Tongatapu",
|
||||
"Pacific/Wake",
|
||||
"Pacific/Wallis"
|
||||
]
|
||||
}
|
|
@ -4,6 +4,7 @@
|
|||
|
||||
Components.utils.import("resource://gre/modules/Services.jsm");
|
||||
Components.utils.import("resource://gre/modules/Preferences.jsm");
|
||||
Components.utils.import("resource://gre/modules/FileUtils.jsm");
|
||||
|
||||
Components.utils.import("resource://testing-common/AppInfo.jsm");
|
||||
updateAppInfo();
|
||||
|
@ -186,3 +187,21 @@ function compareItemsSpecific(aLeftItem, aRightItem, aPropArray) {
|
|||
function ics_unfoldline(aLine) {
|
||||
return aLine.replace(/\r?\n[ \t]/g, "");
|
||||
}
|
||||
|
||||
/**
|
||||
* Read a JSON file and return the JS object
|
||||
*/
|
||||
function readJSONFile(aFile) {
|
||||
let stream = Cc["@mozilla.org/network/file-input-stream;1"].createInstance(Ci.nsIFileInputStream);
|
||||
try {
|
||||
stream.init(aFile, FileUtils.MODE_RDONLY, FileUtils.PERMS_FILE, 0);
|
||||
let json = Cc["@mozilla.org/dom/json;1"].createInstance(Components.interfaces.nsIJSON);
|
||||
let data = json.decodeFromStream(stream, stream.available());
|
||||
return data;
|
||||
} catch(ex) {
|
||||
dump("readJSONFile: Error reading JSON file: " + ex);
|
||||
} finally {
|
||||
stream.close();
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -10,21 +10,30 @@ function run_test() {
|
|||
}});
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks whether the pased string is a valid tz version number
|
||||
* @param {String} aVersionString
|
||||
* @returns {boolean}
|
||||
*/
|
||||
function valid_tz_version(aVersionString) {
|
||||
return (aVersionString.match(/^2\.(\d{4})(z*[a-z])$/));
|
||||
}
|
||||
|
||||
//check tz database version
|
||||
add_task(function* version_test() {
|
||||
let tzs = cal.getTimezoneService();
|
||||
notEqual(tzs.version, null, "Checking for a timezone version");
|
||||
ok(valid_tz_version(tzs.version), "timezone version");
|
||||
});
|
||||
|
||||
//check whether all tz definitions have all properties
|
||||
add_task(function* zone_test() {
|
||||
function resolveZone(aZoneId) {
|
||||
let tz = tzs.getTimezone(aZoneId);
|
||||
notEqual(tz, null, aZoneId + "exists");
|
||||
equal(aZoneId, tz.tzid, "Zone test " + aZoneId);
|
||||
ok(tz.icalComponent.serializeToICS().startsWith("BEGIN:VTIMEZONE"),
|
||||
"ics property contains VTIMEZONE for " + aZoneId);
|
||||
ok(tz.latitude && !!tz.latitude.match(/^[+-]\d{7}$/), "Correct latitude on " + aZoneId);
|
||||
ok(tz.longitude && !!tz.longitude.match(/^[+-]\d{7}$/), "Correct longitude on " + aZoneId);
|
||||
"VTIMEZONE test " + aZoneId);
|
||||
ok(tz.latitude && !!tz.latitude.match(/^[+-]\d{7}$/), "Latitude test " + aZoneId);
|
||||
ok(tz.longitude && !!tz.longitude.match(/^[+-]\d{7}$/), "Longitude test " + aZoneId);
|
||||
}
|
||||
|
||||
let tzs = cal.getTimezoneService();
|
||||
|
@ -39,14 +48,15 @@ add_task(function* zone_test() {
|
|||
});
|
||||
|
||||
// check whether all tz aliases resolve to a tz definition
|
||||
add_task(function alias_test() {
|
||||
add_task(function* alias_test() {
|
||||
function resolveAlias(aAliasId) {
|
||||
let tz = tzs.getTimezone(aAliasId);
|
||||
notEqual(tz, null, "Zone " + aAliasId + " exists in " + tzs.version);
|
||||
let tzid = tz && tz.tzid ? tz.tzid : "";
|
||||
notEqual(tzid, "", "Alias resolution " + aAliasId + " -> " + tzid);
|
||||
}
|
||||
|
||||
let tzs = cal.getTimezoneService();
|
||||
let aliases = tzs.aliasIds;
|
||||
|
||||
let foundAlias = false;
|
||||
while (aliases.hasMore()) {
|
||||
foundAlias = true;
|
||||
|
@ -55,3 +65,53 @@ add_task(function alias_test() {
|
|||
|
||||
ok(foundAlias, "There is at least one alias");
|
||||
});
|
||||
|
||||
// Check completeness to avoid unintended removing of zones/aliases when updating zones.json
|
||||
// removed zones should at least remain as alias to not break UI like in bug 1210723.
|
||||
// previous.json is generated automatically by executing update-zones.py script
|
||||
add_task(function* completeness_test() {
|
||||
let jsonFile = do_get_file("data/previous.json");
|
||||
let test = readJSONFile(jsonFile);
|
||||
ok(test, "previous.json was loaded for completeness test");
|
||||
|
||||
if (test) {
|
||||
// we check for valid version number of test data only - version number of tzs.version was
|
||||
// already checked in a separate test
|
||||
ok(valid_tz_version(test.version), "test data version.");
|
||||
// update-zones.py may create a dummy set of test data based on the current tz version for
|
||||
// convenience, that must not be used without being modified manually to comply with a
|
||||
// previous tz version.
|
||||
notEqual(test.version, "2.1969z", "Check for dummy test data.");
|
||||
let tzs = cal.getTimezoneService();
|
||||
let comp = Services.vc.compare(test.version, tzs.version);
|
||||
|
||||
// some checks on the test data
|
||||
if (comp != -1) {
|
||||
switch(comp) {
|
||||
case 0:
|
||||
do_print("Test data and timezone service use the same timezone version.");
|
||||
break;
|
||||
case 1:
|
||||
do_print("Test data use a newer timezone version than the timezone service.");
|
||||
break;
|
||||
}
|
||||
do_print("test data: " + test.version);
|
||||
do_print("tz service: " + tzs.version);
|
||||
do_print("This indicates a problem in update-zones.py or manually additions to" +
|
||||
"zones.json or previous.json");
|
||||
}
|
||||
equal(comp, -1, "timezone version of test data is older than the currently used version.");
|
||||
ok(test.aliases && test.aliases.length > 0, "test data have aliases.");
|
||||
ok(test.zones && test.zones.length > 0, "test data have zones.");
|
||||
|
||||
// completeness check for aliases and zones (this covers also cases, when a previous zone
|
||||
// definition got transformed into alias linked to a valid zone - so, there's no need for
|
||||
// separate test step to cover that)
|
||||
for (let alias of test.aliases) {
|
||||
notEqual(tzs.getTimezone(alias), null, "Test Alias " + alias + " from " + test.version);
|
||||
}
|
||||
for (let zone of test.zones) {
|
||||
notEqual(tzs.getTimezone(zone), null, "Test Zone " + zone + " from " + test.version);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
|
|
@ -4,5 +4,6 @@ head = head_icaljs.js head_consts.js
|
|||
tail =
|
||||
run-sequentially = Avoid bustage.
|
||||
dupe-manifest =
|
||||
support-files = data/**
|
||||
|
||||
[include:xpcshell-shared.ini]
|
||||
|
|
|
@ -4,5 +4,6 @@ head = head_libical.js head_consts.js
|
|||
tail =
|
||||
run-sequentially = Avoid bustage.
|
||||
dupe-manifest =
|
||||
support-files = data/**
|
||||
|
||||
[include:xpcshell-shared.ini]
|
||||
|
|
|
@ -10,6 +10,9 @@ This script allows updating Lightning's zones.json.
|
|||
You can also have the latest tzdata downloaded automatically:
|
||||
python update-zones.py --vzic /path/to/tzurl/vzic
|
||||
|
||||
IMPORTANT: Make sure your local copy of zones.json is in sync with Hg before running this script.
|
||||
Otherwise manual corrections will get dropped when pushing the update.
|
||||
|
||||
"""
|
||||
|
||||
import argparse, ftplib, json, os, os.path, re, shutil, subprocess, sys, tarfile, tempfile
|
||||
|
@ -195,6 +198,7 @@ class TimezoneUpdater(object):
|
|||
|
||||
def run(self, zones_json_file, tzprops_file, vzic_path):
|
||||
"""Run the timezone updater, with a zones.json file and the path to vzic"""
|
||||
|
||||
need_download_tzdata = self.tzdata_path is None
|
||||
if need_download_tzdata:
|
||||
self.download_tzdata()
|
||||
|
@ -217,7 +221,7 @@ class TimezoneUpdater(object):
|
|||
newzones = self.read_dir(self.zoneinfo_path,
|
||||
lambda fn: self.read_ics(fn, lat_long_data))
|
||||
|
||||
newaliases = self.link_removed_zones(zonesjson['zones'], newzones, links)
|
||||
newaliases = self.link_removed_zones(zonesjson["zones"], newzones, links)
|
||||
zonesjson["aliases"].update(newaliases)
|
||||
|
||||
self.update_timezones_properties(tzprops_file, version, newzones, zonesjson["aliases"])
|
||||
|
@ -240,6 +244,52 @@ def parse_args():
|
|||
will be downloaded from ftp.iana.org.""")
|
||||
return parser.parse_args()
|
||||
|
||||
def create_test_data(zones_file):
|
||||
"""Creating test data."""
|
||||
|
||||
previous_file = os.path.join(os.path.dirname(os.path.realpath(__file__)),
|
||||
"..", "test", "data", "previous.json")
|
||||
|
||||
previous_version = "no previous version"
|
||||
current_version = "no current version"
|
||||
if (os.path.isfile(zones_file) and os.access(zones_file, os.R_OK)):
|
||||
with open(zones_file, "r") as rzf:
|
||||
current_data = json.load(rzf)
|
||||
current_version = current_data["version"]
|
||||
current_zones = current_data["zones"]
|
||||
current_aliases = current_data["aliases"]
|
||||
if (os.path.isfile(previous_file) and os.access(previous_file, os.R_OK)):
|
||||
with open(previous_file, "r") as rpf:
|
||||
previous_data = json.load(rpf)
|
||||
previous_version = previous_data["version"]
|
||||
|
||||
if (current_version == "no current version"):
|
||||
"""Test data creation not possible - currently no zones.json file available."""
|
||||
|
||||
elif (current_version != previous_version):
|
||||
"""Extracting data from zones.json"""
|
||||
|
||||
test_aliases = current_aliases.keys()
|
||||
test_zones = current_zones.keys()
|
||||
|
||||
test_data = OrderedDict()
|
||||
test_data["version"] = current_version
|
||||
test_data["aliases"] = OrderedDict(sorted(test_aliases.items()))
|
||||
test_data["zones"] = OrderedDict(sorted(test_zones.items()))
|
||||
|
||||
"""Writing test data"""
|
||||
with open(previous_file, "w") as wpf:
|
||||
json.dump(test_data, wpf, indent=2, separators=(",", ": "))
|
||||
wpf.write("\n")
|
||||
|
||||
"""Please run calendar xpshell test 'test_timezone_definition.js' to check the updated
|
||||
timezone definition for any glitches."""
|
||||
|
||||
else:
|
||||
# This may happen if the script is executed multiple times without new tzdata available
|
||||
"""Skipping test data creation.
|
||||
Test data are already available for the current version of zones.json"""
|
||||
|
||||
def main():
|
||||
"""Run the timezone updater from command-line args"""
|
||||
args = parse_args()
|
||||
|
@ -247,6 +297,10 @@ def main():
|
|||
tzprops_file = os.path.join(os.path.dirname(os.path.realpath(__file__)),
|
||||
"..", "locales", "en-US", "chrome", "calendar",
|
||||
"timezones.properties")
|
||||
|
||||
# A test data update must occur before the zones.json file gets updated to have meaningful data
|
||||
create_test_data(json_file)
|
||||
|
||||
zoneinfo_path = tempfile.mkdtemp(prefix="zones")
|
||||
zoneinfo_pure_path = tempfile.mkdtemp(prefix="zones")
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче