mirror of https://github.com/tc39/test262.git
Add tests: "Extend TimeZoneName Option" proposal (#3042)
This commit is contained in:
parent
d15066ec39
commit
8faacdbaee
|
@ -0,0 +1,28 @@
|
||||||
|
// Copyright 2021 the V8 project authors. All rights reserved.
|
||||||
|
// This code is governed by the BSD license found in the LICENSE file.
|
||||||
|
/*---
|
||||||
|
esid: sec-initializedatetimeformat
|
||||||
|
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"');
|
|
@ -0,0 +1,28 @@
|
||||||
|
// Copyright 2021 the V8 project authors. All rights reserved.
|
||||||
|
// This code is governed by the BSD license found in the LICENSE file.
|
||||||
|
/*---
|
||||||
|
esid: sec-initializedatetimeformat
|
||||||
|
description:
|
||||||
|
Valid values for the `timeZoneName` option of the DateTimeFormat constructor
|
||||||
|
features: [Intl.DateTimeFormat-extend-timezonename]
|
||||||
|
---*/
|
||||||
|
|
||||||
|
var dtf;
|
||||||
|
|
||||||
|
dtf = new Intl.DateTimeFormat('en', { timeZoneName: 'short' });
|
||||||
|
assert.sameValue(dtf.resolvedOptions().timeZoneName, 'short');
|
||||||
|
|
||||||
|
dtf = new Intl.DateTimeFormat('en', { timeZoneName: 'long' });
|
||||||
|
assert.sameValue(dtf.resolvedOptions().timeZoneName, 'long');
|
||||||
|
|
||||||
|
dtf = new Intl.DateTimeFormat('en', { timeZoneName: 'shortOffset' });
|
||||||
|
assert.sameValue(dtf.resolvedOptions().timeZoneName, 'shortOffset');
|
||||||
|
|
||||||
|
dtf = new Intl.DateTimeFormat('en', { timeZoneName: 'longOffset' });
|
||||||
|
assert.sameValue(dtf.resolvedOptions().timeZoneName, 'longOffset');
|
||||||
|
|
||||||
|
dtf = new Intl.DateTimeFormat('en', { timeZoneName: 'shortGeneric' });
|
||||||
|
assert.sameValue(dtf.resolvedOptions().timeZoneName, 'shortGeneric');
|
||||||
|
|
||||||
|
dtf = new Intl.DateTimeFormat('en', { timeZoneName: 'longGeneric' });
|
||||||
|
assert.sameValue(dtf.resolvedOptions().timeZoneName, 'longGeneric');
|
Loading…
Reference in New Issue