Bug 1892041 - Part 2: Update test262. r=spidermonkey-reviewers,dminor
[gecko.git] / js / src / tests / test262 / built-ins / Temporal / PlainMonthDay / prototype / equals / basic.js
blobd79e48763640df4fd9fd9aa4c2d42f21ed5350d3
1 // |reftest| skip-if(!this.hasOwnProperty('Temporal')) -- Temporal is not enabled unconditionally
2 // Copyright (C) 2021 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.plainmonthday.prototype.equals
7 description: Basic tests for equals()
8 features: [Temporal]
9 ---*/
11 const md1 = Temporal.PlainMonthDay.from("01-22");
12 const md2 = Temporal.PlainMonthDay.from("12-15");
13 assert(md1.equals(md1), "same object");
14 assert.sameValue(md1.equals(md2), false, "different object");
16 assert(md1.equals("01-22"), "same string");
17 assert.sameValue(md2.equals("01-22"), false, "different string");
19 assert(md1.equals({ month: 1, day: 22 }), "same property bag");
20 assert.sameValue(md2.equals({ month: 1, day: 22 }), false, "different property bag");
22 assert.throws(TypeError, () => md1.equals({ month: 1 }), "missing field in property bag");
24 const mdYear1 = new Temporal.PlainMonthDay(1, 1, undefined, 1972);
25 const mdYear2 = new Temporal.PlainMonthDay(1, 1, undefined, 2000);
26 assert.sameValue(mdYear1.equals(mdYear2), false, "different reference years");
28 reportCompare(0, 0);