mirror of https://github.com/tc39/test262.git
Temporal: tests for out-of-range time zone transitions
This normative change reached consensus in the July 2022 TC39 meeting: https://github.com/tc39/proposal-temporal/pull/2351
This commit is contained in:
parent
c665ccea28
commit
12b7b5c916
26
test/intl402/Temporal/TimeZone/prototype/getNextTransition/transition-at-instant-boundaries.js
vendored
Normal file
26
test/intl402/Temporal/TimeZone/prototype/getNextTransition/transition-at-instant-boundaries.js
vendored
Normal file
|
@ -0,0 +1,26 @@
|
||||||
|
// Copyright (C) 2022 André Bargull. All rights reserved.
|
||||||
|
// This code is governed by the BSD license found in the LICENSE file.
|
||||||
|
|
||||||
|
/*---
|
||||||
|
esid: sec-temporal.timezone.prototype.getnexttransition
|
||||||
|
description: >
|
||||||
|
Test transitions at the instant boundaries.
|
||||||
|
features: [Temporal, Intl-enumeration]
|
||||||
|
---*/
|
||||||
|
|
||||||
|
const min = new Temporal.Instant(-86_40000_00000_00000_00000n);
|
||||||
|
const max = new Temporal.Instant(86_40000_00000_00000_00000n);
|
||||||
|
|
||||||
|
for (let id of Intl.supportedValuesOf("timeZone")) {
|
||||||
|
let tz = new Temporal.TimeZone(id);
|
||||||
|
|
||||||
|
// If there's any next transition, it should be after |min|.
|
||||||
|
let next = tz.getNextTransition(min);
|
||||||
|
if (next) {
|
||||||
|
assert(next.epochNanoseconds > min.epochNanoseconds);
|
||||||
|
}
|
||||||
|
|
||||||
|
// There shouldn't be any next transition after |max|.
|
||||||
|
next = tz.getNextTransition(max);
|
||||||
|
assert.sameValue(next, null);
|
||||||
|
}
|
|
@ -0,0 +1,26 @@
|
||||||
|
// Copyright (C) 2022 André Bargull. All rights reserved.
|
||||||
|
// This code is governed by the BSD license found in the LICENSE file.
|
||||||
|
|
||||||
|
/*---
|
||||||
|
esid: sec-temporal.timezone.prototype.getprevioustransition
|
||||||
|
description: >
|
||||||
|
Test transitions at the instant boundaries.
|
||||||
|
features: [Temporal, Intl-enumeration]
|
||||||
|
---*/
|
||||||
|
|
||||||
|
const min = new Temporal.Instant(-86_40000_00000_00000_00000n);
|
||||||
|
const max = new Temporal.Instant(86_40000_00000_00000_00000n);
|
||||||
|
|
||||||
|
for (let id of Intl.supportedValuesOf("timeZone")) {
|
||||||
|
let tz = new Temporal.TimeZone(id);
|
||||||
|
|
||||||
|
// If there's any previous transition, it should be before |max|.
|
||||||
|
let prev = tz.getPreviousTransition(max);
|
||||||
|
if (prev) {
|
||||||
|
assert(prev.epochNanoseconds < max.epochNanoseconds);
|
||||||
|
}
|
||||||
|
|
||||||
|
// There shouldn't be any previous transition before |min|.
|
||||||
|
prev = tz.getPreviousTransition(min);
|
||||||
|
assert.sameValue(prev, null);
|
||||||
|
}
|
Loading…
Reference in New Issue