Bug 1892041 - Part 2: Update test262. r=spidermonkey-reviewers,dminor
[gecko.git] / js / src / tests / test262 / built-ins / Temporal / PlainMonthDay / prototype / equals / duplicate-calendar-fields.js
blobdd58ceb4c54ab60728d1f0cbd8fe05bc73cfc22e
1 // |reftest| skip-if(!this.hasOwnProperty('Temporal')) -- Temporal is not enabled unconditionally
2 // Copyright (C) 2023 Igalia, S.L. All rights reserved.
3 // This code is governed by the BSD license found in the LICENSE file.
4 /*---
5 esid: sec-temporal.plainmonthday.prototype.equals
6 description: If a calendar's fields() method returns duplicate field names, PrepareTemporalFields should throw a RangeError.
7 includes: [temporalHelpers.js]
8 features: [Temporal]
9 ---*/
11 for (const extra_fields of [['foo', 'foo'], ['day'], ['month'], ['monthCode'], ['year']]) {
12     const calendar = TemporalHelpers.calendarWithExtraFields(extra_fields);
13     const arg = { year: 2023, month: 5, monthCode: 'M05', day: 1, calendar: calendar };
14     const instance = new Temporal.PlainMonthDay(5, 2, calendar);
16     assert.throws(RangeError, () => instance.equals(arg));
19 reportCompare(0, 0);