Temporal.now.timeZone: improve coverage

This commit is contained in:
Mike Pennisi 2021-05-28 20:41:18 -04:00 committed by rwaldron
parent 19c5e38118
commit 802f22bf0e
8 changed files with 104 additions and 0 deletions

View File

@ -335,3 +335,7 @@ json-modules
# Resizable Arraybuffer
# https://github.com/tc39/proposal-resizablearraybuffer
resizable-arraybuffer
# Temporal
# https://github.com/tc39/proposal-temporal
Temporal

View File

@ -0,0 +1,15 @@
// Copyright (C) 2021 the V8 project authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: sec-temporal.now.timezone
description: Temporal.now.timeZone is extensible.
info: |
## 17 ECMAScript Standard Built-in Objects
Unless specified otherwise, the [[Extensible]] internal slot
of a built-in object initially has the value true.
features: [Temporal]
---*/
assert(Object.isExtensible(Temporal.now.timeZone));

View File

@ -3,6 +3,7 @@
/*---
esid: sec-temporal.now.timezone
description: Temporal.now.timeZone.length is 0
info: |
Every built-in function object, including constructors, has a "length" property whose value is
an integer. Unless otherwise specified, this value is equal to the largest number of named
@ -13,6 +14,7 @@ info: |
Unless otherwise specified, the "length" property of a built-in function object has the
attributes { [[Writable]]: false, [[Enumerable]]: false, [[Configurable]]: true }.
includes: [propertyHelper.js]
features: [Temporal]
---*/
verifyProperty(Temporal.now.timeZone, "length", {

View File

@ -0,0 +1,26 @@
// Copyright (C) 2021 the V8 project authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: sec-temporal.now.timezone
description: Temporal.now.timeZone.name is "timeZone".
info: |
## 17 ECMAScript Standard Built-in Objects:
Every built-in Function object, including constructors, that is not
identified as an anonymous function has a name property whose value is a
String.
Unless otherwise specified, the name property of a built-in Function object,
if it exists, has the attributes { [[Writable]]: false, [[Enumerable]]:
false, [[Configurable]]: true }.
includes: [propertyHelper.js]
features: [Temporal]
---*/
assert.sameValue(Temporal.now.timeZone.name, 'timeZone');
verifyProperty(Temporal.now.timeZone, 'name', {
enumerable: false,
writable: false,
configurable: true
});

View File

@ -3,6 +3,8 @@
/*---
esid: sec-temporal.now.timezone
description: Each invocation of the function produces a distinct object value
features: [Temporal]
---*/
const tz = Temporal.now.timeZone;

View File

@ -0,0 +1,21 @@
// Copyright (C) 2021 the V8 project authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: sec-temporal.now.timezone
description: Temporal.now.timeZone does not implement [[Construct]]
info: |
ECMAScript Function Objects
Built-in function objects that are not identified as constructors do not
implement the [[Construct]] internal method unless otherwise specified in
the description of a particular function.
includes: [isConstructor.js]
features: [Reflect.construct, Temporal]
---*/
assert.sameValue(isConstructor(Temporal.now.timeZone), false, 'isConstructor(Temporal.now.timeZone) must return false');
assert.throws(TypeError, () => {
new Temporal.now.timeZone();
}, '`new Temporal.now.timeZone()` throws TypeError');

View File

@ -0,0 +1,19 @@
// Copyright (C) 2021 the V8 project authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: sec-temporal.now.timezone
description: The "timeZone" property of Temporal.now
info: |
Section 17: Every other data property described in clauses 18 through 26
and in Annex B.2 has the attributes { [[Writable]]: true,
[[Enumerable]]: false, [[Configurable]]: true } unless otherwise specified.
includes: [propertyHelper.js]
features: [Temporal]
---*/
verifyProperty(Temporal.now, 'timeZone', {
enumerable: false,
writable: true,
configurable: true
});

View File

@ -0,0 +1,15 @@
// Copyright (C) 2021 the V8 project authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: sec-temporal.now.timezone
description: Temporal.now.timeZone returns an instance of the TimeZone constructor
info: |
1. Return ? SystemTimeZone().
features: [Temporal]
---*/
assert.sameValue(
Object.getPrototypeOf(Temporal.now.timeZone()),
Temporal.TimeZone.prototype
);