From e2eaf04e9e0a7ca5ec6a8a22a706977b60194ec2 Mon Sep 17 00:00:00 2001 From: Philip Chimento Date: Fri, 24 May 2024 15:15:13 -0700 Subject: [PATCH] Temporal: Remove Plain/ZonedDateTime to PlainYearMonth/MonthDay APIs See tc39/proposal-temporal#2848 --- .../prototype/toPlainMonthDay/branding.js | 22 --------- .../builtin-calendar-no-array-iteration.js | 20 -------- .../builtin-calendar-no-observable-calls.js | 34 ------------- .../prototype/toPlainMonthDay/builtin.js | 33 ------------- .../toPlainMonthDay/calendar-arguments.js | 29 ----------- .../calendar-fields-iterable.js | 27 ----------- ...ields-called-with-null-prototype-fields.js | 15 ------ ...romfields-called-with-options-undefined.js | 16 ------- .../constructor-in-calendar-fields.js | 13 ----- .../duplicate-calendar-fields.js | 15 ------ .../prototype/toPlainMonthDay/length.js | 25 ---------- .../prototype/toPlainMonthDay/name.js | 23 --------- .../toPlainMonthDay/not-a-constructor.js | 21 -------- .../prototype/toPlainMonthDay/prop-desc.js | 21 -------- .../proto-in-calendar-fields.js | 13 ----- .../prototype/toPlainYearMonth/branding.js | 22 --------- .../builtin-calendar-no-array-iteration.js | 20 -------- .../builtin-calendar-no-observable-calls.js | 34 ------------- .../prototype/toPlainYearMonth/builtin.js | 33 ------------- .../toPlainYearMonth/calendar-arguments.js | 29 ----------- .../calendar-fields-iterable.js | 27 ----------- ...ields-called-with-null-prototype-fields.js | 15 ------ ...romfields-called-with-options-undefined.js | 16 ------- .../constructor-in-calendar-fields.js | 13 ----- .../duplicate-calendar-fields.js | 15 ------ .../prototype/toPlainYearMonth/length.js | 25 ---------- .../prototype/toPlainYearMonth/name.js | 23 --------- .../toPlainYearMonth/not-a-constructor.js | 21 -------- .../prototype/toPlainYearMonth/prop-desc.js | 21 -------- .../proto-in-calendar-fields.js | 13 ----- .../prototype/toPlainMonthDay/branding.js | 22 --------- .../builtin-calendar-no-array-iteration.js | 20 -------- .../builtin-calendar-no-observable-calls.js | 34 ------------- .../builtin-timezone-no-observable-calls.js | 25 ---------- .../prototype/toPlainMonthDay/builtin.js | 33 ------------- .../toPlainMonthDay/calendar-arguments.js | 29 ----------- .../calendar-fields-iterable.js | 27 ----------- ...ields-called-with-null-prototype-fields.js | 15 ------ ...romfields-called-with-options-undefined.js | 16 ------- .../toPlainMonthDay/calendar-result.js | 23 --------- .../constructor-in-calendar-fields.js | 13 ----- .../duplicate-calendar-fields.js | 15 ------ .../prototype/toPlainMonthDay/length.js | 25 ---------- .../prototype/toPlainMonthDay/name.js | 23 --------- .../toPlainMonthDay/not-a-constructor.js | 21 -------- .../toPlainMonthDay/order-of-operations.js | 48 ------------------- .../prototype/toPlainMonthDay/prop-desc.js | 21 -------- .../proto-in-calendar-fields.js | 13 ----- ...one-getoffsetnanosecondsfor-non-integer.js | 15 ------ ...ne-getoffsetnanosecondsfor-not-callable.js | 19 -------- ...ne-getoffsetnanosecondsfor-out-of-range.js | 15 ------ ...zone-getoffsetnanosecondsfor-wrong-type.js | 24 ---------- .../prototype/toPlainYearMonth/branding.js | 22 --------- .../builtin-calendar-no-array-iteration.js | 20 -------- .../builtin-calendar-no-observable-calls.js | 34 ------------- .../builtin-timezone-no-observable-calls.js | 25 ---------- .../prototype/toPlainYearMonth/builtin.js | 33 ------------- .../toPlainYearMonth/calendar-arguments.js | 29 ----------- .../calendar-fields-iterable.js | 27 ----------- ...ields-called-with-null-prototype-fields.js | 15 ------ .../toPlainYearMonth/calendar-result.js | 23 --------- ...romfields-called-with-options-undefined.js | 16 ------- .../constructor-in-calendar-fields.js | 13 ----- .../duplicate-calendar-fields.js | 15 ------ .../prototype/toPlainYearMonth/length.js | 25 ---------- .../prototype/toPlainYearMonth/name.js | 23 --------- .../toPlainYearMonth/not-a-constructor.js | 21 -------- .../toPlainYearMonth/order-of-operations.js | 48 ------------------- .../prototype/toPlainYearMonth/prop-desc.js | 21 -------- .../proto-in-calendar-fields.js | 13 ----- ...one-getoffsetnanosecondsfor-non-integer.js | 15 ------ ...ne-getoffsetnanosecondsfor-not-callable.js | 19 -------- ...ne-getoffsetnanosecondsfor-out-of-range.js | 15 ------ ...zone-getoffsetnanosecondsfor-wrong-type.js | 24 ---------- .../ZonedDateTime/old/toPlainMonthDay.js | 48 ------------------- .../ZonedDateTime/old/toPlainYearMonth.js | 48 ------------------- 76 files changed, 1742 deletions(-) delete mode 100644 test/built-ins/Temporal/PlainDateTime/prototype/toPlainMonthDay/branding.js delete mode 100644 test/built-ins/Temporal/PlainDateTime/prototype/toPlainMonthDay/builtin-calendar-no-array-iteration.js delete mode 100644 test/built-ins/Temporal/PlainDateTime/prototype/toPlainMonthDay/builtin-calendar-no-observable-calls.js delete mode 100644 test/built-ins/Temporal/PlainDateTime/prototype/toPlainMonthDay/builtin.js delete mode 100644 test/built-ins/Temporal/PlainDateTime/prototype/toPlainMonthDay/calendar-arguments.js delete mode 100644 test/built-ins/Temporal/PlainDateTime/prototype/toPlainMonthDay/calendar-fields-iterable.js delete mode 100644 test/built-ins/Temporal/PlainDateTime/prototype/toPlainMonthDay/calendar-fromfields-called-with-null-prototype-fields.js delete mode 100644 test/built-ins/Temporal/PlainDateTime/prototype/toPlainMonthDay/calendar-monthdayfromfields-called-with-options-undefined.js delete mode 100644 test/built-ins/Temporal/PlainDateTime/prototype/toPlainMonthDay/constructor-in-calendar-fields.js delete mode 100644 test/built-ins/Temporal/PlainDateTime/prototype/toPlainMonthDay/duplicate-calendar-fields.js delete mode 100644 test/built-ins/Temporal/PlainDateTime/prototype/toPlainMonthDay/length.js delete mode 100644 test/built-ins/Temporal/PlainDateTime/prototype/toPlainMonthDay/name.js delete mode 100644 test/built-ins/Temporal/PlainDateTime/prototype/toPlainMonthDay/not-a-constructor.js delete mode 100644 test/built-ins/Temporal/PlainDateTime/prototype/toPlainMonthDay/prop-desc.js delete mode 100644 test/built-ins/Temporal/PlainDateTime/prototype/toPlainMonthDay/proto-in-calendar-fields.js delete mode 100644 test/built-ins/Temporal/PlainDateTime/prototype/toPlainYearMonth/branding.js delete mode 100644 test/built-ins/Temporal/PlainDateTime/prototype/toPlainYearMonth/builtin-calendar-no-array-iteration.js delete mode 100644 test/built-ins/Temporal/PlainDateTime/prototype/toPlainYearMonth/builtin-calendar-no-observable-calls.js delete mode 100644 test/built-ins/Temporal/PlainDateTime/prototype/toPlainYearMonth/builtin.js delete mode 100644 test/built-ins/Temporal/PlainDateTime/prototype/toPlainYearMonth/calendar-arguments.js delete mode 100644 test/built-ins/Temporal/PlainDateTime/prototype/toPlainYearMonth/calendar-fields-iterable.js delete mode 100644 test/built-ins/Temporal/PlainDateTime/prototype/toPlainYearMonth/calendar-fromfields-called-with-null-prototype-fields.js delete mode 100644 test/built-ins/Temporal/PlainDateTime/prototype/toPlainYearMonth/calendar-yearmonthfromfields-called-with-options-undefined.js delete mode 100644 test/built-ins/Temporal/PlainDateTime/prototype/toPlainYearMonth/constructor-in-calendar-fields.js delete mode 100644 test/built-ins/Temporal/PlainDateTime/prototype/toPlainYearMonth/duplicate-calendar-fields.js delete mode 100644 test/built-ins/Temporal/PlainDateTime/prototype/toPlainYearMonth/length.js delete mode 100644 test/built-ins/Temporal/PlainDateTime/prototype/toPlainYearMonth/name.js delete mode 100644 test/built-ins/Temporal/PlainDateTime/prototype/toPlainYearMonth/not-a-constructor.js delete mode 100644 test/built-ins/Temporal/PlainDateTime/prototype/toPlainYearMonth/prop-desc.js delete mode 100644 test/built-ins/Temporal/PlainDateTime/prototype/toPlainYearMonth/proto-in-calendar-fields.js delete mode 100644 test/built-ins/Temporal/ZonedDateTime/prototype/toPlainMonthDay/branding.js delete mode 100644 test/built-ins/Temporal/ZonedDateTime/prototype/toPlainMonthDay/builtin-calendar-no-array-iteration.js delete mode 100644 test/built-ins/Temporal/ZonedDateTime/prototype/toPlainMonthDay/builtin-calendar-no-observable-calls.js delete mode 100644 test/built-ins/Temporal/ZonedDateTime/prototype/toPlainMonthDay/builtin-timezone-no-observable-calls.js delete mode 100644 test/built-ins/Temporal/ZonedDateTime/prototype/toPlainMonthDay/builtin.js delete mode 100644 test/built-ins/Temporal/ZonedDateTime/prototype/toPlainMonthDay/calendar-arguments.js delete mode 100644 test/built-ins/Temporal/ZonedDateTime/prototype/toPlainMonthDay/calendar-fields-iterable.js delete mode 100644 test/built-ins/Temporal/ZonedDateTime/prototype/toPlainMonthDay/calendar-fromfields-called-with-null-prototype-fields.js delete mode 100644 test/built-ins/Temporal/ZonedDateTime/prototype/toPlainMonthDay/calendar-monthdayfromfields-called-with-options-undefined.js delete mode 100644 test/built-ins/Temporal/ZonedDateTime/prototype/toPlainMonthDay/calendar-result.js delete mode 100644 test/built-ins/Temporal/ZonedDateTime/prototype/toPlainMonthDay/constructor-in-calendar-fields.js delete mode 100644 test/built-ins/Temporal/ZonedDateTime/prototype/toPlainMonthDay/duplicate-calendar-fields.js delete mode 100644 test/built-ins/Temporal/ZonedDateTime/prototype/toPlainMonthDay/length.js delete mode 100644 test/built-ins/Temporal/ZonedDateTime/prototype/toPlainMonthDay/name.js delete mode 100644 test/built-ins/Temporal/ZonedDateTime/prototype/toPlainMonthDay/not-a-constructor.js delete mode 100644 test/built-ins/Temporal/ZonedDateTime/prototype/toPlainMonthDay/order-of-operations.js delete mode 100644 test/built-ins/Temporal/ZonedDateTime/prototype/toPlainMonthDay/prop-desc.js delete mode 100644 test/built-ins/Temporal/ZonedDateTime/prototype/toPlainMonthDay/proto-in-calendar-fields.js delete mode 100644 test/built-ins/Temporal/ZonedDateTime/prototype/toPlainMonthDay/timezone-getoffsetnanosecondsfor-non-integer.js delete mode 100644 test/built-ins/Temporal/ZonedDateTime/prototype/toPlainMonthDay/timezone-getoffsetnanosecondsfor-not-callable.js delete mode 100644 test/built-ins/Temporal/ZonedDateTime/prototype/toPlainMonthDay/timezone-getoffsetnanosecondsfor-out-of-range.js delete mode 100644 test/built-ins/Temporal/ZonedDateTime/prototype/toPlainMonthDay/timezone-getoffsetnanosecondsfor-wrong-type.js delete mode 100644 test/built-ins/Temporal/ZonedDateTime/prototype/toPlainYearMonth/branding.js delete mode 100644 test/built-ins/Temporal/ZonedDateTime/prototype/toPlainYearMonth/builtin-calendar-no-array-iteration.js delete mode 100644 test/built-ins/Temporal/ZonedDateTime/prototype/toPlainYearMonth/builtin-calendar-no-observable-calls.js delete mode 100644 test/built-ins/Temporal/ZonedDateTime/prototype/toPlainYearMonth/builtin-timezone-no-observable-calls.js delete mode 100644 test/built-ins/Temporal/ZonedDateTime/prototype/toPlainYearMonth/builtin.js delete mode 100644 test/built-ins/Temporal/ZonedDateTime/prototype/toPlainYearMonth/calendar-arguments.js delete mode 100644 test/built-ins/Temporal/ZonedDateTime/prototype/toPlainYearMonth/calendar-fields-iterable.js delete mode 100644 test/built-ins/Temporal/ZonedDateTime/prototype/toPlainYearMonth/calendar-fromfields-called-with-null-prototype-fields.js delete mode 100644 test/built-ins/Temporal/ZonedDateTime/prototype/toPlainYearMonth/calendar-result.js delete mode 100644 test/built-ins/Temporal/ZonedDateTime/prototype/toPlainYearMonth/calendar-yearmonthfromfields-called-with-options-undefined.js delete mode 100644 test/built-ins/Temporal/ZonedDateTime/prototype/toPlainYearMonth/constructor-in-calendar-fields.js delete mode 100644 test/built-ins/Temporal/ZonedDateTime/prototype/toPlainYearMonth/duplicate-calendar-fields.js delete mode 100644 test/built-ins/Temporal/ZonedDateTime/prototype/toPlainYearMonth/length.js delete mode 100644 test/built-ins/Temporal/ZonedDateTime/prototype/toPlainYearMonth/name.js delete mode 100644 test/built-ins/Temporal/ZonedDateTime/prototype/toPlainYearMonth/not-a-constructor.js delete mode 100644 test/built-ins/Temporal/ZonedDateTime/prototype/toPlainYearMonth/order-of-operations.js delete mode 100644 test/built-ins/Temporal/ZonedDateTime/prototype/toPlainYearMonth/prop-desc.js delete mode 100644 test/built-ins/Temporal/ZonedDateTime/prototype/toPlainYearMonth/proto-in-calendar-fields.js delete mode 100644 test/built-ins/Temporal/ZonedDateTime/prototype/toPlainYearMonth/timezone-getoffsetnanosecondsfor-non-integer.js delete mode 100644 test/built-ins/Temporal/ZonedDateTime/prototype/toPlainYearMonth/timezone-getoffsetnanosecondsfor-not-callable.js delete mode 100644 test/built-ins/Temporal/ZonedDateTime/prototype/toPlainYearMonth/timezone-getoffsetnanosecondsfor-out-of-range.js delete mode 100644 test/built-ins/Temporal/ZonedDateTime/prototype/toPlainYearMonth/timezone-getoffsetnanosecondsfor-wrong-type.js delete mode 100644 test/staging/Temporal/ZonedDateTime/old/toPlainMonthDay.js delete mode 100644 test/staging/Temporal/ZonedDateTime/old/toPlainYearMonth.js diff --git a/test/built-ins/Temporal/PlainDateTime/prototype/toPlainMonthDay/branding.js b/test/built-ins/Temporal/PlainDateTime/prototype/toPlainMonthDay/branding.js deleted file mode 100644 index e8a63bb90ba..00000000000 --- a/test/built-ins/Temporal/PlainDateTime/prototype/toPlainMonthDay/branding.js +++ /dev/null @@ -1,22 +0,0 @@ -// Copyright (C) 2021 Igalia, S.L. All rights reserved. -// This code is governed by the BSD license found in the LICENSE file. - -/*--- -esid: sec-temporal.plaindatetime.prototype.toplainmonthday -description: Throw a TypeError if the receiver is invalid -features: [Symbol, Temporal] ----*/ - -const toPlainMonthDay = Temporal.PlainDateTime.prototype.toPlainMonthDay; - -assert.sameValue(typeof toPlainMonthDay, "function"); - -assert.throws(TypeError, () => toPlainMonthDay.call(undefined), "undefined"); -assert.throws(TypeError, () => toPlainMonthDay.call(null), "null"); -assert.throws(TypeError, () => toPlainMonthDay.call(true), "true"); -assert.throws(TypeError, () => toPlainMonthDay.call(""), "empty string"); -assert.throws(TypeError, () => toPlainMonthDay.call(Symbol()), "symbol"); -assert.throws(TypeError, () => toPlainMonthDay.call(1), "1"); -assert.throws(TypeError, () => toPlainMonthDay.call({}), "plain object"); -assert.throws(TypeError, () => toPlainMonthDay.call(Temporal.PlainDateTime), "Temporal.PlainDateTime"); -assert.throws(TypeError, () => toPlainMonthDay.call(Temporal.PlainDateTime.prototype), "Temporal.PlainDateTime.prototype"); diff --git a/test/built-ins/Temporal/PlainDateTime/prototype/toPlainMonthDay/builtin-calendar-no-array-iteration.js b/test/built-ins/Temporal/PlainDateTime/prototype/toPlainMonthDay/builtin-calendar-no-array-iteration.js deleted file mode 100644 index 45ec2afa552..00000000000 --- a/test/built-ins/Temporal/PlainDateTime/prototype/toPlainMonthDay/builtin-calendar-no-array-iteration.js +++ /dev/null @@ -1,20 +0,0 @@ -// Copyright (C) 2023 Igalia, S.L. All rights reserved. -// This code is governed by the BSD license found in the LICENSE file. - -/*--- -esid: sec-temporal.plaindatetime.prototype.toplainmonthday -description: > - Calling the method on an instance constructed with a builtin calendar causes - no observable array iteration when getting the calendar fields. -features: [Temporal] ----*/ - -const arrayPrototypeSymbolIteratorOriginal = Array.prototype[Symbol.iterator]; -Array.prototype[Symbol.iterator] = function arrayIterator() { - throw new Test262Error("Array should not be iterated"); -} - -const instance = new Temporal.PlainDateTime(2023, 5, 2, 12, 34, 56, 987, 654, 321, "iso8601"); -instance.toPlainMonthDay(); - -Array.prototype[Symbol.iterator] = arrayPrototypeSymbolIteratorOriginal; diff --git a/test/built-ins/Temporal/PlainDateTime/prototype/toPlainMonthDay/builtin-calendar-no-observable-calls.js b/test/built-ins/Temporal/PlainDateTime/prototype/toPlainMonthDay/builtin-calendar-no-observable-calls.js deleted file mode 100644 index 15a3b27d55d..00000000000 --- a/test/built-ins/Temporal/PlainDateTime/prototype/toPlainMonthDay/builtin-calendar-no-observable-calls.js +++ /dev/null @@ -1,34 +0,0 @@ -// Copyright (C) 2023 Igalia, S.L. All rights reserved. -// This code is governed by the BSD license found in the LICENSE file. - -/*--- -esid: sec-temporal.plaindatetime.prototype.toplainmonthday -description: > - Calling the method on an instance constructed with a builtin calendar causes - no observable lookups or calls to calendar methods. -includes: [temporalHelpers.js] -features: [Temporal] ----*/ - -const fieldsOriginal = Object.getOwnPropertyDescriptor(Temporal.Calendar.prototype, "fields"); -Object.defineProperty(Temporal.Calendar.prototype, "fields", { - configurable: true, - enumerable: false, - get() { - TemporalHelpers.assertUnreachable("fields should not be looked up"); - }, -}); -const monthDayFromFieldsOriginal = Object.getOwnPropertyDescriptor(Temporal.Calendar.prototype, "monthDayFromFields"); -Object.defineProperty(Temporal.Calendar.prototype, "monthDayFromFields", { - configurable: true, - enumerable: false, - get() { - TemporalHelpers.assertUnreachable("monthDayFromFields should not be looked up"); - }, -}); - -const instance = new Temporal.PlainDateTime(2000, 5, 2, 12, 34, 56, 987, 654, 321, "iso8601"); -instance.toPlainMonthDay(); - -Object.defineProperty(Temporal.Calendar.prototype, "fields", fieldsOriginal); -Object.defineProperty(Temporal.Calendar.prototype, "monthDayFromFields", monthDayFromFieldsOriginal); diff --git a/test/built-ins/Temporal/PlainDateTime/prototype/toPlainMonthDay/builtin.js b/test/built-ins/Temporal/PlainDateTime/prototype/toPlainMonthDay/builtin.js deleted file mode 100644 index b6e62de3f39..00000000000 --- a/test/built-ins/Temporal/PlainDateTime/prototype/toPlainMonthDay/builtin.js +++ /dev/null @@ -1,33 +0,0 @@ -// Copyright (C) 2021 Igalia, S.L. All rights reserved. -// This code is governed by the BSD license found in the LICENSE file. - -/*--- -esid: sec-temporal.plaindatetime.prototype.toplainmonthday -description: > - Tests that Temporal.PlainDateTime.prototype.toPlainMonthDay - meets the requirements for built-in objects defined by the - introduction of chapter 17 of the ECMAScript Language Specification. -info: | - Built-in functions that are not constructors do not have a "prototype" property unless - otherwise specified in the description of a particular function. - - Unless specified otherwise, a built-in object that is callable as a function is a built-in - function object with the characteristics described in 10.3. Unless specified otherwise, the - [[Extensible]] internal slot of a built-in object initially has the value true. - - Unless otherwise specified every built-in function and every built-in constructor has the - Function prototype object [...] as the value of its [[Prototype]] internal slot. -features: [Temporal] ----*/ - -assert.sameValue(Object.isExtensible(Temporal.PlainDateTime.prototype.toPlainMonthDay), - true, "Built-in objects must be extensible."); - -assert.sameValue(Object.prototype.toString.call(Temporal.PlainDateTime.prototype.toPlainMonthDay), - "[object Function]", "Object.prototype.toString"); - -assert.sameValue(Object.getPrototypeOf(Temporal.PlainDateTime.prototype.toPlainMonthDay), - Function.prototype, "prototype"); - -assert.sameValue(Temporal.PlainDateTime.prototype.toPlainMonthDay.hasOwnProperty("prototype"), - false, "prototype property"); diff --git a/test/built-ins/Temporal/PlainDateTime/prototype/toPlainMonthDay/calendar-arguments.js b/test/built-ins/Temporal/PlainDateTime/prototype/toPlainMonthDay/calendar-arguments.js deleted file mode 100644 index 37f9efc51d3..00000000000 --- a/test/built-ins/Temporal/PlainDateTime/prototype/toPlainMonthDay/calendar-arguments.js +++ /dev/null @@ -1,29 +0,0 @@ -// Copyright (C) 2021 Igalia, S.L. All rights reserved. -// This code is governed by the BSD license found in the LICENSE file. - -/*--- -esid: sec-temporal.plaindatetime.prototype.toplainmonthday -description: Correct options value is passed to calendar method -info: | - MonthDayFromFields ( calendar, fields [ , options ] ) - - 3. If options is not present, then - a. Set options to undefined. -includes: [temporalHelpers.js] -features: [Temporal] ----*/ - -class CustomCalendar extends Temporal.Calendar { - constructor() { - super("iso8601"); - } - monthDayFromFields(...args) { - assert.sameValue(args.length, 2, "args.length"); - assert.sameValue(typeof args[0], "object", "args[0]"); - assert.sameValue(args[1], undefined, "args[1]"); - return super.monthDayFromFields(...args); - } -} -const plainDateTime = new Temporal.PlainDateTime(2000, 5, 2, 12, 34, 56, 123, 456, 789, new CustomCalendar()); -const result = plainDateTime.toPlainMonthDay(); -TemporalHelpers.assertPlainMonthDay(result, "M05", 2); diff --git a/test/built-ins/Temporal/PlainDateTime/prototype/toPlainMonthDay/calendar-fields-iterable.js b/test/built-ins/Temporal/PlainDateTime/prototype/toPlainMonthDay/calendar-fields-iterable.js deleted file mode 100644 index 64c669a6e6e..00000000000 --- a/test/built-ins/Temporal/PlainDateTime/prototype/toPlainMonthDay/calendar-fields-iterable.js +++ /dev/null @@ -1,27 +0,0 @@ -// Copyright (C) 2021 Igalia, S.L. All rights reserved. -// This code is governed by the BSD license found in the LICENSE file. - -/*--- -esid: sec-temporal.plaindatetime.prototype.toplainmonthday -description: Verify the result of calendar.fields() is treated correctly. -info: | - sec-temporal.plaindatetime.prototype.toplainmonthday step 4: - 4. Let _fieldNames_ be ? CalendarFields(_calendar_, « *"day"*, *"monthCode"* »). - sec-temporal-calendarfields step 4: - 4. Let _result_ be ? IterableToList(_fieldsArray_). -includes: [compareArray.js, temporalHelpers.js] -features: [Temporal] ----*/ - -const expected = [ - "day", - "monthCode", -]; - -const calendar = TemporalHelpers.calendarFieldsIterable(); -const datetime = new Temporal.PlainDateTime(2000, 5, 2, 12, 34, 56, 987, 654, 321, calendar); -datetime.toPlainMonthDay(); - -assert.sameValue(calendar.fieldsCallCount, 1, "fields() method called once"); -assert.compareArray(calendar.fieldsCalledWith[0], expected, "fields() method called with correct args"); -assert(calendar.iteratorExhausted[0], "iterated through the whole iterable"); diff --git a/test/built-ins/Temporal/PlainDateTime/prototype/toPlainMonthDay/calendar-fromfields-called-with-null-prototype-fields.js b/test/built-ins/Temporal/PlainDateTime/prototype/toPlainMonthDay/calendar-fromfields-called-with-null-prototype-fields.js deleted file mode 100644 index d6b4fb943cc..00000000000 --- a/test/built-ins/Temporal/PlainDateTime/prototype/toPlainMonthDay/calendar-fromfields-called-with-null-prototype-fields.js +++ /dev/null @@ -1,15 +0,0 @@ -// Copyright (C) 2022 Igalia, S.L. All rights reserved. -// This code is governed by the BSD license found in the LICENSE file. - -/*--- -esid: sec-temporal.plaindatetime.prototype.toplainmonthday -description: > - Calendar.monthDayFromFields method is called with a null-prototype fields object -includes: [temporalHelpers.js] -features: [Temporal] ----*/ - -const calendar = TemporalHelpers.calendarCheckFieldsPrototypePollution(); -const instance = new Temporal.PlainDateTime(2000, 5, 2, 12, 34, 56, 987, 654, 321, calendar); -instance.toPlainMonthDay(); -assert.sameValue(calendar.monthDayFromFieldsCallCount, 1, "monthDayFromFields should have been called on the calendar"); diff --git a/test/built-ins/Temporal/PlainDateTime/prototype/toPlainMonthDay/calendar-monthdayfromfields-called-with-options-undefined.js b/test/built-ins/Temporal/PlainDateTime/prototype/toPlainMonthDay/calendar-monthdayfromfields-called-with-options-undefined.js deleted file mode 100644 index ee8746eb4b0..00000000000 --- a/test/built-ins/Temporal/PlainDateTime/prototype/toPlainMonthDay/calendar-monthdayfromfields-called-with-options-undefined.js +++ /dev/null @@ -1,16 +0,0 @@ -// Copyright (C) 2022 Igalia, S.L. All rights reserved. -// This code is governed by the BSD license found in the LICENSE file. - -/*--- -esid: sec-temporal.plaindatetime.prototype.toplainmonthday -description: > - Calendar.monthDayFromFields method is called with undefined as the options - value when call originates internally -includes: [temporalHelpers.js] -features: [Temporal] ----*/ - -const calendar = TemporalHelpers.calendarFromFieldsUndefinedOptions(); -const instance = new Temporal.PlainDateTime(2000, 5, 2, 12, 34, 56, 987, 654, 321, calendar); -instance.toPlainMonthDay(); -assert.sameValue(calendar.monthDayFromFieldsCallCount, 1); diff --git a/test/built-ins/Temporal/PlainDateTime/prototype/toPlainMonthDay/constructor-in-calendar-fields.js b/test/built-ins/Temporal/PlainDateTime/prototype/toPlainMonthDay/constructor-in-calendar-fields.js deleted file mode 100644 index 91e4e895e5e..00000000000 --- a/test/built-ins/Temporal/PlainDateTime/prototype/toPlainMonthDay/constructor-in-calendar-fields.js +++ /dev/null @@ -1,13 +0,0 @@ -// Copyright (C) 2023 Igalia, S.L. All rights reserved. -// This code is governed by the BSD license found in the LICENSE file. -/*--- -esid: sec-temporal.plaindatetime.prototype.toplainmonthday -description: If a calendar's fields() method returns a field named 'constructor', PrepareTemporalFields should throw a RangeError. -includes: [temporalHelpers.js] -features: [Temporal] ----*/ - -const calendar = TemporalHelpers.calendarWithExtraFields(['constructor']); -const datetime = new Temporal.PlainDateTime(2023, 5, 1, 0, 0, 0, 0, 0, 0, calendar); - -assert.throws(RangeError, () => datetime.toPlainMonthDay()); diff --git a/test/built-ins/Temporal/PlainDateTime/prototype/toPlainMonthDay/duplicate-calendar-fields.js b/test/built-ins/Temporal/PlainDateTime/prototype/toPlainMonthDay/duplicate-calendar-fields.js deleted file mode 100644 index ba6b61834a7..00000000000 --- a/test/built-ins/Temporal/PlainDateTime/prototype/toPlainMonthDay/duplicate-calendar-fields.js +++ /dev/null @@ -1,15 +0,0 @@ -// Copyright (C) 2023 Igalia, S.L. All rights reserved. -// This code is governed by the BSD license found in the LICENSE file. -/*--- -esid: sec-temporal.plaindatetime.prototype.toplainmonthday -description: If a calendar's fields() method returns duplicate field names, PrepareTemporalFields should throw a RangeError. -includes: [temporalHelpers.js] -features: [Temporal] ----*/ - -for (const extra_fields of [['foo', 'foo'], ['monthCode'], ['day']]) { - const calendar = TemporalHelpers.calendarWithExtraFields(extra_fields); - const datetime = new Temporal.PlainDateTime(2023, 5, 1, 0, 0, 0, 0, 0, 0, calendar); - - assert.throws(RangeError, () => datetime.toPlainMonthDay()); -} diff --git a/test/built-ins/Temporal/PlainDateTime/prototype/toPlainMonthDay/length.js b/test/built-ins/Temporal/PlainDateTime/prototype/toPlainMonthDay/length.js deleted file mode 100644 index c7103be3742..00000000000 --- a/test/built-ins/Temporal/PlainDateTime/prototype/toPlainMonthDay/length.js +++ /dev/null @@ -1,25 +0,0 @@ -// Copyright (C) 2020 Igalia, S.L. All rights reserved. -// This code is governed by the BSD license found in the LICENSE file. - -/*--- -esid: sec-temporal.plaindatetime.prototype.toplainmonthday -description: Temporal.PlainDateTime.prototype.toPlainMonthDay.length is 0 -info: | - Every built-in function object, including constructors, has a "length" property whose value is - an integer. Unless otherwise specified, this value is equal to the largest number of named - arguments shown in the subclause headings for the function description. Optional parameters - (which are indicated with brackets: [ ]) or rest parameters (which are shown using the form - «...name») are not included in the default argument count. - - Unless otherwise specified, the "length" property of a built-in function object has the - attributes { [[Writable]]: false, [[Enumerable]]: false, [[Configurable]]: true }. -includes: [propertyHelper.js] -features: [Temporal] ----*/ - -verifyProperty(Temporal.PlainDateTime.prototype.toPlainMonthDay, "length", { - value: 0, - writable: false, - enumerable: false, - configurable: true, -}); diff --git a/test/built-ins/Temporal/PlainDateTime/prototype/toPlainMonthDay/name.js b/test/built-ins/Temporal/PlainDateTime/prototype/toPlainMonthDay/name.js deleted file mode 100644 index 56376fae65c..00000000000 --- a/test/built-ins/Temporal/PlainDateTime/prototype/toPlainMonthDay/name.js +++ /dev/null @@ -1,23 +0,0 @@ -// Copyright (C) 2021 Igalia, S.L. All rights reserved. -// This code is governed by the BSD license found in the LICENSE file. - -/*--- -esid: sec-temporal.plaindatetime.prototype.toplainmonthday -description: Temporal.PlainDateTime.prototype.toPlainMonthDay.name is "toPlainMonthDay". -info: | - Every built-in function object, including constructors, that is not identified as an anonymous - function has a "name" property whose value is a String. Unless otherwise specified, this value - is the name that is given to the function in this specification. - - Unless otherwise specified, the "name" property of a built-in function object, if it exists, - has the attributes { [[Writable]]: false, [[Enumerable]]: false, [[Configurable]]: true }. -includes: [propertyHelper.js] -features: [Temporal] ----*/ - -verifyProperty(Temporal.PlainDateTime.prototype.toPlainMonthDay, "name", { - value: "toPlainMonthDay", - writable: false, - enumerable: false, - configurable: true, -}); diff --git a/test/built-ins/Temporal/PlainDateTime/prototype/toPlainMonthDay/not-a-constructor.js b/test/built-ins/Temporal/PlainDateTime/prototype/toPlainMonthDay/not-a-constructor.js deleted file mode 100644 index 3b6963660fb..00000000000 --- a/test/built-ins/Temporal/PlainDateTime/prototype/toPlainMonthDay/not-a-constructor.js +++ /dev/null @@ -1,21 +0,0 @@ -// Copyright (C) 2021 Igalia, S.L. All rights reserved. -// This code is governed by the BSD license found in the LICENSE file. - -/*--- -esid: sec-temporal.plaindatetime.prototype.toplainmonthday -description: > - Temporal.PlainDateTime.prototype.toPlainMonthDay does not implement [[Construct]], is not new-able -info: | - Built-in function objects that are not identified as constructors do not implement the - [[Construct]] internal method unless otherwise specified in the description of a particular - function. -includes: [isConstructor.js] -features: [Reflect.construct, Temporal] ----*/ - -assert.throws(TypeError, () => { - new Temporal.PlainDateTime.prototype.toPlainMonthDay(); -}, "Calling as constructor"); - -assert.sameValue(isConstructor(Temporal.PlainDateTime.prototype.toPlainMonthDay), false, - "isConstructor(Temporal.PlainDateTime.prototype.toPlainMonthDay)"); diff --git a/test/built-ins/Temporal/PlainDateTime/prototype/toPlainMonthDay/prop-desc.js b/test/built-ins/Temporal/PlainDateTime/prototype/toPlainMonthDay/prop-desc.js deleted file mode 100644 index cfdc4a721d1..00000000000 --- a/test/built-ins/Temporal/PlainDateTime/prototype/toPlainMonthDay/prop-desc.js +++ /dev/null @@ -1,21 +0,0 @@ -// Copyright (C) 2021 Igalia, S.L. All rights reserved. -// This code is governed by the BSD license found in the LICENSE file. - -/*--- -esid: sec-temporal.plaindatetime.prototype.toplainmonthday -description: The "toPlainMonthDay" property of Temporal.PlainDateTime.prototype -includes: [propertyHelper.js] -features: [Temporal] ----*/ - -assert.sameValue( - typeof Temporal.PlainDateTime.prototype.toPlainMonthDay, - "function", - "`typeof PlainDateTime.prototype.toPlainMonthDay` is `function`" -); - -verifyProperty(Temporal.PlainDateTime.prototype, "toPlainMonthDay", { - writable: true, - enumerable: false, - configurable: true, -}); diff --git a/test/built-ins/Temporal/PlainDateTime/prototype/toPlainMonthDay/proto-in-calendar-fields.js b/test/built-ins/Temporal/PlainDateTime/prototype/toPlainMonthDay/proto-in-calendar-fields.js deleted file mode 100644 index 732ab304319..00000000000 --- a/test/built-ins/Temporal/PlainDateTime/prototype/toPlainMonthDay/proto-in-calendar-fields.js +++ /dev/null @@ -1,13 +0,0 @@ -// Copyright (C) 2023 Igalia, S.L. All rights reserved. -// This code is governed by the BSD license found in the LICENSE file. -/*--- -esid: sec-temporal.plaindatetime.prototype.toplainmonthday -description: If a calendar's fields() method returns a field named '__proto__', PrepareTemporalFields should throw a RangeError. -includes: [temporalHelpers.js] -features: [Temporal] ----*/ - -const calendar = TemporalHelpers.calendarWithExtraFields(['__proto__']); -const datetime = new Temporal.PlainDateTime(2023, 5, 1, 0, 0, 0, 0, 0, 0, calendar); - -assert.throws(RangeError, () => datetime.toPlainMonthDay()); diff --git a/test/built-ins/Temporal/PlainDateTime/prototype/toPlainYearMonth/branding.js b/test/built-ins/Temporal/PlainDateTime/prototype/toPlainYearMonth/branding.js deleted file mode 100644 index 0ce564e3eec..00000000000 --- a/test/built-ins/Temporal/PlainDateTime/prototype/toPlainYearMonth/branding.js +++ /dev/null @@ -1,22 +0,0 @@ -// Copyright (C) 2021 Igalia, S.L. All rights reserved. -// This code is governed by the BSD license found in the LICENSE file. - -/*--- -esid: sec-temporal.plaindatetime.prototype.toplainyearmonth -description: Throw a TypeError if the receiver is invalid -features: [Symbol, Temporal] ----*/ - -const toPlainYearMonth = Temporal.PlainDateTime.prototype.toPlainYearMonth; - -assert.sameValue(typeof toPlainYearMonth, "function"); - -assert.throws(TypeError, () => toPlainYearMonth.call(undefined), "undefined"); -assert.throws(TypeError, () => toPlainYearMonth.call(null), "null"); -assert.throws(TypeError, () => toPlainYearMonth.call(true), "true"); -assert.throws(TypeError, () => toPlainYearMonth.call(""), "empty string"); -assert.throws(TypeError, () => toPlainYearMonth.call(Symbol()), "symbol"); -assert.throws(TypeError, () => toPlainYearMonth.call(1), "1"); -assert.throws(TypeError, () => toPlainYearMonth.call({}), "plain object"); -assert.throws(TypeError, () => toPlainYearMonth.call(Temporal.PlainDateTime), "Temporal.PlainDateTime"); -assert.throws(TypeError, () => toPlainYearMonth.call(Temporal.PlainDateTime.prototype), "Temporal.PlainDateTime.prototype"); diff --git a/test/built-ins/Temporal/PlainDateTime/prototype/toPlainYearMonth/builtin-calendar-no-array-iteration.js b/test/built-ins/Temporal/PlainDateTime/prototype/toPlainYearMonth/builtin-calendar-no-array-iteration.js deleted file mode 100644 index 3d1818e043a..00000000000 --- a/test/built-ins/Temporal/PlainDateTime/prototype/toPlainYearMonth/builtin-calendar-no-array-iteration.js +++ /dev/null @@ -1,20 +0,0 @@ -// Copyright (C) 2023 Igalia, S.L. All rights reserved. -// This code is governed by the BSD license found in the LICENSE file. - -/*--- -esid: sec-temporal.plaindatetime.prototype.toplainyearmonth -description: > - Calling the method on an instance constructed with a builtin calendar causes - no observable array iteration when getting the calendar fields. -features: [Temporal] ----*/ - -const arrayPrototypeSymbolIteratorOriginal = Array.prototype[Symbol.iterator]; -Array.prototype[Symbol.iterator] = function arrayIterator() { - throw new Test262Error("Array should not be iterated"); -} - -const instance = new Temporal.PlainDateTime(2023, 5, 2, 12, 34, 56, 987, 654, 321, "iso8601"); -instance.toPlainYearMonth(); - -Array.prototype[Symbol.iterator] = arrayPrototypeSymbolIteratorOriginal; diff --git a/test/built-ins/Temporal/PlainDateTime/prototype/toPlainYearMonth/builtin-calendar-no-observable-calls.js b/test/built-ins/Temporal/PlainDateTime/prototype/toPlainYearMonth/builtin-calendar-no-observable-calls.js deleted file mode 100644 index 10bfc19fe3e..00000000000 --- a/test/built-ins/Temporal/PlainDateTime/prototype/toPlainYearMonth/builtin-calendar-no-observable-calls.js +++ /dev/null @@ -1,34 +0,0 @@ -// Copyright (C) 2023 Igalia, S.L. All rights reserved. -// This code is governed by the BSD license found in the LICENSE file. - -/*--- -esid: sec-temporal.plaindatetime.prototype.toplainyearmonth -description: > - Calling the method on an instance constructed with a builtin calendar causes - no observable lookups or calls to calendar methods. -includes: [temporalHelpers.js] -features: [Temporal] ----*/ - -const fieldsOriginal = Object.getOwnPropertyDescriptor(Temporal.Calendar.prototype, "fields"); -Object.defineProperty(Temporal.Calendar.prototype, "fields", { - configurable: true, - enumerable: false, - get() { - TemporalHelpers.assertUnreachable("fields should not be looked up"); - }, -}); -const yearMonthFromFieldsOriginal = Object.getOwnPropertyDescriptor(Temporal.Calendar.prototype, "yearMonthFromFields"); -Object.defineProperty(Temporal.Calendar.prototype, "yearMonthFromFields", { - configurable: true, - enumerable: false, - get() { - TemporalHelpers.assertUnreachable("yearMonthFromFields should not be looked up"); - }, -}); - -const instance = new Temporal.PlainDateTime(2000, 5, 2, 12, 34, 56, 987, 654, 321, "iso8601"); -instance.toPlainYearMonth(); - -Object.defineProperty(Temporal.Calendar.prototype, "fields", fieldsOriginal); -Object.defineProperty(Temporal.Calendar.prototype, "yearMonthFromFields", yearMonthFromFieldsOriginal); diff --git a/test/built-ins/Temporal/PlainDateTime/prototype/toPlainYearMonth/builtin.js b/test/built-ins/Temporal/PlainDateTime/prototype/toPlainYearMonth/builtin.js deleted file mode 100644 index c3a23c1a8a0..00000000000 --- a/test/built-ins/Temporal/PlainDateTime/prototype/toPlainYearMonth/builtin.js +++ /dev/null @@ -1,33 +0,0 @@ -// Copyright (C) 2021 Igalia, S.L. All rights reserved. -// This code is governed by the BSD license found in the LICENSE file. - -/*--- -esid: sec-temporal.plaindatetime.prototype.toplainyearmonth -description: > - Tests that Temporal.PlainDateTime.prototype.toPlainYearMonth - meets the requirements for built-in objects defined by the - introduction of chapter 17 of the ECMAScript Language Specification. -info: | - Built-in functions that are not constructors do not have a "prototype" property unless - otherwise specified in the description of a particular function. - - Unless specified otherwise, a built-in object that is callable as a function is a built-in - function object with the characteristics described in 10.3. Unless specified otherwise, the - [[Extensible]] internal slot of a built-in object initially has the value true. - - Unless otherwise specified every built-in function and every built-in constructor has the - Function prototype object [...] as the value of its [[Prototype]] internal slot. -features: [Temporal] ----*/ - -assert.sameValue(Object.isExtensible(Temporal.PlainDateTime.prototype.toPlainYearMonth), - true, "Built-in objects must be extensible."); - -assert.sameValue(Object.prototype.toString.call(Temporal.PlainDateTime.prototype.toPlainYearMonth), - "[object Function]", "Object.prototype.toString"); - -assert.sameValue(Object.getPrototypeOf(Temporal.PlainDateTime.prototype.toPlainYearMonth), - Function.prototype, "prototype"); - -assert.sameValue(Temporal.PlainDateTime.prototype.toPlainYearMonth.hasOwnProperty("prototype"), - false, "prototype property"); diff --git a/test/built-ins/Temporal/PlainDateTime/prototype/toPlainYearMonth/calendar-arguments.js b/test/built-ins/Temporal/PlainDateTime/prototype/toPlainYearMonth/calendar-arguments.js deleted file mode 100644 index 2b92786f6b4..00000000000 --- a/test/built-ins/Temporal/PlainDateTime/prototype/toPlainYearMonth/calendar-arguments.js +++ /dev/null @@ -1,29 +0,0 @@ -// Copyright (C) 2021 Igalia, S.L. All rights reserved. -// This code is governed by the BSD license found in the LICENSE file. - -/*--- -esid: sec-temporal.plaindatetime.prototype.toplainyearmonth -description: Correct options value is passed to calendar method -info: | - YearMonthFromFields ( calendar, fields [ , options ] ) - - 3. If options is not present, then - a. Set options to undefined. -includes: [temporalHelpers.js] -features: [Temporal] ----*/ - -class CustomCalendar extends Temporal.Calendar { - constructor() { - super("iso8601"); - } - yearMonthFromFields(...args) { - assert.sameValue(args.length, 2, "args.length"); - assert.sameValue(typeof args[0], "object", "args[0]"); - assert.sameValue(args[1], undefined, "args[1]"); - return super.yearMonthFromFields(...args); - } -} -const plainDateTime = new Temporal.PlainDateTime(2000, 5, 2, 12, 34, 56, 123, 456, 789, new CustomCalendar()); -const result = plainDateTime.toPlainYearMonth(); -TemporalHelpers.assertPlainYearMonth(result, 2000, 5, "M05"); diff --git a/test/built-ins/Temporal/PlainDateTime/prototype/toPlainYearMonth/calendar-fields-iterable.js b/test/built-ins/Temporal/PlainDateTime/prototype/toPlainYearMonth/calendar-fields-iterable.js deleted file mode 100644 index 3f0157e3b78..00000000000 --- a/test/built-ins/Temporal/PlainDateTime/prototype/toPlainYearMonth/calendar-fields-iterable.js +++ /dev/null @@ -1,27 +0,0 @@ -// Copyright (C) 2021 Igalia, S.L. All rights reserved. -// This code is governed by the BSD license found in the LICENSE file. - -/*--- -esid: sec-temporal.plaindatetime.prototype.toplainyearmonth -description: Verify the result of calendar.fields() is treated correctly. -info: | - sec-temporal.plaindatetime.prototype.toplainyearmonth step 4: - 4. Let _fieldNames_ be ? CalendarFields(_calendar_, « *"monthCode"*, *"year"* »). - sec-temporal-calendarfields step 4: - 4. Let _result_ be ? IterableToList(_fieldsArray_). -includes: [compareArray.js, temporalHelpers.js] -features: [Temporal] ----*/ - -const expected = [ - "monthCode", - "year", -]; - -const calendar = TemporalHelpers.calendarFieldsIterable(); -const datetime = new Temporal.PlainDateTime(2000, 5, 2, 12, 34, 56, 987, 654, 321, calendar); -datetime.toPlainYearMonth(); - -assert.sameValue(calendar.fieldsCallCount, 1, "fields() method called once"); -assert.compareArray(calendar.fieldsCalledWith[0], expected, "fields() method called with correct args"); -assert(calendar.iteratorExhausted[0], "iterated through the whole iterable"); diff --git a/test/built-ins/Temporal/PlainDateTime/prototype/toPlainYearMonth/calendar-fromfields-called-with-null-prototype-fields.js b/test/built-ins/Temporal/PlainDateTime/prototype/toPlainYearMonth/calendar-fromfields-called-with-null-prototype-fields.js deleted file mode 100644 index 0770066dfbb..00000000000 --- a/test/built-ins/Temporal/PlainDateTime/prototype/toPlainYearMonth/calendar-fromfields-called-with-null-prototype-fields.js +++ /dev/null @@ -1,15 +0,0 @@ -// Copyright (C) 2022 Igalia, S.L. All rights reserved. -// This code is governed by the BSD license found in the LICENSE file. - -/*--- -esid: sec-temporal.plaindatetime.prototype.toplainyearmonth -description: > - Calendar.yearMonthFromFields method is called with a null-prototype fields object -includes: [temporalHelpers.js] -features: [Temporal] ----*/ - -const calendar = TemporalHelpers.calendarCheckFieldsPrototypePollution(); -const instance = new Temporal.PlainDateTime(2000, 5, 2, 12, 34, 56, 987, 654, 321, calendar); -instance.toPlainYearMonth(); -assert.sameValue(calendar.yearMonthFromFieldsCallCount, 1, "yearMonthFromFields should have been called on the calendar"); diff --git a/test/built-ins/Temporal/PlainDateTime/prototype/toPlainYearMonth/calendar-yearmonthfromfields-called-with-options-undefined.js b/test/built-ins/Temporal/PlainDateTime/prototype/toPlainYearMonth/calendar-yearmonthfromfields-called-with-options-undefined.js deleted file mode 100644 index 0a8deb44c9e..00000000000 --- a/test/built-ins/Temporal/PlainDateTime/prototype/toPlainYearMonth/calendar-yearmonthfromfields-called-with-options-undefined.js +++ /dev/null @@ -1,16 +0,0 @@ -// Copyright (C) 2022 Igalia, S.L. All rights reserved. -// This code is governed by the BSD license found in the LICENSE file. - -/*--- -esid: sec-temporal.plaindatetime.prototype.toplainyearmonth -description: > - Calendar.yearMonthFromFields method is called with undefined as the options - value when call originates internally -includes: [temporalHelpers.js] -features: [Temporal] ----*/ - -const calendar = TemporalHelpers.calendarFromFieldsUndefinedOptions(); -const instance = new Temporal.PlainDateTime(2000, 5, 2, 12, 34, 56, 987, 654, 321, calendar); -instance.toPlainYearMonth(); -assert.sameValue(calendar.yearMonthFromFieldsCallCount, 1); diff --git a/test/built-ins/Temporal/PlainDateTime/prototype/toPlainYearMonth/constructor-in-calendar-fields.js b/test/built-ins/Temporal/PlainDateTime/prototype/toPlainYearMonth/constructor-in-calendar-fields.js deleted file mode 100644 index 7460225811a..00000000000 --- a/test/built-ins/Temporal/PlainDateTime/prototype/toPlainYearMonth/constructor-in-calendar-fields.js +++ /dev/null @@ -1,13 +0,0 @@ -// Copyright (C) 2023 Igalia, S.L. All rights reserved. -// This code is governed by the BSD license found in the LICENSE file. -/*--- -esid: sec-temporal.plaindatetime.prototype.toplainyearmonth -description: If a calendar's fields() method returns a field named 'constructor', PrepareTemporalFields should throw a RangeError. -includes: [temporalHelpers.js] -features: [Temporal] ----*/ - -const calendar = TemporalHelpers.calendarWithExtraFields(['constructor']); -const datetime = new Temporal.PlainDateTime(2023, 5, 1, 0, 0, 0, 0, 0, 0, calendar); - -assert.throws(RangeError, () => datetime.toPlainYearMonth()); diff --git a/test/built-ins/Temporal/PlainDateTime/prototype/toPlainYearMonth/duplicate-calendar-fields.js b/test/built-ins/Temporal/PlainDateTime/prototype/toPlainYearMonth/duplicate-calendar-fields.js deleted file mode 100644 index e8bf36a8cc8..00000000000 --- a/test/built-ins/Temporal/PlainDateTime/prototype/toPlainYearMonth/duplicate-calendar-fields.js +++ /dev/null @@ -1,15 +0,0 @@ -// Copyright (C) 2023 Igalia, S.L. All rights reserved. -// This code is governed by the BSD license found in the LICENSE file. -/*--- -esid: sec-temporal.plaindatetime.prototype.toplainyearmonth -description: If a calendar's fields() method returns duplicate field names, PrepareTemporalFields should throw a RangeError. -includes: [temporalHelpers.js] -features: [Temporal] ----*/ - -for (const extra_fields of [['foo', 'foo'], ['monthCode'], ['year']]) { - const calendar = TemporalHelpers.calendarWithExtraFields(extra_fields); - const datetime = new Temporal.PlainDateTime(2023, 5, 1, 0, 0, 0, 0, 0, 0, calendar); - - assert.throws(RangeError, () => datetime.toPlainYearMonth()); -} diff --git a/test/built-ins/Temporal/PlainDateTime/prototype/toPlainYearMonth/length.js b/test/built-ins/Temporal/PlainDateTime/prototype/toPlainYearMonth/length.js deleted file mode 100644 index f5e656ddd5b..00000000000 --- a/test/built-ins/Temporal/PlainDateTime/prototype/toPlainYearMonth/length.js +++ /dev/null @@ -1,25 +0,0 @@ -// Copyright (C) 2020 Igalia, S.L. All rights reserved. -// This code is governed by the BSD license found in the LICENSE file. - -/*--- -esid: sec-temporal.plaindatetime.prototype.toplainyearmonth -description: Temporal.PlainDateTime.prototype.toPlainYearMonth.length is 0 -info: | - Every built-in function object, including constructors, has a "length" property whose value is - an integer. Unless otherwise specified, this value is equal to the largest number of named - arguments shown in the subclause headings for the function description. Optional parameters - (which are indicated with brackets: [ ]) or rest parameters (which are shown using the form - «...name») are not included in the default argument count. - - Unless otherwise specified, the "length" property of a built-in function object has the - attributes { [[Writable]]: false, [[Enumerable]]: false, [[Configurable]]: true }. -includes: [propertyHelper.js] -features: [Temporal] ----*/ - -verifyProperty(Temporal.PlainDateTime.prototype.toPlainYearMonth, "length", { - value: 0, - writable: false, - enumerable: false, - configurable: true, -}); diff --git a/test/built-ins/Temporal/PlainDateTime/prototype/toPlainYearMonth/name.js b/test/built-ins/Temporal/PlainDateTime/prototype/toPlainYearMonth/name.js deleted file mode 100644 index 5daacaf0cd4..00000000000 --- a/test/built-ins/Temporal/PlainDateTime/prototype/toPlainYearMonth/name.js +++ /dev/null @@ -1,23 +0,0 @@ -// Copyright (C) 2021 Igalia, S.L. All rights reserved. -// This code is governed by the BSD license found in the LICENSE file. - -/*--- -esid: sec-temporal.plaindatetime.prototype.toplainyearmonth -description: Temporal.PlainDateTime.prototype.toPlainYearMonth.name is "toPlainYearMonth". -info: | - Every built-in function object, including constructors, that is not identified as an anonymous - function has a "name" property whose value is a String. Unless otherwise specified, this value - is the name that is given to the function in this specification. - - Unless otherwise specified, the "name" property of a built-in function object, if it exists, - has the attributes { [[Writable]]: false, [[Enumerable]]: false, [[Configurable]]: true }. -includes: [propertyHelper.js] -features: [Temporal] ----*/ - -verifyProperty(Temporal.PlainDateTime.prototype.toPlainYearMonth, "name", { - value: "toPlainYearMonth", - writable: false, - enumerable: false, - configurable: true, -}); diff --git a/test/built-ins/Temporal/PlainDateTime/prototype/toPlainYearMonth/not-a-constructor.js b/test/built-ins/Temporal/PlainDateTime/prototype/toPlainYearMonth/not-a-constructor.js deleted file mode 100644 index 0296188dfd9..00000000000 --- a/test/built-ins/Temporal/PlainDateTime/prototype/toPlainYearMonth/not-a-constructor.js +++ /dev/null @@ -1,21 +0,0 @@ -// Copyright (C) 2021 Igalia, S.L. All rights reserved. -// This code is governed by the BSD license found in the LICENSE file. - -/*--- -esid: sec-temporal.plaindatetime.prototype.toplainyearmonth -description: > - Temporal.PlainDateTime.prototype.toPlainYearMonth does not implement [[Construct]], is not new-able -info: | - Built-in function objects that are not identified as constructors do not implement the - [[Construct]] internal method unless otherwise specified in the description of a particular - function. -includes: [isConstructor.js] -features: [Reflect.construct, Temporal] ----*/ - -assert.throws(TypeError, () => { - new Temporal.PlainDateTime.prototype.toPlainYearMonth(); -}, "Calling as constructor"); - -assert.sameValue(isConstructor(Temporal.PlainDateTime.prototype.toPlainYearMonth), false, - "isConstructor(Temporal.PlainDateTime.prototype.toPlainYearMonth)"); diff --git a/test/built-ins/Temporal/PlainDateTime/prototype/toPlainYearMonth/prop-desc.js b/test/built-ins/Temporal/PlainDateTime/prototype/toPlainYearMonth/prop-desc.js deleted file mode 100644 index 78d1e3ec682..00000000000 --- a/test/built-ins/Temporal/PlainDateTime/prototype/toPlainYearMonth/prop-desc.js +++ /dev/null @@ -1,21 +0,0 @@ -// Copyright (C) 2021 Igalia, S.L. All rights reserved. -// This code is governed by the BSD license found in the LICENSE file. - -/*--- -esid: sec-temporal.plaindatetime.prototype.toplainyearmonth -description: The "toPlainYearMonth" property of Temporal.PlainDateTime.prototype -includes: [propertyHelper.js] -features: [Temporal] ----*/ - -assert.sameValue( - typeof Temporal.PlainDateTime.prototype.toPlainYearMonth, - "function", - "`typeof PlainDateTime.prototype.toPlainYearMonth` is `function`" -); - -verifyProperty(Temporal.PlainDateTime.prototype, "toPlainYearMonth", { - writable: true, - enumerable: false, - configurable: true, -}); diff --git a/test/built-ins/Temporal/PlainDateTime/prototype/toPlainYearMonth/proto-in-calendar-fields.js b/test/built-ins/Temporal/PlainDateTime/prototype/toPlainYearMonth/proto-in-calendar-fields.js deleted file mode 100644 index 2c9c60888b9..00000000000 --- a/test/built-ins/Temporal/PlainDateTime/prototype/toPlainYearMonth/proto-in-calendar-fields.js +++ /dev/null @@ -1,13 +0,0 @@ -// Copyright (C) 2023 Igalia, S.L. All rights reserved. -// This code is governed by the BSD license found in the LICENSE file. -/*--- -esid: sec-temporal.plaindatetime.prototype.toplainyearmonth -description: If a calendar's fields() method returns a field named '__proto__', PrepareTemporalFields should throw a RangeError. -includes: [temporalHelpers.js] -features: [Temporal] ----*/ - -const calendar = TemporalHelpers.calendarWithExtraFields(['__proto__']); -const datetime = new Temporal.PlainDateTime(2023, 5, 1, 0, 0, 0, 0, 0, 0, calendar); - -assert.throws(RangeError, () => datetime.toPlainYearMonth()); diff --git a/test/built-ins/Temporal/ZonedDateTime/prototype/toPlainMonthDay/branding.js b/test/built-ins/Temporal/ZonedDateTime/prototype/toPlainMonthDay/branding.js deleted file mode 100644 index d758ea470ec..00000000000 --- a/test/built-ins/Temporal/ZonedDateTime/prototype/toPlainMonthDay/branding.js +++ /dev/null @@ -1,22 +0,0 @@ -// Copyright (C) 2021 Igalia, S.L. All rights reserved. -// This code is governed by the BSD license found in the LICENSE file. - -/*--- -esid: sec-temporal.zoneddatetime.prototype.toplainmonthday -description: Throw a TypeError if the receiver is invalid -features: [Symbol, Temporal] ----*/ - -const toPlainMonthDay = Temporal.ZonedDateTime.prototype.toPlainMonthDay; - -assert.sameValue(typeof toPlainMonthDay, "function"); - -assert.throws(TypeError, () => toPlainMonthDay.call(undefined), "undefined"); -assert.throws(TypeError, () => toPlainMonthDay.call(null), "null"); -assert.throws(TypeError, () => toPlainMonthDay.call(true), "true"); -assert.throws(TypeError, () => toPlainMonthDay.call(""), "empty string"); -assert.throws(TypeError, () => toPlainMonthDay.call(Symbol()), "symbol"); -assert.throws(TypeError, () => toPlainMonthDay.call(1), "1"); -assert.throws(TypeError, () => toPlainMonthDay.call({}), "plain object"); -assert.throws(TypeError, () => toPlainMonthDay.call(Temporal.ZonedDateTime), "Temporal.ZonedDateTime"); -assert.throws(TypeError, () => toPlainMonthDay.call(Temporal.ZonedDateTime.prototype), "Temporal.ZonedDateTime.prototype"); diff --git a/test/built-ins/Temporal/ZonedDateTime/prototype/toPlainMonthDay/builtin-calendar-no-array-iteration.js b/test/built-ins/Temporal/ZonedDateTime/prototype/toPlainMonthDay/builtin-calendar-no-array-iteration.js deleted file mode 100644 index 104df08e681..00000000000 --- a/test/built-ins/Temporal/ZonedDateTime/prototype/toPlainMonthDay/builtin-calendar-no-array-iteration.js +++ /dev/null @@ -1,20 +0,0 @@ -// Copyright (C) 2023 Igalia, S.L. All rights reserved. -// This code is governed by the BSD license found in the LICENSE file. - -/*--- -esid: sec-temporal.zoneddatetime.prototype.toplainmonthday -description: > - Calling the method on an instance constructed with a builtin calendar causes - no observable array iteration when getting the calendar fields. -features: [Temporal] ----*/ - -const arrayPrototypeSymbolIteratorOriginal = Array.prototype[Symbol.iterator]; -Array.prototype[Symbol.iterator] = function arrayIterator() { - throw new Test262Error("Array should not be iterated"); -} - -const instance = new Temporal.ZonedDateTime(1_000_000_000_000_000_000n, "UTC", "iso8601"); -instance.toPlainMonthDay(); - -Array.prototype[Symbol.iterator] = arrayPrototypeSymbolIteratorOriginal; diff --git a/test/built-ins/Temporal/ZonedDateTime/prototype/toPlainMonthDay/builtin-calendar-no-observable-calls.js b/test/built-ins/Temporal/ZonedDateTime/prototype/toPlainMonthDay/builtin-calendar-no-observable-calls.js deleted file mode 100644 index 0aa12beface..00000000000 --- a/test/built-ins/Temporal/ZonedDateTime/prototype/toPlainMonthDay/builtin-calendar-no-observable-calls.js +++ /dev/null @@ -1,34 +0,0 @@ -// Copyright (C) 2023 Igalia, S.L. All rights reserved. -// This code is governed by the BSD license found in the LICENSE file. - -/*--- -esid: sec-temporal.zoneddatetime.prototype.toplainmonthday -description: > - Calling the method on an instance constructed with a builtin calendar causes - no observable lookups or calls to calendar methods. -includes: [temporalHelpers.js] -features: [Temporal] ----*/ - -const fieldsOriginal = Object.getOwnPropertyDescriptor(Temporal.Calendar.prototype, "fields"); -Object.defineProperty(Temporal.Calendar.prototype, "fields", { - configurable: true, - enumerable: false, - get() { - TemporalHelpers.assertUnreachable("fields should not be looked up"); - }, -}); -const monthDayFromFieldsOriginal = Object.getOwnPropertyDescriptor(Temporal.Calendar.prototype, "monthDayFromFields"); -Object.defineProperty(Temporal.Calendar.prototype, "monthDayFromFields", { - configurable: true, - enumerable: false, - get() { - TemporalHelpers.assertUnreachable("monthDayFromFields should not be looked up"); - }, -}); - -const instance = new Temporal.ZonedDateTime(1_000_000_000_000_000_000n, "UTC", "iso8601"); -instance.toPlainMonthDay(); - -Object.defineProperty(Temporal.Calendar.prototype, "fields", fieldsOriginal); -Object.defineProperty(Temporal.Calendar.prototype, "monthDayFromFields", monthDayFromFieldsOriginal); diff --git a/test/built-ins/Temporal/ZonedDateTime/prototype/toPlainMonthDay/builtin-timezone-no-observable-calls.js b/test/built-ins/Temporal/ZonedDateTime/prototype/toPlainMonthDay/builtin-timezone-no-observable-calls.js deleted file mode 100644 index 96f1a3c5e62..00000000000 --- a/test/built-ins/Temporal/ZonedDateTime/prototype/toPlainMonthDay/builtin-timezone-no-observable-calls.js +++ /dev/null @@ -1,25 +0,0 @@ -// Copyright (C) 2023 Igalia, S.L. All rights reserved. -// This code is governed by the BSD license found in the LICENSE file. - -/*--- -esid: sec-temporal.zoneddatetime.prototype.toplainmonthday -description: > - Calling the method on an instance constructed with a builtin time zone causes - no observable lookups or calls to time zone methods. -includes: [temporalHelpers.js] -features: [Temporal] ----*/ - -const getOffsetNanosecondsForOriginal = Object.getOwnPropertyDescriptor(Temporal.TimeZone.prototype, "getOffsetNanosecondsFor"); -Object.defineProperty(Temporal.TimeZone.prototype, "getOffsetNanosecondsFor", { - configurable: true, - enumerable: false, - get() { - TemporalHelpers.assertUnreachable("getOffsetNanosecondsFor should not be looked up"); - }, -}); - -const instance = new Temporal.ZonedDateTime(1_000_000_000_000_000_000n, "UTC", "iso8601"); -instance.toPlainMonthDay(); - -Object.defineProperty(Temporal.TimeZone.prototype, "getOffsetNanosecondsFor", getOffsetNanosecondsForOriginal); diff --git a/test/built-ins/Temporal/ZonedDateTime/prototype/toPlainMonthDay/builtin.js b/test/built-ins/Temporal/ZonedDateTime/prototype/toPlainMonthDay/builtin.js deleted file mode 100644 index b9abcadc788..00000000000 --- a/test/built-ins/Temporal/ZonedDateTime/prototype/toPlainMonthDay/builtin.js +++ /dev/null @@ -1,33 +0,0 @@ -// Copyright (C) 2021 Igalia, S.L. All rights reserved. -// This code is governed by the BSD license found in the LICENSE file. - -/*--- -esid: sec-temporal.zoneddatetime.prototype.toplainmonthday -description: > - Tests that Temporal.ZonedDateTime.prototype.toPlainMonthDay - meets the requirements for built-in objects defined by the - introduction of chapter 17 of the ECMAScript Language Specification. -info: | - Built-in functions that are not constructors do not have a "prototype" property unless - otherwise specified in the description of a particular function. - - Unless specified otherwise, a built-in object that is callable as a function is a built-in - function object with the characteristics described in 10.3. Unless specified otherwise, the - [[Extensible]] internal slot of a built-in object initially has the value true. - - Unless otherwise specified every built-in function and every built-in constructor has the - Function prototype object [...] as the value of its [[Prototype]] internal slot. -features: [Temporal] ----*/ - -assert.sameValue(Object.isExtensible(Temporal.ZonedDateTime.prototype.toPlainMonthDay), - true, "Built-in objects must be extensible."); - -assert.sameValue(Object.prototype.toString.call(Temporal.ZonedDateTime.prototype.toPlainMonthDay), - "[object Function]", "Object.prototype.toString"); - -assert.sameValue(Object.getPrototypeOf(Temporal.ZonedDateTime.prototype.toPlainMonthDay), - Function.prototype, "prototype"); - -assert.sameValue(Temporal.ZonedDateTime.prototype.toPlainMonthDay.hasOwnProperty("prototype"), - false, "prototype property"); diff --git a/test/built-ins/Temporal/ZonedDateTime/prototype/toPlainMonthDay/calendar-arguments.js b/test/built-ins/Temporal/ZonedDateTime/prototype/toPlainMonthDay/calendar-arguments.js deleted file mode 100644 index 8fe60d2cc60..00000000000 --- a/test/built-ins/Temporal/ZonedDateTime/prototype/toPlainMonthDay/calendar-arguments.js +++ /dev/null @@ -1,29 +0,0 @@ -// Copyright (C) 2021 Igalia, S.L. All rights reserved. -// This code is governed by the BSD license found in the LICENSE file. - -/*--- -esid: sec-temporal.zoneddatetime.prototype.toplainmonthday -description: Correct options value is passed to calendar method -info: | - MonthDayFromFields ( calendar, fields [ , options ] ) - - 3. If options is not present, then - a. Set options to undefined. -includes: [temporalHelpers.js] -features: [Temporal] ----*/ - -class CustomCalendar extends Temporal.Calendar { - constructor() { - super("iso8601"); - } - monthDayFromFields(...args) { - assert.sameValue(args.length, 2, "args.length"); - assert.sameValue(typeof args[0], "object", "args[0]"); - assert.sameValue(args[1], undefined, "args[1]"); - return super.monthDayFromFields(...args); - } -} -const zonedDateTime = new Temporal.ZonedDateTime(957270896123456789n, "UTC", new CustomCalendar()); -const result = zonedDateTime.toPlainMonthDay(); -TemporalHelpers.assertPlainMonthDay(result, "M05", 2); diff --git a/test/built-ins/Temporal/ZonedDateTime/prototype/toPlainMonthDay/calendar-fields-iterable.js b/test/built-ins/Temporal/ZonedDateTime/prototype/toPlainMonthDay/calendar-fields-iterable.js deleted file mode 100644 index d542b9f3ccb..00000000000 --- a/test/built-ins/Temporal/ZonedDateTime/prototype/toPlainMonthDay/calendar-fields-iterable.js +++ /dev/null @@ -1,27 +0,0 @@ -// Copyright (C) 2021 Igalia, S.L. All rights reserved. -// This code is governed by the BSD license found in the LICENSE file. - -/*--- -esid: sec-temporal.zoneddatetime.prototype.toplainmonthday -description: Verify the result of calendar.fields() is treated correctly. -info: | - sec-temporal.zoneddatetime.prototype.toplainmonthday step 7: - 7. Let _fieldNames_ be ? CalendarFields(_calendar_, « *"day"*, *"monthCode"* »). - sec-temporal-calendarfields step 4: - 4. Let _result_ be ? IterableToList(_fieldsArray_). -includes: [compareArray.js, temporalHelpers.js] -features: [Temporal] ----*/ - -const expected = [ - "day", - "monthCode", -]; - -const calendar = TemporalHelpers.calendarFieldsIterable(); -const datetime = new Temporal.ZonedDateTime(1_000_000_000_000_000_000n, "UTC", calendar); -datetime.toPlainMonthDay(); - -assert.sameValue(calendar.fieldsCallCount, 1, "fields() method called once"); -assert.compareArray(calendar.fieldsCalledWith[0], expected, "fields() method called with correct args"); -assert(calendar.iteratorExhausted[0], "iterated through the whole iterable"); diff --git a/test/built-ins/Temporal/ZonedDateTime/prototype/toPlainMonthDay/calendar-fromfields-called-with-null-prototype-fields.js b/test/built-ins/Temporal/ZonedDateTime/prototype/toPlainMonthDay/calendar-fromfields-called-with-null-prototype-fields.js deleted file mode 100644 index c358b4cc828..00000000000 --- a/test/built-ins/Temporal/ZonedDateTime/prototype/toPlainMonthDay/calendar-fromfields-called-with-null-prototype-fields.js +++ /dev/null @@ -1,15 +0,0 @@ -// Copyright (C) 2022 Igalia, S.L. All rights reserved. -// This code is governed by the BSD license found in the LICENSE file. - -/*--- -esid: sec-temporal.zoneddatetime.prototype.toplainmonthday -description: > - Calendar.monthDayFromFields method is called with a null-prototype fields object -includes: [temporalHelpers.js] -features: [Temporal] ----*/ - -const calendar = TemporalHelpers.calendarCheckFieldsPrototypePollution(); -const instance = new Temporal.ZonedDateTime(0n, "UTC", calendar); -instance.toPlainMonthDay(); -assert.sameValue(calendar.monthDayFromFieldsCallCount, 1, "monthDayFromFields should have been called on the calendar"); diff --git a/test/built-ins/Temporal/ZonedDateTime/prototype/toPlainMonthDay/calendar-monthdayfromfields-called-with-options-undefined.js b/test/built-ins/Temporal/ZonedDateTime/prototype/toPlainMonthDay/calendar-monthdayfromfields-called-with-options-undefined.js deleted file mode 100644 index e1925185c5d..00000000000 --- a/test/built-ins/Temporal/ZonedDateTime/prototype/toPlainMonthDay/calendar-monthdayfromfields-called-with-options-undefined.js +++ /dev/null @@ -1,16 +0,0 @@ -// Copyright (C) 2022 Igalia, S.L. All rights reserved. -// This code is governed by the BSD license found in the LICENSE file. - -/*--- -esid: sec-temporal.zoneddatetime.prototype.toplainmonthday -description: > - Calendar.monthDayFromFields method is called with undefined as the options - value when call originates internally -includes: [temporalHelpers.js] -features: [Temporal] ----*/ - -const calendar = TemporalHelpers.calendarFromFieldsUndefinedOptions(); -const instance = new Temporal.ZonedDateTime(1_000_000_000_000_000_000n, "UTC", calendar); -instance.toPlainMonthDay(); -assert.sameValue(calendar.monthDayFromFieldsCallCount, 1); diff --git a/test/built-ins/Temporal/ZonedDateTime/prototype/toPlainMonthDay/calendar-result.js b/test/built-ins/Temporal/ZonedDateTime/prototype/toPlainMonthDay/calendar-result.js deleted file mode 100644 index c03cfbff763..00000000000 --- a/test/built-ins/Temporal/ZonedDateTime/prototype/toPlainMonthDay/calendar-result.js +++ /dev/null @@ -1,23 +0,0 @@ -// Copyright (C) 2021 Igalia, S.L. All rights reserved. -// This code is governed by the BSD license found in the LICENSE file. - -/*--- -esid: sec-temporal.zoneddatetime.prototype.toplainmonthday -description: TypeError thrown when calendar method returns an object with the wrong brand -info: | - MonthDayFromFields ( calendar, fields, options ) - - 4. Perform ? RequireInternalSlot(monthDay, [[InitializedTemporalMonthDay]]). -features: [Temporal] ----*/ - -class CustomCalendar extends Temporal.Calendar { - constructor() { - super("iso8601"); - } - monthDayFromFields() { - return {}; - } -} -const zonedDateTime = new Temporal.ZonedDateTime(957270896123456789n, "UTC", new CustomCalendar()); -assert.throws(TypeError, () => zonedDateTime.toPlainMonthDay()); diff --git a/test/built-ins/Temporal/ZonedDateTime/prototype/toPlainMonthDay/constructor-in-calendar-fields.js b/test/built-ins/Temporal/ZonedDateTime/prototype/toPlainMonthDay/constructor-in-calendar-fields.js deleted file mode 100644 index 14b0a742fac..00000000000 --- a/test/built-ins/Temporal/ZonedDateTime/prototype/toPlainMonthDay/constructor-in-calendar-fields.js +++ /dev/null @@ -1,13 +0,0 @@ -// Copyright (C) 2023 Igalia, S.L. All rights reserved. -// This code is governed by the BSD license found in the LICENSE file. -/*--- -esid: sec-temporal.zoneddatetime.prototype.toplainmonthday -description: If a calendar's fields() method returns a field named 'constructor', PrepareTemporalFields should throw a RangeError. -includes: [temporalHelpers.js] -features: [Temporal] ----*/ - -const calendar = TemporalHelpers.calendarWithExtraFields(['constructor']); -const zoneddatetime = new Temporal.ZonedDateTime(1682892000000000000n, 'Europe/Madrid', calendar); - -assert.throws(RangeError, () => zoneddatetime.toPlainMonthDay()); diff --git a/test/built-ins/Temporal/ZonedDateTime/prototype/toPlainMonthDay/duplicate-calendar-fields.js b/test/built-ins/Temporal/ZonedDateTime/prototype/toPlainMonthDay/duplicate-calendar-fields.js deleted file mode 100644 index 2321c14d2cc..00000000000 --- a/test/built-ins/Temporal/ZonedDateTime/prototype/toPlainMonthDay/duplicate-calendar-fields.js +++ /dev/null @@ -1,15 +0,0 @@ -// Copyright (C) 2023 Igalia, S.L. All rights reserved. -// This code is governed by the BSD license found in the LICENSE file. -/*--- -esid: sec-temporal.zoneddatetime.prototype.toplainmonthday -description: If a calendar's fields() method returns duplicate field names, PrepareTemporalFields should throw a RangeError. -includes: [temporalHelpers.js] -features: [Temporal] ----*/ - -for (const extra_fields of [['foo', 'foo'], ['monthCode'], ['day']]) { - const calendar = TemporalHelpers.calendarWithExtraFields(extra_fields); - const zoneddatetime = new Temporal.ZonedDateTime(1682892000000000000n, 'Europe/Madrid', calendar); - - assert.throws(RangeError, () => zoneddatetime.toPlainMonthDay()); -} diff --git a/test/built-ins/Temporal/ZonedDateTime/prototype/toPlainMonthDay/length.js b/test/built-ins/Temporal/ZonedDateTime/prototype/toPlainMonthDay/length.js deleted file mode 100644 index f1d40d3b229..00000000000 --- a/test/built-ins/Temporal/ZonedDateTime/prototype/toPlainMonthDay/length.js +++ /dev/null @@ -1,25 +0,0 @@ -// Copyright (C) 2021 Igalia, S.L. All rights reserved. -// This code is governed by the BSD license found in the LICENSE file. - -/*--- -esid: sec-temporal.zoneddatetime.prototype.toplainmonthday -description: Temporal.ZonedDateTime.prototype.toPlainMonthDay.length is 0 -info: | - Every built-in function object, including constructors, has a "length" property whose value is - an integer. Unless otherwise specified, this value is equal to the largest number of named - arguments shown in the subclause headings for the function description. Optional parameters - (which are indicated with brackets: [ ]) or rest parameters (which are shown using the form - «...name») are not included in the default argument count. - - Unless otherwise specified, the "length" property of a built-in function object has the - attributes { [[Writable]]: false, [[Enumerable]]: false, [[Configurable]]: true }. -includes: [propertyHelper.js] -features: [Temporal] ----*/ - -verifyProperty(Temporal.ZonedDateTime.prototype.toPlainMonthDay, "length", { - value: 0, - writable: false, - enumerable: false, - configurable: true, -}); diff --git a/test/built-ins/Temporal/ZonedDateTime/prototype/toPlainMonthDay/name.js b/test/built-ins/Temporal/ZonedDateTime/prototype/toPlainMonthDay/name.js deleted file mode 100644 index 06b551c3c47..00000000000 --- a/test/built-ins/Temporal/ZonedDateTime/prototype/toPlainMonthDay/name.js +++ /dev/null @@ -1,23 +0,0 @@ -// Copyright (C) 2021 Igalia, S.L. All rights reserved. -// This code is governed by the BSD license found in the LICENSE file. - -/*--- -esid: sec-temporal.zoneddatetime.prototype.toplainmonthday -description: Temporal.ZonedDateTime.prototype.toPlainMonthDay.name is "toPlainMonthDay". -info: | - Every built-in function object, including constructors, that is not identified as an anonymous - function has a "name" property whose value is a String. Unless otherwise specified, this value - is the name that is given to the function in this specification. - - Unless otherwise specified, the "name" property of a built-in function object, if it exists, - has the attributes { [[Writable]]: false, [[Enumerable]]: false, [[Configurable]]: true }. -includes: [propertyHelper.js] -features: [Temporal] ----*/ - -verifyProperty(Temporal.ZonedDateTime.prototype.toPlainMonthDay, "name", { - value: "toPlainMonthDay", - writable: false, - enumerable: false, - configurable: true, -}); diff --git a/test/built-ins/Temporal/ZonedDateTime/prototype/toPlainMonthDay/not-a-constructor.js b/test/built-ins/Temporal/ZonedDateTime/prototype/toPlainMonthDay/not-a-constructor.js deleted file mode 100644 index def4383625f..00000000000 --- a/test/built-ins/Temporal/ZonedDateTime/prototype/toPlainMonthDay/not-a-constructor.js +++ /dev/null @@ -1,21 +0,0 @@ -// Copyright (C) 2021 Igalia, S.L. All rights reserved. -// This code is governed by the BSD license found in the LICENSE file. - -/*--- -esid: sec-temporal.zoneddatetime.prototype.toplainmonthday -description: > - Temporal.ZonedDateTime.prototype.toPlainMonthDay does not implement [[Construct]], is not new-able -info: | - Built-in function objects that are not identified as constructors do not implement the - [[Construct]] internal method unless otherwise specified in the description of a particular - function. -includes: [isConstructor.js] -features: [Reflect.construct, Temporal] ----*/ - -assert.throws(TypeError, () => { - new Temporal.ZonedDateTime.prototype.toPlainMonthDay(); -}, "Calling as constructor"); - -assert.sameValue(isConstructor(Temporal.ZonedDateTime.prototype.toPlainMonthDay), false, - "isConstructor(Temporal.ZonedDateTime.prototype.toPlainMonthDay)"); diff --git a/test/built-ins/Temporal/ZonedDateTime/prototype/toPlainMonthDay/order-of-operations.js b/test/built-ins/Temporal/ZonedDateTime/prototype/toPlainMonthDay/order-of-operations.js deleted file mode 100644 index 79b2622529f..00000000000 --- a/test/built-ins/Temporal/ZonedDateTime/prototype/toPlainMonthDay/order-of-operations.js +++ /dev/null @@ -1,48 +0,0 @@ -// Copyright (C) 2023 Igalia, S.L. All rights reserved. -// This code is governed by the BSD license found in the LICENSE file. - -/*--- -esid: sec-temporal.zoneddatetime.prototype.toplainmonthday -description: > - User-observable time zone and calendar accesses and calls in - toPlainMonthDay() happen the correct order -includes: [compareArray.js, temporalHelpers.js] -features: [Temporal] ----*/ - -const expected = [ - "get this.calendar.fields", - "get this.calendar.monthDayFromFields", - "get this.timeZone.getOffsetNanosecondsFor", - "call this.timeZone.getOffsetNanosecondsFor", - "call this.calendar.fields", - "get this.calendar.day", - "call this.calendar.day", - "get this.calendar.monthCode", - "call this.calendar.monthCode", - "call this.calendar.monthDayFromFields", -]; -const actual = []; - -const timeZone = TemporalHelpers.timeZoneObserver(actual, "this.timeZone"); -const calendar = TemporalHelpers.calendarObserver(actual, "this.calendar"); -const instance = new Temporal.ZonedDateTime(0n, timeZone, calendar); -Object.defineProperties(instance, { - day: { - get() { - actual.push("get this.day"); - return TemporalHelpers.toPrimitiveObserver(actual, 1, "this.day"); - } - }, - monthCode: { - get() { - actual.push("get this.monthCode"); - return TemporalHelpers.toPrimitiveObserver(actual, "M01", "this.monthCode"); - } - }, -}); -// clear observable operations that occurred during the constructor call -actual.splice(0); - -instance.toPlainMonthDay(); -assert.compareArray(actual, expected, "order of operations"); diff --git a/test/built-ins/Temporal/ZonedDateTime/prototype/toPlainMonthDay/prop-desc.js b/test/built-ins/Temporal/ZonedDateTime/prototype/toPlainMonthDay/prop-desc.js deleted file mode 100644 index bebb091b1b9..00000000000 --- a/test/built-ins/Temporal/ZonedDateTime/prototype/toPlainMonthDay/prop-desc.js +++ /dev/null @@ -1,21 +0,0 @@ -// Copyright (C) 2021 Igalia, S.L. All rights reserved. -// This code is governed by the BSD license found in the LICENSE file. - -/*--- -esid: sec-temporal.zoneddatetime.prototype.toplainmonthday -description: The "toPlainMonthDay" property of Temporal.ZonedDateTime.prototype -includes: [propertyHelper.js] -features: [Temporal] ----*/ - -assert.sameValue( - typeof Temporal.ZonedDateTime.prototype.toPlainMonthDay, - "function", - "`typeof ZonedDateTime.prototype.toPlainMonthDay` is `function`" -); - -verifyProperty(Temporal.ZonedDateTime.prototype, "toPlainMonthDay", { - writable: true, - enumerable: false, - configurable: true, -}); diff --git a/test/built-ins/Temporal/ZonedDateTime/prototype/toPlainMonthDay/proto-in-calendar-fields.js b/test/built-ins/Temporal/ZonedDateTime/prototype/toPlainMonthDay/proto-in-calendar-fields.js deleted file mode 100644 index 057adfd8939..00000000000 --- a/test/built-ins/Temporal/ZonedDateTime/prototype/toPlainMonthDay/proto-in-calendar-fields.js +++ /dev/null @@ -1,13 +0,0 @@ -// Copyright (C) 2023 Igalia, S.L. All rights reserved. -// This code is governed by the BSD license found in the LICENSE file. -/*--- -esid: sec-temporal.zoneddatetime.prototype.toplainmonthday -description: If a calendar's fields() method returns a field named '__proto__', PrepareTemporalFields should throw a RangeError. -includes: [temporalHelpers.js] -features: [Temporal] ----*/ - -const calendar = TemporalHelpers.calendarWithExtraFields(['__proto__']); -const zoneddatetime = new Temporal.ZonedDateTime(1682892000000000000n, 'Europe/Madrid', calendar); - -assert.throws(RangeError, () => zoneddatetime.toPlainMonthDay()); diff --git a/test/built-ins/Temporal/ZonedDateTime/prototype/toPlainMonthDay/timezone-getoffsetnanosecondsfor-non-integer.js b/test/built-ins/Temporal/ZonedDateTime/prototype/toPlainMonthDay/timezone-getoffsetnanosecondsfor-non-integer.js deleted file mode 100644 index 3c239463449..00000000000 --- a/test/built-ins/Temporal/ZonedDateTime/prototype/toPlainMonthDay/timezone-getoffsetnanosecondsfor-non-integer.js +++ /dev/null @@ -1,15 +0,0 @@ -// Copyright (C) 2021 Igalia, S.L. All rights reserved. -// This code is governed by the BSD license found in the LICENSE file. - -/*--- -esid: sec-temporal.zoneddatetime.prototype.toplainmonthday -description: RangeError thrown if time zone reports an offset that is not an integer number of nanoseconds -features: [Temporal] -includes: [temporalHelpers.js] ----*/ - -[3600_000_000_000.5, NaN, -Infinity, Infinity].forEach((wrongOffset) => { - const timeZone = TemporalHelpers.specificOffsetTimeZone(wrongOffset); - const datetime = new Temporal.ZonedDateTime(1_000_000_000_987_654_321n, timeZone); - assert.throws(RangeError, () => datetime.toPlainMonthDay()); -}); diff --git a/test/built-ins/Temporal/ZonedDateTime/prototype/toPlainMonthDay/timezone-getoffsetnanosecondsfor-not-callable.js b/test/built-ins/Temporal/ZonedDateTime/prototype/toPlainMonthDay/timezone-getoffsetnanosecondsfor-not-callable.js deleted file mode 100644 index 8678c3d74de..00000000000 --- a/test/built-ins/Temporal/ZonedDateTime/prototype/toPlainMonthDay/timezone-getoffsetnanosecondsfor-not-callable.js +++ /dev/null @@ -1,19 +0,0 @@ -// Copyright (C) 2021 Igalia, S.L. All rights reserved. -// This code is governed by the BSD license found in the LICENSE file. - -/*--- -esid: sec-temporal.zoneddatetime.prototype.toplainmonthday -description: TypeError thrown if timeZone.getOffsetNanosecondsFor is not callable -features: [BigInt, Symbol, Temporal, arrow-function] ----*/ - -[undefined, null, true, Math.PI, 'string', Symbol('sym'), 42n, {}].forEach((notCallable) => { - const timeZone = new Temporal.TimeZone("UTC"); - const datetime = new Temporal.ZonedDateTime(1_000_000_000_987_654_321n, timeZone); - timeZone.getOffsetNanosecondsFor = notCallable; - assert.throws( - TypeError, - () => datetime.toPlainMonthDay(), - `Uncallable ${notCallable === null ? 'null' : typeof notCallable} getOffsetNanosecondsFor should throw TypeError` - ); -}); diff --git a/test/built-ins/Temporal/ZonedDateTime/prototype/toPlainMonthDay/timezone-getoffsetnanosecondsfor-out-of-range.js b/test/built-ins/Temporal/ZonedDateTime/prototype/toPlainMonthDay/timezone-getoffsetnanosecondsfor-out-of-range.js deleted file mode 100644 index 6e58e56fdc9..00000000000 --- a/test/built-ins/Temporal/ZonedDateTime/prototype/toPlainMonthDay/timezone-getoffsetnanosecondsfor-out-of-range.js +++ /dev/null @@ -1,15 +0,0 @@ -// Copyright (C) 2021 Igalia, S.L. All rights reserved. -// This code is governed by the BSD license found in the LICENSE file. - -/*--- -esid: sec-temporal.zoneddatetime.prototype.toplainmonthday -description: RangeError thrown if time zone reports an offset that is out of range -features: [Temporal] -includes: [temporalHelpers.js] ----*/ - -[-86400_000_000_000, 86400_000_000_000].forEach((wrongOffset) => { - const timeZone = TemporalHelpers.specificOffsetTimeZone(wrongOffset); - const datetime = new Temporal.ZonedDateTime(1_000_000_000_987_654_321n, timeZone); - assert.throws(RangeError, () => datetime.toPlainMonthDay()); -}); diff --git a/test/built-ins/Temporal/ZonedDateTime/prototype/toPlainMonthDay/timezone-getoffsetnanosecondsfor-wrong-type.js b/test/built-ins/Temporal/ZonedDateTime/prototype/toPlainMonthDay/timezone-getoffsetnanosecondsfor-wrong-type.js deleted file mode 100644 index 334a531ba07..00000000000 --- a/test/built-ins/Temporal/ZonedDateTime/prototype/toPlainMonthDay/timezone-getoffsetnanosecondsfor-wrong-type.js +++ /dev/null @@ -1,24 +0,0 @@ -// Copyright (C) 2021 Igalia, S.L. All rights reserved. -// This code is governed by the BSD license found in the LICENSE file. - -/*--- -esid: sec-temporal.zoneddatetime.prototype.toplainmonthday -description: TypeError thrown if time zone reports an offset that is not a Number -features: [Temporal] -includes: [temporalHelpers.js] ----*/ - -[ - undefined, - null, - true, - "+01:00", - Symbol(), - 3600_000_000_000n, - {}, - { valueOf() { return 3600_000_000_000; } }, -].forEach((wrongOffset) => { - const timeZone = TemporalHelpers.specificOffsetTimeZone(wrongOffset); - const datetime = new Temporal.ZonedDateTime(1_000_000_000_987_654_321n, timeZone); - assert.throws(TypeError, () => datetime.toPlainMonthDay()); -}); diff --git a/test/built-ins/Temporal/ZonedDateTime/prototype/toPlainYearMonth/branding.js b/test/built-ins/Temporal/ZonedDateTime/prototype/toPlainYearMonth/branding.js deleted file mode 100644 index 772c7f4320b..00000000000 --- a/test/built-ins/Temporal/ZonedDateTime/prototype/toPlainYearMonth/branding.js +++ /dev/null @@ -1,22 +0,0 @@ -// Copyright (C) 2021 Igalia, S.L. All rights reserved. -// This code is governed by the BSD license found in the LICENSE file. - -/*--- -esid: sec-temporal.zoneddatetime.prototype.toplainyearmonth -description: Throw a TypeError if the receiver is invalid -features: [Symbol, Temporal] ----*/ - -const toPlainYearMonth = Temporal.ZonedDateTime.prototype.toPlainYearMonth; - -assert.sameValue(typeof toPlainYearMonth, "function"); - -assert.throws(TypeError, () => toPlainYearMonth.call(undefined), "undefined"); -assert.throws(TypeError, () => toPlainYearMonth.call(null), "null"); -assert.throws(TypeError, () => toPlainYearMonth.call(true), "true"); -assert.throws(TypeError, () => toPlainYearMonth.call(""), "empty string"); -assert.throws(TypeError, () => toPlainYearMonth.call(Symbol()), "symbol"); -assert.throws(TypeError, () => toPlainYearMonth.call(1), "1"); -assert.throws(TypeError, () => toPlainYearMonth.call({}), "plain object"); -assert.throws(TypeError, () => toPlainYearMonth.call(Temporal.ZonedDateTime), "Temporal.ZonedDateTime"); -assert.throws(TypeError, () => toPlainYearMonth.call(Temporal.ZonedDateTime.prototype), "Temporal.ZonedDateTime.prototype"); diff --git a/test/built-ins/Temporal/ZonedDateTime/prototype/toPlainYearMonth/builtin-calendar-no-array-iteration.js b/test/built-ins/Temporal/ZonedDateTime/prototype/toPlainYearMonth/builtin-calendar-no-array-iteration.js deleted file mode 100644 index e098d857ab3..00000000000 --- a/test/built-ins/Temporal/ZonedDateTime/prototype/toPlainYearMonth/builtin-calendar-no-array-iteration.js +++ /dev/null @@ -1,20 +0,0 @@ -// Copyright (C) 2023 Igalia, S.L. All rights reserved. -// This code is governed by the BSD license found in the LICENSE file. - -/*--- -esid: sec-temporal.zoneddatetime.prototype.toplainyearmonth -description: > - Calling the method on an instance constructed with a builtin calendar causes - no observable array iteration when getting the calendar fields. -features: [Temporal] ----*/ - -const arrayPrototypeSymbolIteratorOriginal = Array.prototype[Symbol.iterator]; -Array.prototype[Symbol.iterator] = function arrayIterator() { - throw new Test262Error("Array should not be iterated"); -} - -const instance = new Temporal.ZonedDateTime(1_000_000_000_000_000_000n, "UTC", "iso8601"); -instance.toPlainYearMonth(); - -Array.prototype[Symbol.iterator] = arrayPrototypeSymbolIteratorOriginal; diff --git a/test/built-ins/Temporal/ZonedDateTime/prototype/toPlainYearMonth/builtin-calendar-no-observable-calls.js b/test/built-ins/Temporal/ZonedDateTime/prototype/toPlainYearMonth/builtin-calendar-no-observable-calls.js deleted file mode 100644 index 32a688f7ec3..00000000000 --- a/test/built-ins/Temporal/ZonedDateTime/prototype/toPlainYearMonth/builtin-calendar-no-observable-calls.js +++ /dev/null @@ -1,34 +0,0 @@ -// Copyright (C) 2023 Igalia, S.L. All rights reserved. -// This code is governed by the BSD license found in the LICENSE file. - -/*--- -esid: sec-temporal.zoneddatetime.prototype.toplainyearmonth -description: > - Calling the method on an instance constructed with a builtin calendar causes - no observable lookups or calls to calendar methods. -includes: [temporalHelpers.js] -features: [Temporal] ----*/ - -const fieldsOriginal = Object.getOwnPropertyDescriptor(Temporal.Calendar.prototype, "fields"); -Object.defineProperty(Temporal.Calendar.prototype, "fields", { - configurable: true, - enumerable: false, - get() { - TemporalHelpers.assertUnreachable("fields should not be looked up"); - }, -}); -const yearMonthFromFieldsOriginal = Object.getOwnPropertyDescriptor(Temporal.Calendar.prototype, "yearMonthFromFields"); -Object.defineProperty(Temporal.Calendar.prototype, "yearMonthFromFields", { - configurable: true, - enumerable: false, - get() { - TemporalHelpers.assertUnreachable("yearMonthFromFields should not be looked up"); - }, -}); - -const instance = new Temporal.ZonedDateTime(1_000_000_000_000_000_000n, "UTC", "iso8601"); -instance.toPlainYearMonth(); - -Object.defineProperty(Temporal.Calendar.prototype, "fields", fieldsOriginal); -Object.defineProperty(Temporal.Calendar.prototype, "yearMonthFromFields", yearMonthFromFieldsOriginal); diff --git a/test/built-ins/Temporal/ZonedDateTime/prototype/toPlainYearMonth/builtin-timezone-no-observable-calls.js b/test/built-ins/Temporal/ZonedDateTime/prototype/toPlainYearMonth/builtin-timezone-no-observable-calls.js deleted file mode 100644 index 58916e55768..00000000000 --- a/test/built-ins/Temporal/ZonedDateTime/prototype/toPlainYearMonth/builtin-timezone-no-observable-calls.js +++ /dev/null @@ -1,25 +0,0 @@ -// Copyright (C) 2023 Igalia, S.L. All rights reserved. -// This code is governed by the BSD license found in the LICENSE file. - -/*--- -esid: sec-temporal.zoneddatetime.prototype.toplainyearmonth -description: > - Calling the method on an instance constructed with a builtin time zone causes - no observable lookups or calls to time zone methods. -includes: [temporalHelpers.js] -features: [Temporal] ----*/ - -const getOffsetNanosecondsForOriginal = Object.getOwnPropertyDescriptor(Temporal.TimeZone.prototype, "getOffsetNanosecondsFor"); -Object.defineProperty(Temporal.TimeZone.prototype, "getOffsetNanosecondsFor", { - configurable: true, - enumerable: false, - get() { - TemporalHelpers.assertUnreachable("getOffsetNanosecondsFor should not be looked up"); - }, -}); - -const instance = new Temporal.ZonedDateTime(1_000_000_000_000_000_000n, "UTC", "iso8601"); -instance.toPlainYearMonth(); - -Object.defineProperty(Temporal.TimeZone.prototype, "getOffsetNanosecondsFor", getOffsetNanosecondsForOriginal); diff --git a/test/built-ins/Temporal/ZonedDateTime/prototype/toPlainYearMonth/builtin.js b/test/built-ins/Temporal/ZonedDateTime/prototype/toPlainYearMonth/builtin.js deleted file mode 100644 index 9446a1db131..00000000000 --- a/test/built-ins/Temporal/ZonedDateTime/prototype/toPlainYearMonth/builtin.js +++ /dev/null @@ -1,33 +0,0 @@ -// Copyright (C) 2021 Igalia, S.L. All rights reserved. -// This code is governed by the BSD license found in the LICENSE file. - -/*--- -esid: sec-temporal.zoneddatetime.prototype.toplainyearmonth -description: > - Tests that Temporal.ZonedDateTime.prototype.toPlainYearMonth - meets the requirements for built-in objects defined by the - introduction of chapter 17 of the ECMAScript Language Specification. -info: | - Built-in functions that are not constructors do not have a "prototype" property unless - otherwise specified in the description of a particular function. - - Unless specified otherwise, a built-in object that is callable as a function is a built-in - function object with the characteristics described in 10.3. Unless specified otherwise, the - [[Extensible]] internal slot of a built-in object initially has the value true. - - Unless otherwise specified every built-in function and every built-in constructor has the - Function prototype object [...] as the value of its [[Prototype]] internal slot. -features: [Temporal] ----*/ - -assert.sameValue(Object.isExtensible(Temporal.ZonedDateTime.prototype.toPlainYearMonth), - true, "Built-in objects must be extensible."); - -assert.sameValue(Object.prototype.toString.call(Temporal.ZonedDateTime.prototype.toPlainYearMonth), - "[object Function]", "Object.prototype.toString"); - -assert.sameValue(Object.getPrototypeOf(Temporal.ZonedDateTime.prototype.toPlainYearMonth), - Function.prototype, "prototype"); - -assert.sameValue(Temporal.ZonedDateTime.prototype.toPlainYearMonth.hasOwnProperty("prototype"), - false, "prototype property"); diff --git a/test/built-ins/Temporal/ZonedDateTime/prototype/toPlainYearMonth/calendar-arguments.js b/test/built-ins/Temporal/ZonedDateTime/prototype/toPlainYearMonth/calendar-arguments.js deleted file mode 100644 index 4cf9c1f921c..00000000000 --- a/test/built-ins/Temporal/ZonedDateTime/prototype/toPlainYearMonth/calendar-arguments.js +++ /dev/null @@ -1,29 +0,0 @@ -// Copyright (C) 2021 Igalia, S.L. All rights reserved. -// This code is governed by the BSD license found in the LICENSE file. - -/*--- -esid: sec-temporal.zoneddatetime.prototype.toplainyearmonth -description: Correct options value is passed to calendar method -info: | - YearMonthFromFields ( calendar, fields [ , options ] ) - - 3. If options is not present, then - a. Set options to undefined. -includes: [temporalHelpers.js] -features: [Temporal] ----*/ - -class CustomCalendar extends Temporal.Calendar { - constructor() { - super("iso8601"); - } - yearMonthFromFields(...args) { - assert.sameValue(args.length, 2, "args.length"); - assert.sameValue(typeof args[0], "object", "args[0]"); - assert.sameValue(args[1], undefined, "args[1]"); - return super.yearMonthFromFields(...args); - } -} -const zonedDateTime = new Temporal.ZonedDateTime(957270896123456789n, "UTC", new CustomCalendar()); -const result = zonedDateTime.toPlainYearMonth(); -TemporalHelpers.assertPlainYearMonth(result, 2000, 5, "M05"); diff --git a/test/built-ins/Temporal/ZonedDateTime/prototype/toPlainYearMonth/calendar-fields-iterable.js b/test/built-ins/Temporal/ZonedDateTime/prototype/toPlainYearMonth/calendar-fields-iterable.js deleted file mode 100644 index 9b096ac6e05..00000000000 --- a/test/built-ins/Temporal/ZonedDateTime/prototype/toPlainYearMonth/calendar-fields-iterable.js +++ /dev/null @@ -1,27 +0,0 @@ -// Copyright (C) 2021 Igalia, S.L. All rights reserved. -// This code is governed by the BSD license found in the LICENSE file. - -/*--- -esid: sec-temporal.zoneddatetime.prototype.toplainyearmonth -description: Verify the result of calendar.fields() is treated correctly. -info: | - sec-temporal.zoneddatetime.prototype.toplainyearmonth step 7: - 7. Let _fieldNames_ be ? CalendarFields(_calendar_, « *"monthCode"*, *"year"* »). - sec-temporal-calendarfields step 4: - 4. Let _result_ be ? IterableToList(_fieldsArray_). -includes: [compareArray.js, temporalHelpers.js] -features: [Temporal] ----*/ - -const expected = [ - "monthCode", - "year", -]; - -const calendar = TemporalHelpers.calendarFieldsIterable(); -const datetime = new Temporal.ZonedDateTime(1_000_000_000_000_000_000n, "UTC", calendar); -datetime.toPlainYearMonth(); - -assert.sameValue(calendar.fieldsCallCount, 1, "fields() method called once"); -assert.compareArray(calendar.fieldsCalledWith[0], expected, "fields() method called with correct args"); -assert(calendar.iteratorExhausted[0], "iterated through the whole iterable"); diff --git a/test/built-ins/Temporal/ZonedDateTime/prototype/toPlainYearMonth/calendar-fromfields-called-with-null-prototype-fields.js b/test/built-ins/Temporal/ZonedDateTime/prototype/toPlainYearMonth/calendar-fromfields-called-with-null-prototype-fields.js deleted file mode 100644 index a3339237433..00000000000 --- a/test/built-ins/Temporal/ZonedDateTime/prototype/toPlainYearMonth/calendar-fromfields-called-with-null-prototype-fields.js +++ /dev/null @@ -1,15 +0,0 @@ -// Copyright (C) 2022 Igalia, S.L. All rights reserved. -// This code is governed by the BSD license found in the LICENSE file. - -/*--- -esid: sec-temporal.zoneddatetime.prototype.toplainyearmonth -description: > - Calendar.yearMonthFromFields method is called with a null-prototype fields object -includes: [temporalHelpers.js] -features: [Temporal] ----*/ - -const calendar = TemporalHelpers.calendarCheckFieldsPrototypePollution(); -const instance = new Temporal.ZonedDateTime(0n, "UTC", calendar); -instance.toPlainYearMonth(); -assert.sameValue(calendar.yearMonthFromFieldsCallCount, 1, "yearMonthFromFields should have been called on the calendar"); diff --git a/test/built-ins/Temporal/ZonedDateTime/prototype/toPlainYearMonth/calendar-result.js b/test/built-ins/Temporal/ZonedDateTime/prototype/toPlainYearMonth/calendar-result.js deleted file mode 100644 index 61a67fd44f1..00000000000 --- a/test/built-ins/Temporal/ZonedDateTime/prototype/toPlainYearMonth/calendar-result.js +++ /dev/null @@ -1,23 +0,0 @@ -// Copyright (C) 2021 Igalia, S.L. All rights reserved. -// This code is governed by the BSD license found in the LICENSE file. - -/*--- -esid: sec-temporal.zoneddatetime.prototype.toplainyearmonth -description: TypeError thrown when calendar method returns an object with the wrong brand -info: | - YearMonthFromFields ( calendar, fields [ , options ] ) - - 4. Perform ? RequireInternalSlot(yearMonth, [[InitializedTemporalYearMonth]]). -features: [Temporal] ----*/ - -class CustomCalendar extends Temporal.Calendar { - constructor() { - super("iso8601"); - } - yearMonthFromFields() { - return {}; - } -} -const zonedDateTime = new Temporal.ZonedDateTime(957270896123456789n, "UTC", new CustomCalendar()); -assert.throws(TypeError, () => zonedDateTime.toPlainYearMonth()); diff --git a/test/built-ins/Temporal/ZonedDateTime/prototype/toPlainYearMonth/calendar-yearmonthfromfields-called-with-options-undefined.js b/test/built-ins/Temporal/ZonedDateTime/prototype/toPlainYearMonth/calendar-yearmonthfromfields-called-with-options-undefined.js deleted file mode 100644 index 8f75ba30b57..00000000000 --- a/test/built-ins/Temporal/ZonedDateTime/prototype/toPlainYearMonth/calendar-yearmonthfromfields-called-with-options-undefined.js +++ /dev/null @@ -1,16 +0,0 @@ -// Copyright (C) 2022 Igalia, S.L. All rights reserved. -// This code is governed by the BSD license found in the LICENSE file. - -/*--- -esid: sec-temporal.zoneddatetime.prototype.toplainyearmonth -description: > - Calendar.yearMonthFromFields method is called with undefined as the options - value when call originates internally -includes: [temporalHelpers.js] -features: [Temporal] ----*/ - -const calendar = TemporalHelpers.calendarFromFieldsUndefinedOptions(); -const instance = new Temporal.ZonedDateTime(1_000_000_000_000_000_000n, "UTC", calendar); -instance.toPlainYearMonth(); -assert.sameValue(calendar.yearMonthFromFieldsCallCount, 1); diff --git a/test/built-ins/Temporal/ZonedDateTime/prototype/toPlainYearMonth/constructor-in-calendar-fields.js b/test/built-ins/Temporal/ZonedDateTime/prototype/toPlainYearMonth/constructor-in-calendar-fields.js deleted file mode 100644 index 6fe0dd5e1d4..00000000000 --- a/test/built-ins/Temporal/ZonedDateTime/prototype/toPlainYearMonth/constructor-in-calendar-fields.js +++ /dev/null @@ -1,13 +0,0 @@ -// Copyright (C) 2023 Igalia, S.L. All rights reserved. -// This code is governed by the BSD license found in the LICENSE file. -/*--- -esid: sec-temporal.zoneddatetime.prototype.toplainyearmonth -description: If a calendar's fields() method returns a field named 'constructor', PrepareTemporalFields should throw a RangeError. -includes: [temporalHelpers.js] -features: [Temporal] ----*/ - -const calendar = TemporalHelpers.calendarWithExtraFields(['constructor']); -const zoneddatetime = new Temporal.ZonedDateTime(1682892000000000000n, 'Europe/Madrid', calendar); - -assert.throws(RangeError, () => zoneddatetime.toPlainYearMonth()); diff --git a/test/built-ins/Temporal/ZonedDateTime/prototype/toPlainYearMonth/duplicate-calendar-fields.js b/test/built-ins/Temporal/ZonedDateTime/prototype/toPlainYearMonth/duplicate-calendar-fields.js deleted file mode 100644 index 3592083aac2..00000000000 --- a/test/built-ins/Temporal/ZonedDateTime/prototype/toPlainYearMonth/duplicate-calendar-fields.js +++ /dev/null @@ -1,15 +0,0 @@ -// Copyright (C) 2023 Igalia, S.L. All rights reserved. -// This code is governed by the BSD license found in the LICENSE file. -/*--- -esid: sec-temporal.zoneddatetime.prototype.toplainyearmonth -description: If a calendar's fields() method returns duplicate field names, PrepareTemporalFields should throw a RangeError. -includes: [temporalHelpers.js] -features: [Temporal] ----*/ - -for (const extra_fields of [['foo', 'foo'], ['monthCode'], ['year']]) { - const calendar = TemporalHelpers.calendarWithExtraFields(extra_fields); - const zoneddatetime = new Temporal.ZonedDateTime(1682892000000000000n, 'Europe/Madrid', calendar); - - assert.throws(RangeError, () => zoneddatetime.toPlainYearMonth()); -} diff --git a/test/built-ins/Temporal/ZonedDateTime/prototype/toPlainYearMonth/length.js b/test/built-ins/Temporal/ZonedDateTime/prototype/toPlainYearMonth/length.js deleted file mode 100644 index fd99878bd06..00000000000 --- a/test/built-ins/Temporal/ZonedDateTime/prototype/toPlainYearMonth/length.js +++ /dev/null @@ -1,25 +0,0 @@ -// Copyright (C) 2021 Igalia, S.L. All rights reserved. -// This code is governed by the BSD license found in the LICENSE file. - -/*--- -esid: sec-temporal.zoneddatetime.prototype.toplainyearmonth -description: Temporal.ZonedDateTime.prototype.toPlainYearMonth.length is 0 -info: | - Every built-in function object, including constructors, has a "length" property whose value is - an integer. Unless otherwise specified, this value is equal to the largest number of named - arguments shown in the subclause headings for the function description. Optional parameters - (which are indicated with brackets: [ ]) or rest parameters (which are shown using the form - «...name») are not included in the default argument count. - - Unless otherwise specified, the "length" property of a built-in function object has the - attributes { [[Writable]]: false, [[Enumerable]]: false, [[Configurable]]: true }. -includes: [propertyHelper.js] -features: [Temporal] ----*/ - -verifyProperty(Temporal.ZonedDateTime.prototype.toPlainYearMonth, "length", { - value: 0, - writable: false, - enumerable: false, - configurable: true, -}); diff --git a/test/built-ins/Temporal/ZonedDateTime/prototype/toPlainYearMonth/name.js b/test/built-ins/Temporal/ZonedDateTime/prototype/toPlainYearMonth/name.js deleted file mode 100644 index ac49eb0f40d..00000000000 --- a/test/built-ins/Temporal/ZonedDateTime/prototype/toPlainYearMonth/name.js +++ /dev/null @@ -1,23 +0,0 @@ -// Copyright (C) 2021 Igalia, S.L. All rights reserved. -// This code is governed by the BSD license found in the LICENSE file. - -/*--- -esid: sec-temporal.zoneddatetime.prototype.toplainyearmonth -description: Temporal.ZonedDateTime.prototype.toPlainYearMonth.name is "toPlainYearMonth". -info: | - Every built-in function object, including constructors, that is not identified as an anonymous - function has a "name" property whose value is a String. Unless otherwise specified, this value - is the name that is given to the function in this specification. - - Unless otherwise specified, the "name" property of a built-in function object, if it exists, - has the attributes { [[Writable]]: false, [[Enumerable]]: false, [[Configurable]]: true }. -includes: [propertyHelper.js] -features: [Temporal] ----*/ - -verifyProperty(Temporal.ZonedDateTime.prototype.toPlainYearMonth, "name", { - value: "toPlainYearMonth", - writable: false, - enumerable: false, - configurable: true, -}); diff --git a/test/built-ins/Temporal/ZonedDateTime/prototype/toPlainYearMonth/not-a-constructor.js b/test/built-ins/Temporal/ZonedDateTime/prototype/toPlainYearMonth/not-a-constructor.js deleted file mode 100644 index ec99dfc7d5b..00000000000 --- a/test/built-ins/Temporal/ZonedDateTime/prototype/toPlainYearMonth/not-a-constructor.js +++ /dev/null @@ -1,21 +0,0 @@ -// Copyright (C) 2021 Igalia, S.L. All rights reserved. -// This code is governed by the BSD license found in the LICENSE file. - -/*--- -esid: sec-temporal.zoneddatetime.prototype.toplainyearmonth -description: > - Temporal.ZonedDateTime.prototype.toPlainYearMonth does not implement [[Construct]], is not new-able -info: | - Built-in function objects that are not identified as constructors do not implement the - [[Construct]] internal method unless otherwise specified in the description of a particular - function. -includes: [isConstructor.js] -features: [Reflect.construct, Temporal] ----*/ - -assert.throws(TypeError, () => { - new Temporal.ZonedDateTime.prototype.toPlainYearMonth(); -}, "Calling as constructor"); - -assert.sameValue(isConstructor(Temporal.ZonedDateTime.prototype.toPlainYearMonth), false, - "isConstructor(Temporal.ZonedDateTime.prototype.toPlainYearMonth)"); diff --git a/test/built-ins/Temporal/ZonedDateTime/prototype/toPlainYearMonth/order-of-operations.js b/test/built-ins/Temporal/ZonedDateTime/prototype/toPlainYearMonth/order-of-operations.js deleted file mode 100644 index ac4fda174bd..00000000000 --- a/test/built-ins/Temporal/ZonedDateTime/prototype/toPlainYearMonth/order-of-operations.js +++ /dev/null @@ -1,48 +0,0 @@ -// Copyright (C) 2023 Igalia, S.L. All rights reserved. -// This code is governed by the BSD license found in the LICENSE file. - -/*--- -esid: sec-temporal.zoneddatetime.prototype.toplainyearmonth -description: > - User-observable time zone and calendar accesses and calls in - toPlainYearMonth() happen the correct order -includes: [compareArray.js, temporalHelpers.js] -features: [Temporal] ----*/ - -const expected = [ - "get this.calendar.fields", - "get this.calendar.yearMonthFromFields", - "get this.timeZone.getOffsetNanosecondsFor", - "call this.timeZone.getOffsetNanosecondsFor", - "call this.calendar.fields", - "get this.calendar.monthCode", - "call this.calendar.monthCode", - "get this.calendar.year", - "call this.calendar.year", - "call this.calendar.yearMonthFromFields", -]; -const actual = []; - -const timeZone = TemporalHelpers.timeZoneObserver(actual, "this.timeZone"); -const calendar = TemporalHelpers.calendarObserver(actual, "this.calendar"); -const instance = new Temporal.ZonedDateTime(0n, timeZone, calendar); -Object.defineProperties(instance, { - monthCode: { - get() { - actual.push("get this.monthCode"); - return TemporalHelpers.toPrimitiveObserver(actual, "M01", "this.monthCode"); - } - }, - year: { - get() { - actual.push("get this.year"); - return TemporalHelpers.toPrimitiveObserver(actual, 1970, "this.year"); - } - }, -}); -// clear observable operations that occurred during the constructor call -actual.splice(0); - -instance.toPlainYearMonth(); -assert.compareArray(actual, expected, "order of operations"); diff --git a/test/built-ins/Temporal/ZonedDateTime/prototype/toPlainYearMonth/prop-desc.js b/test/built-ins/Temporal/ZonedDateTime/prototype/toPlainYearMonth/prop-desc.js deleted file mode 100644 index 3a331fa0115..00000000000 --- a/test/built-ins/Temporal/ZonedDateTime/prototype/toPlainYearMonth/prop-desc.js +++ /dev/null @@ -1,21 +0,0 @@ -// Copyright (C) 2021 Igalia, S.L. All rights reserved. -// This code is governed by the BSD license found in the LICENSE file. - -/*--- -esid: sec-temporal.zoneddatetime.prototype.toplainyearmonth -description: The "toPlainYearMonth" property of Temporal.ZonedDateTime.prototype -includes: [propertyHelper.js] -features: [Temporal] ----*/ - -assert.sameValue( - typeof Temporal.ZonedDateTime.prototype.toPlainYearMonth, - "function", - "`typeof ZonedDateTime.prototype.toPlainYearMonth` is `function`" -); - -verifyProperty(Temporal.ZonedDateTime.prototype, "toPlainYearMonth", { - writable: true, - enumerable: false, - configurable: true, -}); diff --git a/test/built-ins/Temporal/ZonedDateTime/prototype/toPlainYearMonth/proto-in-calendar-fields.js b/test/built-ins/Temporal/ZonedDateTime/prototype/toPlainYearMonth/proto-in-calendar-fields.js deleted file mode 100644 index 97b7ef2cebd..00000000000 --- a/test/built-ins/Temporal/ZonedDateTime/prototype/toPlainYearMonth/proto-in-calendar-fields.js +++ /dev/null @@ -1,13 +0,0 @@ -// Copyright (C) 2023 Igalia, S.L. All rights reserved. -// This code is governed by the BSD license found in the LICENSE file. -/*--- -esid: sec-temporal.zoneddatetime.prototype.toplainyearmonth -description: If a calendar's fields() method returns a field named '__proto__', PrepareTemporalFields should throw a RangeError. -includes: [temporalHelpers.js] -features: [Temporal] ----*/ - -const calendar = TemporalHelpers.calendarWithExtraFields(['__proto__']); -const zoneddatetime = new Temporal.ZonedDateTime(1682892000000000000n, 'Europe/Madrid', calendar); - -assert.throws(RangeError, () => zoneddatetime.toPlainYearMonth()); diff --git a/test/built-ins/Temporal/ZonedDateTime/prototype/toPlainYearMonth/timezone-getoffsetnanosecondsfor-non-integer.js b/test/built-ins/Temporal/ZonedDateTime/prototype/toPlainYearMonth/timezone-getoffsetnanosecondsfor-non-integer.js deleted file mode 100644 index f87b615cfe4..00000000000 --- a/test/built-ins/Temporal/ZonedDateTime/prototype/toPlainYearMonth/timezone-getoffsetnanosecondsfor-non-integer.js +++ /dev/null @@ -1,15 +0,0 @@ -// Copyright (C) 2021 Igalia, S.L. All rights reserved. -// This code is governed by the BSD license found in the LICENSE file. - -/*--- -esid: sec-temporal.zoneddatetime.prototype.toplainyearmonth -description: RangeError thrown if time zone reports an offset that is not an integer number of nanoseconds -features: [Temporal] -includes: [temporalHelpers.js] ----*/ - -[3600_000_000_000.5, NaN, -Infinity, Infinity].forEach((wrongOffset) => { - const timeZone = TemporalHelpers.specificOffsetTimeZone(wrongOffset); - const datetime = new Temporal.ZonedDateTime(1_000_000_000_987_654_321n, timeZone); - assert.throws(RangeError, () => datetime.toPlainYearMonth()); -}); diff --git a/test/built-ins/Temporal/ZonedDateTime/prototype/toPlainYearMonth/timezone-getoffsetnanosecondsfor-not-callable.js b/test/built-ins/Temporal/ZonedDateTime/prototype/toPlainYearMonth/timezone-getoffsetnanosecondsfor-not-callable.js deleted file mode 100644 index c229c2054c4..00000000000 --- a/test/built-ins/Temporal/ZonedDateTime/prototype/toPlainYearMonth/timezone-getoffsetnanosecondsfor-not-callable.js +++ /dev/null @@ -1,19 +0,0 @@ -// Copyright (C) 2021 Igalia, S.L. All rights reserved. -// This code is governed by the BSD license found in the LICENSE file. - -/*--- -esid: sec-temporal.zoneddatetime.prototype.toplainyearmonth -description: TypeError thrown if timeZone.getOffsetNanosecondsFor is not callable -features: [BigInt, Symbol, Temporal, arrow-function] ----*/ - -[undefined, null, true, Math.PI, 'string', Symbol('sym'), 42n, {}].forEach((notCallable) => { - const timeZone = new Temporal.TimeZone("UTC"); - const datetime = new Temporal.ZonedDateTime(1_000_000_000_987_654_321n, timeZone); - timeZone.getOffsetNanosecondsFor = notCallable; - assert.throws( - TypeError, - () => datetime.toPlainYearMonth(), - `Uncallable ${notCallable === null ? 'null' : typeof notCallable} getOffsetNanosecondsFor should throw TypeError` - ); -}); diff --git a/test/built-ins/Temporal/ZonedDateTime/prototype/toPlainYearMonth/timezone-getoffsetnanosecondsfor-out-of-range.js b/test/built-ins/Temporal/ZonedDateTime/prototype/toPlainYearMonth/timezone-getoffsetnanosecondsfor-out-of-range.js deleted file mode 100644 index a297f14ca1c..00000000000 --- a/test/built-ins/Temporal/ZonedDateTime/prototype/toPlainYearMonth/timezone-getoffsetnanosecondsfor-out-of-range.js +++ /dev/null @@ -1,15 +0,0 @@ -// Copyright (C) 2021 Igalia, S.L. All rights reserved. -// This code is governed by the BSD license found in the LICENSE file. - -/*--- -esid: sec-temporal.zoneddatetime.prototype.toplainyearmonth -description: RangeError thrown if time zone reports an offset that is out of range -features: [Temporal] -includes: [temporalHelpers.js] ----*/ - -[-86400_000_000_000, 86400_000_000_000].forEach((wrongOffset) => { - const timeZone = TemporalHelpers.specificOffsetTimeZone(wrongOffset); - const datetime = new Temporal.ZonedDateTime(1_000_000_000_987_654_321n, timeZone); - assert.throws(RangeError, () => datetime.toPlainYearMonth()); -}); diff --git a/test/built-ins/Temporal/ZonedDateTime/prototype/toPlainYearMonth/timezone-getoffsetnanosecondsfor-wrong-type.js b/test/built-ins/Temporal/ZonedDateTime/prototype/toPlainYearMonth/timezone-getoffsetnanosecondsfor-wrong-type.js deleted file mode 100644 index 4231ff9280e..00000000000 --- a/test/built-ins/Temporal/ZonedDateTime/prototype/toPlainYearMonth/timezone-getoffsetnanosecondsfor-wrong-type.js +++ /dev/null @@ -1,24 +0,0 @@ -// Copyright (C) 2021 Igalia, S.L. All rights reserved. -// This code is governed by the BSD license found in the LICENSE file. - -/*--- -esid: sec-temporal.zoneddatetime.prototype.toplainyearmonth -description: TypeError thrown if time zone reports an offset that is not a Number -features: [Temporal] -includes: [temporalHelpers.js] ----*/ - -[ - undefined, - null, - true, - "+01:00", - Symbol(), - 3600_000_000_000n, - {}, - { valueOf() { return 3600_000_000_000; } }, -].forEach((wrongOffset) => { - const timeZone = TemporalHelpers.specificOffsetTimeZone(wrongOffset); - const datetime = new Temporal.ZonedDateTime(1_000_000_000_987_654_321n, timeZone); - assert.throws(TypeError, () => datetime.toPlainYearMonth()); -}); diff --git a/test/staging/Temporal/ZonedDateTime/old/toPlainMonthDay.js b/test/staging/Temporal/ZonedDateTime/old/toPlainMonthDay.js deleted file mode 100644 index e0ca0b7c2aa..00000000000 --- a/test/staging/Temporal/ZonedDateTime/old/toPlainMonthDay.js +++ /dev/null @@ -1,48 +0,0 @@ -// Copyright (C) 2018 Bloomberg LP. All rights reserved. -// This code is governed by the BSD license found in the LICENSE file. - -/*--- -esid: sec-temporal-zoneddatetime-objects -description: Temporal.ZonedDateTime.prototype.toPlainMonthDay() -features: [Temporal] ----*/ - -var tz = new Temporal.TimeZone("-08:00"); - -// works -var zdt = Temporal.Instant.from("2019-10-29T09:46:38.271986102Z").toZonedDateTimeISO(tz); -assert.sameValue(`${ zdt.toPlainMonthDay() }`, "10-29"); - -// preserves the calendar -var fakeGregorian = { - id: 'gregory', - monthDayFromFields(fields) { - var md = Temporal.Calendar.from("iso8601").monthDayFromFields(fields); - var {isoYear, isoMonth, isoDay} = md.getISOFields(); - return new Temporal.PlainMonthDay(isoMonth, isoDay, this, isoYear); - }, - monthCode(date) { return date.withCalendar("iso8601").monthCode; }, - day(date) { return date.withCalendar("iso8601").day; }, - dateAdd() {}, - dateFromFields() {}, - dateUntil() {}, - dayOfWeek() {}, - dayOfYear() {}, - daysInMonth() {}, - daysInWeek() {}, - daysInYear() {}, - fields(fieldNames) { return fieldNames; }, - inLeapYear() {}, - mergeFields() {}, - month() {}, - monthsInYear() {}, - weekOfYear() {}, - year() {}, - yearMonthFromFields() {}, - yearOfWeek() {}, -}; -var zdt = Temporal.Instant.from("2019-10-29T09:46:38.271986102Z").toZonedDateTime({ - timeZone: tz, - calendar: fakeGregorian -}); -assert.sameValue(zdt.toPlainMonthDay().getCalendar(), fakeGregorian); diff --git a/test/staging/Temporal/ZonedDateTime/old/toPlainYearMonth.js b/test/staging/Temporal/ZonedDateTime/old/toPlainYearMonth.js deleted file mode 100644 index 1b33d284f14..00000000000 --- a/test/staging/Temporal/ZonedDateTime/old/toPlainYearMonth.js +++ /dev/null @@ -1,48 +0,0 @@ -// Copyright (C) 2018 Bloomberg LP. All rights reserved. -// This code is governed by the BSD license found in the LICENSE file. - -/*--- -esid: sec-temporal-zoneddatetime-objects -description: Temporal.ZonedDateTime.prototype.toPlainYearMonth() -features: [Temporal] ----*/ - -var tz = new Temporal.TimeZone("-08:00"); - -// works -var zdt = Temporal.Instant.from("2019-10-29T09:46:38.271986102Z").toZonedDateTimeISO(tz); -assert.sameValue(`${ zdt.toPlainYearMonth() }`, "2019-10"); - -// preserves the calendar -var fakeGregorian = { - id: 'gregory', - yearMonthFromFields(fields) { - var ym = Temporal.Calendar.from("iso8601").yearMonthFromFields(fields); - var {isoYear, isoMonth, isoDay} = ym.getISOFields(); - return new Temporal.PlainYearMonth(isoYear, isoMonth, this, isoDay); - }, - year(date) { return date.withCalendar("iso8601").year; }, - monthCode(date) { return date.withCalendar("iso8601").monthCode; }, - dateAdd() {}, - dateFromFields() {}, - dateUntil() {}, - day() {}, - dayOfWeek() {}, - dayOfYear() {}, - daysInMonth() {}, - daysInWeek() {}, - daysInYear() {}, - fields(fieldNames) { return fieldNames; }, - inLeapYear() {}, - mergeFields() {}, - month() {}, - monthDayFromFields() {}, - monthsInYear() {}, - weekOfYear() {}, - yearOfWeek() {}, -}; -var zdt = Temporal.Instant.from("2019-10-29T09:46:38.271986102Z").toZonedDateTime({ - timeZone: tz, - calendar: fakeGregorian -}); -assert.sameValue(zdt.toPlainYearMonth().getCalendar(), fakeGregorian);