Debian Codegraph @

tests/auto/qml/ecmascripttests/test262/test/intl402/DateTimeFormat/timezone-invalid.js

raw
1 // Copyright 2012 Mozilla Corporation. All rights reserved.
2 // This code is governed by the BSD license found in the LICENSE file.
3
4 /*---
5 es5id: 6.4_b
6 description: Tests that invalid time zone names are not accepted.
7 author: Norbert Lindenberg
8 ---*/
9
10 var invalidTimeZoneNames = [
11 "",
12 "MEZ", // localized abbreviation
13 "Pacific Time", // localized long form
14 "cnsha", // BCP 47 time zone code
15 "invalid", // as the name says
16 "Europe/İstanbul", // non-ASCII letter
17 "asıa/baku", // non-ASCII letter
18 "europe/brußels" // non-ASCII letter
19 ];
20
21 invalidTimeZoneNames.forEach(function (name) {
22 // this must throw an exception for an invalid time zone name
23 assert.throws(RangeError, function() {
24 var format = new Intl.DateTimeFormat(["de-de"], {timeZone: name});
25 }, "Invalid time zone name " + name + " was not rejected.");
26 });