diff --git a/features.txt b/features.txt index add1212504..25278ef6b4 100644 --- a/features.txt +++ b/features.txt @@ -335,3 +335,7 @@ json-modules # Resizable Arraybuffer # https://github.com/tc39/proposal-resizablearraybuffer resizable-arraybuffer + +# Temporal +# https://github.com/tc39/proposal-temporal +Temporal diff --git a/test/built-ins/Temporal/now/timeZone/extensible.js b/test/built-ins/Temporal/now/timeZone/extensible.js new file mode 100644 index 0000000000..1b66ae317b --- /dev/null +++ b/test/built-ins/Temporal/now/timeZone/extensible.js @@ -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)); diff --git a/test/built-ins/Temporal/now/timeZone/length.js b/test/built-ins/Temporal/now/timeZone/length.js index a7990044de..1c460d2d7d 100644 --- a/test/built-ins/Temporal/now/timeZone/length.js +++ b/test/built-ins/Temporal/now/timeZone/length.js @@ -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", { diff --git a/test/built-ins/Temporal/now/timeZone/name.js b/test/built-ins/Temporal/now/timeZone/name.js new file mode 100644 index 0000000000..218fd2d8c7 --- /dev/null +++ b/test/built-ins/Temporal/now/timeZone/name.js @@ -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 +}); diff --git a/test/built-ins/Temporal/now/timeZone/new-object.js b/test/built-ins/Temporal/now/timeZone/new-object.js index cce38a1104..2a98242d60 100644 --- a/test/built-ins/Temporal/now/timeZone/new-object.js +++ b/test/built-ins/Temporal/now/timeZone/new-object.js @@ -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; diff --git a/test/built-ins/Temporal/now/timeZone/not-a-constructor.js b/test/built-ins/Temporal/now/timeZone/not-a-constructor.js new file mode 100644 index 0000000000..579aa1dc12 --- /dev/null +++ b/test/built-ins/Temporal/now/timeZone/not-a-constructor.js @@ -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'); diff --git a/test/built-ins/Temporal/now/timeZone/prop-desc.js b/test/built-ins/Temporal/now/timeZone/prop-desc.js new file mode 100644 index 0000000000..14b87c9bfd --- /dev/null +++ b/test/built-ins/Temporal/now/timeZone/prop-desc.js @@ -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 +}); diff --git a/test/built-ins/Temporal/now/timeZone/return-value.js b/test/built-ins/Temporal/now/timeZone/return-value.js new file mode 100644 index 0000000000..5ecbe9b59d --- /dev/null +++ b/test/built-ins/Temporal/now/timeZone/return-value.js @@ -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 +);