Skip to content

Commit d3efc72

Browse files
committed
Temporal: Move tests for getNext/PreviousTransition into ZonedDateTime
See: tc39/proposal-temporal#2826
1 parent 8c5bbc9 commit d3efc72

21 files changed

+157
-341
lines changed

Diff for: test/built-ins/Temporal/TimeZone/prototype/getNextTransition/branding.js

-24
This file was deleted.

Diff for: test/built-ins/Temporal/TimeZone/prototype/getNextTransition/builtin.js

-33
This file was deleted.

Diff for: test/built-ins/Temporal/TimeZone/prototype/getNextTransition/length.js

-25
This file was deleted.

Diff for: test/built-ins/Temporal/TimeZone/prototype/getNextTransition/name.js

-23
This file was deleted.

Diff for: test/built-ins/Temporal/TimeZone/prototype/getNextTransition/not-a-constructor.js

-21
This file was deleted.

Diff for: test/built-ins/Temporal/TimeZone/prototype/getNextTransition/prop-desc.js

-21
This file was deleted.

Diff for: test/built-ins/Temporal/TimeZone/prototype/getPreviousTransition/branding.js

-24
This file was deleted.

Diff for: test/built-ins/Temporal/TimeZone/prototype/getPreviousTransition/prop-desc.js

-21
This file was deleted.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
// Copyright (C) 2021 Igalia, S.L. All rights reserved.
2+
// This code is governed by the BSD license found in the LICENSE file.
3+
4+
/*---
5+
esid: sec-temporal.zoneddatetime.prototype.gettimezonetransition
6+
description: Throw a TypeError if the receiver is invalid
7+
features: [Symbol, Temporal]
8+
---*/
9+
10+
const getTimeZoneTransition = Temporal.ZonedDateTime.prototype.getTimeZoneTransition;
11+
12+
assert.sameValue(typeof getTimeZoneTransition, "function");
13+
14+
const args = ["next"];
15+
16+
assert.throws(TypeError, () => getTimeZoneTransition.apply(undefined, args), "undefined");
17+
assert.throws(TypeError, () => getTimeZoneTransition.apply(null, args), "null");
18+
assert.throws(TypeError, () => getTimeZoneTransition.apply(true, args), "true");
19+
assert.throws(TypeError, () => getTimeZoneTransition.apply("", args), "empty string");
20+
assert.throws(TypeError, () => getTimeZoneTransition.apply(Symbol(), args), "symbol");
21+
assert.throws(TypeError, () => getTimeZoneTransition.apply(1, args), "1");
22+
assert.throws(TypeError, () => getTimeZoneTransition.apply({}, args), "plain object");
23+
assert.throws(TypeError, () => getTimeZoneTransition.apply(Temporal.ZonedDateTime, args), "Temporal.ZonedDateTime");
24+
assert.throws(TypeError, () => getTimeZoneTransition.apply(Temporal.ZonedDateTime.prototype, args), "Temporal.ZonedDateTime.prototype");

Diff for: test/built-ins/Temporal/TimeZone/prototype/getPreviousTransition/builtin.js renamed to test/built-ins/Temporal/ZonedDateTime/prototype/getTimeZoneTransition/builtin.js

+6-6
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@
22
// This code is governed by the BSD license found in the LICENSE file.
33

44
/*---
5-
esid: sec-temporal.timezone.prototype.getprevioustransition
5+
esid: sec-temporal.zoneddatetime.prototype.gettimezonetransition
66
description: >
7-
Tests that Temporal.TimeZone.prototype.getPreviousTransition
7+
Tests that Temporal.ZonedDateTime.prototype.getTimeZoneTransition
88
meets the requirements for built-in objects defined by the
99
introduction of chapter 17 of the ECMAScript Language Specification.
1010
info: |
@@ -20,14 +20,14 @@ info: |
2020
features: [Temporal]
2121
---*/
2222

23-
assert.sameValue(Object.isExtensible(Temporal.TimeZone.prototype.getPreviousTransition),
23+
assert.sameValue(Object.isExtensible(Temporal.ZonedDateTime.prototype.getTimeZoneTransition),
2424
true, "Built-in objects must be extensible.");
2525

26-
assert.sameValue(Object.prototype.toString.call(Temporal.TimeZone.prototype.getPreviousTransition),
26+
assert.sameValue(Object.prototype.toString.call(Temporal.ZonedDateTime.prototype.getTimeZoneTransition),
2727
"[object Function]", "Object.prototype.toString");
2828

29-
assert.sameValue(Object.getPrototypeOf(Temporal.TimeZone.prototype.getPreviousTransition),
29+
assert.sameValue(Object.getPrototypeOf(Temporal.ZonedDateTime.prototype.getTimeZoneTransition),
3030
Function.prototype, "prototype");
3131

32-
assert.sameValue(Temporal.TimeZone.prototype.getPreviousTransition.hasOwnProperty("prototype"),
32+
assert.sameValue(Temporal.ZonedDateTime.prototype.getTimeZoneTransition.hasOwnProperty("prototype"),
3333
false, "prototype property");

Diff for: test/built-ins/Temporal/TimeZone/prototype/getPreviousTransition/length.js renamed to test/built-ins/Temporal/ZonedDateTime/prototype/getTimeZoneTransition/length.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22
// This code is governed by the BSD license found in the LICENSE file.
33

44
/*---
5-
esid: sec-temporal.timezone.prototype.getprevioustransition
6-
description: Temporal.TimeZone.prototype.getPreviousTransition.length is 1
5+
esid: sec-temporal.zoneddatetime.prototype.gettimezonetransition
6+
description: Temporal.ZonedDateTime.prototype.getTimeZoneTransition.length is 0
77
info: |
88
Every built-in function object, including constructors, has a "length" property whose value is
99
an integer. Unless otherwise specified, this value is equal to the largest number of named
@@ -17,7 +17,7 @@ includes: [propertyHelper.js]
1717
features: [Temporal]
1818
---*/
1919

20-
verifyProperty(Temporal.TimeZone.prototype.getPreviousTransition, "length", {
20+
verifyProperty(Temporal.ZonedDateTime.prototype.getTimeZoneTransition, "length", {
2121
value: 1,
2222
writable: false,
2323
enumerable: false,

Diff for: test/built-ins/Temporal/TimeZone/prototype/getPreviousTransition/name.js renamed to test/built-ins/Temporal/ZonedDateTime/prototype/getTimeZoneTransition/name.js

+4-4
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22
// This code is governed by the BSD license found in the LICENSE file.
33

44
/*---
5-
esid: sec-temporal.timezone.prototype.getprevioustransition
6-
description: Temporal.TimeZone.prototype.getPreviousTransition.name is "getPreviousTransition".
5+
esid: sec-temporal.zoneddatetime.prototype.gettimezonetransition
6+
description: Temporal.ZonedDateTime.prototype.getTimeZoneTransition.name is "getTimeZoneTransition".
77
info: |
88
Every built-in function object, including constructors, that is not identified as an anonymous
99
function has a "name" property whose value is a String. Unless otherwise specified, this value
@@ -15,8 +15,8 @@ includes: [propertyHelper.js]
1515
features: [Temporal]
1616
---*/
1717

18-
verifyProperty(Temporal.TimeZone.prototype.getPreviousTransition, "name", {
19-
value: "getPreviousTransition",
18+
verifyProperty(Temporal.ZonedDateTime.prototype.getTimeZoneTransition, "name", {
19+
value: "getTimeZoneTransition",
2020
writable: false,
2121
enumerable: false,
2222
configurable: true,

Diff for: test/built-ins/Temporal/TimeZone/prototype/getPreviousTransition/not-a-constructor.js renamed to test/built-ins/Temporal/ZonedDateTime/prototype/getTimeZoneTransition/not-a-constructor.js

+5-5
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@
22
// This code is governed by the BSD license found in the LICENSE file.
33

44
/*---
5-
esid: sec-temporal.timezone.prototype.getprevioustransition
5+
esid: sec-temporal.zoneddatetime.prototype.gettimezonetransition
66
description: >
7-
Temporal.TimeZone.prototype.getPreviousTransition does not implement [[Construct]], is not new-able
7+
Temporal.ZonedDateTime.prototype.getTimeZoneTransition does not implement [[Construct]], is not new-able
88
info: |
99
Built-in function objects that are not identified as constructors do not implement the
1010
[[Construct]] internal method unless otherwise specified in the description of a particular
@@ -14,8 +14,8 @@ features: [Reflect.construct, Temporal]
1414
---*/
1515

1616
assert.throws(TypeError, () => {
17-
new Temporal.TimeZone.prototype.getPreviousTransition();
17+
new Temporal.ZonedDateTime.prototype.getTimeZoneTransition();
1818
}, "Calling as constructor");
1919

20-
assert.sameValue(isConstructor(Temporal.TimeZone.prototype.getPreviousTransition), false,
21-
"isConstructor(Temporal.TimeZone.prototype.getPreviousTransition)");
20+
assert.sameValue(isConstructor(Temporal.ZonedDateTime.prototype.getTimeZoneTransition), false,
21+
"isConstructor(Temporal.ZonedDateTime.prototype.getTimeZoneTransition)");
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
// Copyright (C) 2021 Igalia, S.L. All rights reserved.
2+
// This code is governed by the BSD license found in the LICENSE file.
3+
4+
/*---
5+
esid: sec-temporal.zoneddatetime.prototype.gettimezonetransition
6+
description: The "getTimeZoneTransition" property of Temporal.ZonedDateTime.prototype
7+
includes: [propertyHelper.js]
8+
features: [Temporal]
9+
---*/
10+
11+
assert.sameValue(
12+
typeof Temporal.ZonedDateTime.prototype.getTimeZoneTransition,
13+
"function",
14+
"`typeof ZonedDateTime.prototype.getTimeZoneTransition` is `function`"
15+
);
16+
17+
verifyProperty(Temporal.ZonedDateTime.prototype, "getTimeZoneTransition", {
18+
writable: true,
19+
enumerable: false,
20+
configurable: true,
21+
});

Diff for: test/intl402/Temporal/TimeZone/prototype/getNextTransition/subtract-second-and-nanosecond-from-last-transition.js

-55
This file was deleted.

0 commit comments

Comments
 (0)