basic.js (861B)
1 // |reftest| skip-if(!this.hasOwnProperty('Temporal')) -- Temporal is not enabled unconditionally 2 // Copyright (C) 2022 Igalia, S.L. All rights reserved. 3 // This code is governed by the BSD license found in the LICENSE file. 4 5 /*--- 6 esid: sec-temporal.plainyearmonth.compare 7 description: Basic tests for compare() 8 features: [Temporal] 9 ---*/ 10 11 const nov94 = Temporal.PlainYearMonth.from("1994-11"); 12 const nov94bis = Temporal.PlainYearMonth.from("1994-11"); 13 const jun13 = Temporal.PlainYearMonth.from("2013-06"); 14 assert.sameValue(Temporal.PlainYearMonth.compare(nov94, nov94), 0, "same object"); 15 assert.sameValue(Temporal.PlainYearMonth.compare(nov94, nov94bis), 0, "different object"); 16 assert.sameValue(Temporal.PlainYearMonth.compare(nov94, jun13), -1, "before"); 17 assert.sameValue(Temporal.PlainYearMonth.compare(jun13, nov94), 1, "after"); 18 19 reportCompare(0, 0);