From 8dd16259287f58f9273002717ec4d27e97127719 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Wed, 12 Jun 2024 07:43:14 +0200 Subject: Merging upstream version 127.0. Signed-off-by: Daniel Baumann --- ...lized-time-duration-to-days-loop-arbitrarily.js | 78 ---------------------- 1 file changed, 78 deletions(-) delete mode 100644 js/src/tests/test262/built-ins/Temporal/Duration/prototype/subtract/normalized-time-duration-to-days-loop-arbitrarily.js (limited to 'js/src/tests/test262/built-ins/Temporal/Duration/prototype/subtract/normalized-time-duration-to-days-loop-arbitrarily.js') diff --git a/js/src/tests/test262/built-ins/Temporal/Duration/prototype/subtract/normalized-time-duration-to-days-loop-arbitrarily.js b/js/src/tests/test262/built-ins/Temporal/Duration/prototype/subtract/normalized-time-duration-to-days-loop-arbitrarily.js deleted file mode 100644 index 8873380037..0000000000 --- a/js/src/tests/test262/built-ins/Temporal/Duration/prototype/subtract/normalized-time-duration-to-days-loop-arbitrarily.js +++ /dev/null @@ -1,78 +0,0 @@ -// |reftest| skip-if(!this.hasOwnProperty('Temporal')) -- Temporal is not enabled unconditionally -// Copyright (C) 2022 Igalia, S.L. All rights reserved. -// This code is governed by the BSD license found in the LICENSE file. - -/*--- -esid: sec-temporal.duration.prototype.subtract -description: > - NormalizedTimeDurationToDays can loop arbitrarily up to max safe integer -info: | - NormalizedTimeDurationToDays ( norm, zonedRelativeTo, timeZoneRec [ , precalculatedPlainDatetime ] ) - ... - 21. Repeat, while done is false, - a. Let oneDayFarther be ? AddDaysToZonedDateTime(relativeResult.[[Instant]], - relativeResult.[[DateTime]], timeZoneRec, zonedRelativeTo.[[Calendar]], sign). - b. Set dayLengthNs to NormalizedTimeDurationFromEpochNanosecondsDifference(oneDayFarther.[[EpochNanoseconds]], - relativeResult.[[EpochNanoseconds]]). - c. Let oneDayLess be ? SubtractNormalizedTimeDuration(norm, dayLengthNs). - c. If NormalizedTimeDurationSign(oneDayLess) × sign ≥ 0, then - i. Set norm to oneDayLess. - ii. Set relativeResult to oneDayFarther. - iii. Set days to days + sign. - d. Else, - i. Set done to true. -includes: [temporalHelpers.js] -features: [Temporal] ----*/ - -const calls = []; -const duration = Temporal.Duration.from({ days: 1 }); - -function createRelativeTo(count) { - const dayLengthNs = 86400000000000n; - const dayInstant = new Temporal.Instant(dayLengthNs); - const substitutions = []; - const timeZone = new Temporal.TimeZone("UTC"); - // Return constant value for first _count_ calls - TemporalHelpers.substituteMethod( - timeZone, - "getPossibleInstantsFor", - substitutions - ); - substitutions.length = count; - let i = 0; - for (i = 0; i < substitutions.length; i++) { - // (this value) - substitutions[i] = [dayInstant]; - } - // Record calls in calls[] - TemporalHelpers.observeMethod(calls, timeZone, "getPossibleInstantsFor"); - return new Temporal.ZonedDateTime(0n, timeZone); -} - -let zdt = createRelativeTo(50); -calls.splice(0); // Reset calls list after ZonedDateTime construction -duration.subtract(duration, { - relativeTo: zdt, -}); -assert.sameValue( - calls.length, - 50 + 1, - "Expected duration.subtract to call getPossibleInstantsFor correct number of times" -); - -zdt = createRelativeTo(100); -calls.splice(0); // Reset calls list after previous loop + ZonedDateTime construction -duration.subtract(duration, { - relativeTo: zdt, -}); -assert.sameValue( - calls.length, - 100 + 1, - "Expected duration.subtract to call getPossibleInstantsFor correct number of times" -); - -zdt = createRelativeTo(107); -assert.throws(RangeError, () => duration.subtract(duration, { relativeTo: zdt }), "107-2 days > 2⁵³ ns"); - -reportCompare(0, 0); -- cgit v1.2.3