Bug 1892041 - Part 2: Update test262. r=spidermonkey-reviewers,dminor
[gecko.git] / js / src / tests / test262 / built-ins / Temporal / PlainDateTime / prototype / until / result-mixed-sign.js
blob7287c706b9c14502de2bbfa28ad2bab195c07c8e
1 // |reftest| skip-if(!this.hasOwnProperty('Temporal')) -- Temporal is not enabled unconditionally
2 // Copyright (C) 2024 Igalia, S.L. All rights reserved.
3 // This code is governed by the BSD license found in the LICENSE file.
5 /*---
6 esid: sec-temporal.plaindatetime.prototype.until
7 description: >
8   RangeError when inconsistent custom calendar method causes mixed signs of
9   Duration components
10 features: [Temporal]
11 ---*/
13 // Test case provided by AndrĂ© Bargull
15 const cal = new (class extends Temporal.Calendar {
16   dateAdd(date, duration, options) {
17     return super.dateAdd(date, duration.negated(), options);
18   }
19 })("iso8601");
21 const one = new Temporal.PlainDateTime(2000, 1, 1, 0, 0, 0, 0, 0, 0, cal);
22 const two = new Temporal.PlainDateTime(2020, 5, 10, 12, 12, 0, 0, 0, 0, cal);
24 assert.throws(RangeError, () => one.until(two, {
25   largestUnit: "years",
26   smallestUnit: "hours"
27 }));
29 reportCompare(0, 0);