mirror of https://github.com/tc39/test262.git
Temporal: Avoid recalculating offset ns after GetPlainDateTimeFor
This commit is contained in:
parent
0c87a86b58
commit
c372de0bbe
|
@ -24,8 +24,6 @@ const expected = [
|
|||
"has options.timeZone.id",
|
||||
"get options.timeZone.getOffsetNanosecondsFor",
|
||||
"call options.timeZone.getOffsetNanosecondsFor",
|
||||
"get options.timeZone.getOffsetNanosecondsFor",
|
||||
"call options.timeZone.getOffsetNanosecondsFor",
|
||||
];
|
||||
const actual = [];
|
||||
|
||||
|
|
|
@ -3,7 +3,8 @@
|
|||
|
||||
/*---
|
||||
esid: sec-temporal.instant.prototype.tostring
|
||||
description: Passing a TimeZone to options calls getOffsetNanosecondsFor twice, but not toString
|
||||
description: >
|
||||
Passing a TimeZone to options calls getOffsetNanosecondsFor, but not toString
|
||||
includes: [compareArray.js, temporalHelpers.js]
|
||||
features: [Temporal]
|
||||
---*/
|
||||
|
@ -15,8 +16,6 @@ const expected = [
|
|||
"has timeZone.id",
|
||||
"get timeZone.getOffsetNanosecondsFor",
|
||||
"call timeZone.getOffsetNanosecondsFor",
|
||||
"get timeZone.getOffsetNanosecondsFor",
|
||||
"call timeZone.getOffsetNanosecondsFor",
|
||||
];
|
||||
|
||||
const instant = Temporal.Instant.from("1975-02-02T14:25:36.123456Z");
|
||||
|
|
|
@ -13,8 +13,6 @@ features: [Temporal]
|
|||
const expected = [
|
||||
"get this.timeZone.getOffsetNanosecondsFor",
|
||||
"call this.timeZone.getOffsetNanosecondsFor",
|
||||
"get this.timeZone.getOffsetNanosecondsFor",
|
||||
"call this.timeZone.getOffsetNanosecondsFor",
|
||||
];
|
||||
const actual = [];
|
||||
|
||||
|
|
|
@ -31,9 +31,6 @@ const expected = [
|
|||
"call this.calendar.dateAdd",
|
||||
"get this.timeZone.getPossibleInstantsFor",
|
||||
"call this.timeZone.getPossibleInstantsFor",
|
||||
// GetOffsetNanosecondsFor
|
||||
"get this.timeZone.getOffsetNanosecondsFor",
|
||||
"call this.timeZone.getOffsetNanosecondsFor",
|
||||
// InterpretISODateTimeOffset
|
||||
"get this.timeZone.getPossibleInstantsFor",
|
||||
"call this.timeZone.getPossibleInstantsFor",
|
||||
|
|
26
test/built-ins/Temporal/ZonedDateTime/prototype/toJSON/order-of-operations.js
vendored
Normal file
26
test/built-ins/Temporal/ZonedDateTime/prototype/toJSON/order-of-operations.js
vendored
Normal file
|
@ -0,0 +1,26 @@
|
|||
// Copyright (C) 2023 Igalia, S.L. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
esid: sec-temporal.zoneddatetime.prototype.tojson
|
||||
description: Properties on objects passed to toJSON() are accessed in the correct order
|
||||
includes: [compareArray.js, temporalHelpers.js]
|
||||
features: [Temporal]
|
||||
---*/
|
||||
|
||||
const expected = [
|
||||
"get this.timeZone.getOffsetNanosecondsFor",
|
||||
"call this.timeZone.getOffsetNanosecondsFor",
|
||||
"get this.timeZone.id",
|
||||
"get this.calendar.id",
|
||||
];
|
||||
const actual = [];
|
||||
|
||||
const timeZone = TemporalHelpers.timeZoneObserver(actual, "this.timeZone");
|
||||
const calendar = TemporalHelpers.calendarObserver(actual, "this.calendar");
|
||||
const instance = new Temporal.ZonedDateTime(0n, timeZone, calendar);
|
||||
// clear observable operations that occurred during the constructor call
|
||||
actual.splice(0);
|
||||
|
||||
instance.toJSON();
|
||||
assert.compareArray(actual, expected, "order of operations");
|
|
@ -29,8 +29,6 @@ const expected = [
|
|||
"call options.timeZoneName.toString",
|
||||
"get this.timeZone.getOffsetNanosecondsFor",
|
||||
"call this.timeZone.getOffsetNanosecondsFor",
|
||||
"get this.timeZone.getOffsetNanosecondsFor",
|
||||
"call this.timeZone.getOffsetNanosecondsFor",
|
||||
"get this.timeZone.id",
|
||||
"get this.calendar.id",
|
||||
];
|
||||
|
@ -75,8 +73,6 @@ const expectedForFractionalSecondDigits = [
|
|||
"call options.timeZoneName.toString",
|
||||
"get this.timeZone.getOffsetNanosecondsFor",
|
||||
"call this.timeZone.getOffsetNanosecondsFor",
|
||||
"get this.timeZone.getOffsetNanosecondsFor",
|
||||
"call this.timeZone.getOffsetNanosecondsFor",
|
||||
"get this.timeZone.id",
|
||||
"get this.calendar.id",
|
||||
];
|
||||
|
|
Loading…
Reference in New Issue