1 // |reftest| skip-if(!this.hasOwnProperty('Temporal')) -- Temporal is not enabled unconditionally
2 // Copyright (C) 2020 Igalia, S.L. All rights reserved.
3 // This code is governed by the BSD license found in the LICENSE file.
6 description: Throws a RangeError if any value in the property bag is Infinity or -Infinity
7 esid: sec-temporal.plainmonthday.prototype.toplaindate
8 includes: [compareArray.js, temporalHelpers.js]
12 const instance = new Temporal.PlainMonthDay(5, 2);
14 [Infinity, -Infinity].forEach((inf) => {
15 assert.throws(RangeError, () => instance.toPlainDate({ year: inf }), `year property cannot be ${inf}`);
18 const obj = TemporalHelpers.toPrimitiveObserver(calls, inf, "year");
19 assert.throws(RangeError, () => instance.toPlainDate({ year: obj }));
20 assert.compareArray(calls, ["get year.valueOf", "call year.valueOf"], "it fails after fetching the primitive value");