calendar-invalid.js (917B)
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. 4 5 /*--- 6 description: Temporal.PlainYearMonth throws a RangeError if the calendar argument is invalid 7 esid: sec-temporal.plainyearmonth 8 includes: [compareArray.js, temporalHelpers.js] 9 features: [Temporal] 10 ---*/ 11 12 const expected = ["get year.valueOf", "call year.valueOf", "get month.valueOf", "call month.valueOf"]; 13 const actual = []; 14 const args = [ 15 TemporalHelpers.toPrimitiveObserver(actual, 1970, "year"), 16 TemporalHelpers.toPrimitiveObserver(actual, 1, "month"), 17 "local", 18 TemporalHelpers.toPrimitiveObserver(actual, 1, "day") 19 ]; 20 assert.throws(RangeError, () => new Temporal.PlainYearMonth(...args)); 21 assert.compareArray(actual, expected, "order of operations"); 22 23 reportCompare(0, 0);