summaryrefslogtreecommitdiffstats
path: root/js/src/tests/test262/intl402/DateTimeFormat/constructor-options-timeZoneName-invalid.js
blob: 7c37e7c52301f247ef21df18966521b9f238b2eb (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
// Copyright 2021 the V8 project authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: sec-createdatetimeformat
description: >
  Invalid values for the `timeZoneName` option of the DateTimeFormat constructor
features: [Intl.DateTimeFormat-extend-timezonename]
---*/

assert.throws(RangeError, function () {
  new Intl.DateTimeFormat('en', { timeZoneName: '' });
}, 'empty string');

assert.throws(RangeError, function () {
  new Intl.DateTimeFormat('en', { timeZoneName: 'short ' });
}, '"short "');

assert.throws(RangeError, function () {
  new Intl.DateTimeFormat('en', { timeZoneName: ' long' });
}, '" long"');

assert.throws(RangeError, function () {
  new Intl.DateTimeFormat('en', { timeZoneName: 'offset' });
}, '"offset"');

assert.throws(RangeError, function () {
  new Intl.DateTimeFormat('en', { timeZoneName: 'generic' });
}, '"generic"');

reportCompare(0, 0);