From 6f2e6872fbb0f46ae62e381c611a10febbdb4ba4 Mon Sep 17 00:00:00 2001 From: Ms2ger Date: Mon, 13 Jun 2022 17:55:55 +0200 Subject: [PATCH] Temporal: Extend tests for getISOFields. (#3560) --- .../prototype/getISOFields/custom.js | 18 +++++++++++++ .../prototype/getISOFields/prototype.js | 12 +++++++++ .../prototype/getISOFields/custom.js | 24 +++++++++++++++++ .../prototype/getISOFields/prototype.js | 12 +++++++++ .../prototype/getISOFields/custom.js | 18 +++++++++++++ .../prototype/getISOFields/prototype.js | 12 +++++++++ .../prototype/getISOFields/custom.js | 21 +++++++++++++++ .../prototype/getISOFields/prototype.js | 12 +++++++++ .../prototype/getISOFields/custom.js | 18 +++++++++++++ .../prototype/getISOFields/prototype.js | 12 +++++++++ .../prototype/getISOFields/custom.js | 26 +++++++++++++++++++ .../prototype/getISOFields/prototype.js | 12 +++++++++ 12 files changed, 197 insertions(+) create mode 100644 test/built-ins/Temporal/PlainDate/prototype/getISOFields/custom.js create mode 100644 test/built-ins/Temporal/PlainDate/prototype/getISOFields/prototype.js create mode 100644 test/built-ins/Temporal/PlainDateTime/prototype/getISOFields/custom.js create mode 100644 test/built-ins/Temporal/PlainDateTime/prototype/getISOFields/prototype.js create mode 100644 test/built-ins/Temporal/PlainMonthDay/prototype/getISOFields/custom.js create mode 100644 test/built-ins/Temporal/PlainMonthDay/prototype/getISOFields/prototype.js create mode 100644 test/built-ins/Temporal/PlainTime/prototype/getISOFields/custom.js create mode 100644 test/built-ins/Temporal/PlainTime/prototype/getISOFields/prototype.js create mode 100644 test/built-ins/Temporal/PlainYearMonth/prototype/getISOFields/custom.js create mode 100644 test/built-ins/Temporal/PlainYearMonth/prototype/getISOFields/prototype.js create mode 100644 test/built-ins/Temporal/ZonedDateTime/prototype/getISOFields/custom.js create mode 100644 test/built-ins/Temporal/ZonedDateTime/prototype/getISOFields/prototype.js diff --git a/test/built-ins/Temporal/PlainDate/prototype/getISOFields/custom.js b/test/built-ins/Temporal/PlainDate/prototype/getISOFields/custom.js new file mode 100644 index 0000000000..0e9e7a3aa1 --- /dev/null +++ b/test/built-ins/Temporal/PlainDate/prototype/getISOFields/custom.js @@ -0,0 +1,18 @@ +// 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.plaindate.prototype.getisofields +description: getISOFields does not call into user code. +includes: [temporalHelpers.js] +features: [Temporal] +---*/ + +const calendar = TemporalHelpers.calendarThrowEverything(); +const instance = new Temporal.PlainDate(2000, 5, 2, calendar); +const result = instance.getISOFields(); + +assert.sameValue(result.isoYear, 2000, "isoYear result"); +assert.sameValue(result.isoMonth, 5, "isoMonth result"); +assert.sameValue(result.isoDay, 2, "isoDay result"); +assert.sameValue(result.calendar, calendar, "calendar result"); diff --git a/test/built-ins/Temporal/PlainDate/prototype/getISOFields/prototype.js b/test/built-ins/Temporal/PlainDate/prototype/getISOFields/prototype.js new file mode 100644 index 0000000000..769df656d9 --- /dev/null +++ b/test/built-ins/Temporal/PlainDate/prototype/getISOFields/prototype.js @@ -0,0 +1,12 @@ +// 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.plaindate.prototype.getisofields +description: Correct prototype on the object returned from getISOFields +features: [Temporal] +---*/ + +const instance = new Temporal.PlainDate(2000, 5, 2); +const result = instance.getISOFields(); +assert.sameValue(Object.getPrototypeOf(result), Object.prototype, "prototype"); diff --git a/test/built-ins/Temporal/PlainDateTime/prototype/getISOFields/custom.js b/test/built-ins/Temporal/PlainDateTime/prototype/getISOFields/custom.js new file mode 100644 index 0000000000..b3b80bdccf --- /dev/null +++ b/test/built-ins/Temporal/PlainDateTime/prototype/getISOFields/custom.js @@ -0,0 +1,24 @@ +// 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.getisofields +description: getISOFields does not call into user code. +includes: [temporalHelpers.js] +features: [Temporal] +---*/ + +const calendar = TemporalHelpers.calendarThrowEverything(); +const instance = new Temporal.PlainDateTime(2000, 5, 2, 12, 34, 56, 987, 654, 321, calendar); +const result = instance.getISOFields(); + +assert.sameValue(result.isoYear, 2000, "isoYear result"); +assert.sameValue(result.isoMonth, 5, "isoMonth result"); +assert.sameValue(result.isoDay, 2, "isoDay result"); +assert.sameValue(result.isoHour, 12, "isoHour result"); +assert.sameValue(result.isoMinute, 34, "isoMinute result"); +assert.sameValue(result.isoSecond, 56, "isoSecond result"); +assert.sameValue(result.isoMillisecond, 987, "isoMillisecond result"); +assert.sameValue(result.isoMicrosecond, 654, "isoMicrosecond result"); +assert.sameValue(result.isoNanosecond, 321, "isoNanosecond result"); +assert.sameValue(result.calendar, calendar, "calendar result"); diff --git a/test/built-ins/Temporal/PlainDateTime/prototype/getISOFields/prototype.js b/test/built-ins/Temporal/PlainDateTime/prototype/getISOFields/prototype.js new file mode 100644 index 0000000000..1e00cd2300 --- /dev/null +++ b/test/built-ins/Temporal/PlainDateTime/prototype/getISOFields/prototype.js @@ -0,0 +1,12 @@ +// 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.getisofields +description: Correct prototype on the object returned from getISOFields +features: [Temporal] +---*/ + +const instance = new Temporal.PlainDateTime(2000, 5, 2, 12, 34, 56, 987, 654, 321); +const result = instance.getISOFields(); +assert.sameValue(Object.getPrototypeOf(result), Object.prototype, "prototype"); diff --git a/test/built-ins/Temporal/PlainMonthDay/prototype/getISOFields/custom.js b/test/built-ins/Temporal/PlainMonthDay/prototype/getISOFields/custom.js new file mode 100644 index 0000000000..391c70850e --- /dev/null +++ b/test/built-ins/Temporal/PlainMonthDay/prototype/getISOFields/custom.js @@ -0,0 +1,18 @@ +// 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.plainmonthday.prototype.getisofields +description: getISOFields does not call into user code. +includes: [temporalHelpers.js] +features: [Temporal] +---*/ + +const calendar = TemporalHelpers.calendarThrowEverything(); +const instance = new Temporal.PlainMonthDay(5, 2, calendar); +const result = instance.getISOFields(); + +assert.sameValue(result.isoYear, 1972, "isoYear result"); +assert.sameValue(result.isoMonth, 5, "isoMonth result"); +assert.sameValue(result.isoDay, 2, "isoDay result"); +assert.sameValue(result.calendar, calendar, "calendar result"); diff --git a/test/built-ins/Temporal/PlainMonthDay/prototype/getISOFields/prototype.js b/test/built-ins/Temporal/PlainMonthDay/prototype/getISOFields/prototype.js new file mode 100644 index 0000000000..dc43ace9a7 --- /dev/null +++ b/test/built-ins/Temporal/PlainMonthDay/prototype/getISOFields/prototype.js @@ -0,0 +1,12 @@ +// 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.plainmonthday.prototype.getisofields +description: Correct prototype on the object returned from getISOFields +features: [Temporal] +---*/ + +const instance = new Temporal.PlainMonthDay(5, 2); +const result = instance.getISOFields(); +assert.sameValue(Object.getPrototypeOf(result), Object.prototype, "prototype"); diff --git a/test/built-ins/Temporal/PlainTime/prototype/getISOFields/custom.js b/test/built-ins/Temporal/PlainTime/prototype/getISOFields/custom.js new file mode 100644 index 0000000000..cf6d41ceab --- /dev/null +++ b/test/built-ins/Temporal/PlainTime/prototype/getISOFields/custom.js @@ -0,0 +1,21 @@ +// 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.plaintime.prototype.getisofields +description: getISOFields does not call into user code. +includes: [temporalHelpers.js] +features: [Temporal] +---*/ + +const calendar = TemporalHelpers.calendarThrowEverything(); +const instance = new Temporal.PlainTime(12, 34, 56, 987, 654, 321, calendar); +const result = instance.getISOFields(); + +assert.sameValue(result.isoHour, 12, "isoHour result"); +assert.sameValue(result.isoMinute, 34, "isoMinute result"); +assert.sameValue(result.isoSecond, 56, "isoSecond result"); +assert.sameValue(result.isoMillisecond, 987, "isoMillisecond result"); +assert.sameValue(result.isoMicrosecond, 654, "isoMicrosecond result"); +assert.sameValue(result.isoNanosecond, 321, "isoNanosecond result"); +assert.sameValue(result.calendar.id, "iso8601", "calendar result"); diff --git a/test/built-ins/Temporal/PlainTime/prototype/getISOFields/prototype.js b/test/built-ins/Temporal/PlainTime/prototype/getISOFields/prototype.js new file mode 100644 index 0000000000..db4982a550 --- /dev/null +++ b/test/built-ins/Temporal/PlainTime/prototype/getISOFields/prototype.js @@ -0,0 +1,12 @@ +// 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.plaintime.prototype.getisofields +description: Correct prototype on the object returned from getISOFields +features: [Temporal] +---*/ + +const instance = new Temporal.PlainTime(12, 34, 56, 987, 654, 321); +const result = instance.getISOFields(); +assert.sameValue(Object.getPrototypeOf(result), Object.prototype, "prototype"); diff --git a/test/built-ins/Temporal/PlainYearMonth/prototype/getISOFields/custom.js b/test/built-ins/Temporal/PlainYearMonth/prototype/getISOFields/custom.js new file mode 100644 index 0000000000..64041f162a --- /dev/null +++ b/test/built-ins/Temporal/PlainYearMonth/prototype/getISOFields/custom.js @@ -0,0 +1,18 @@ +// 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.plainyearmonth.prototype.getisofields +description: getISOFields does not call into user code. +includes: [temporalHelpers.js] +features: [Temporal] +---*/ + +const calendar = TemporalHelpers.calendarThrowEverything(); +const instance = new Temporal.PlainYearMonth(2000, 5, calendar); +const result = instance.getISOFields(); + +assert.sameValue(result.isoYear, 2000, "isoYear result"); +assert.sameValue(result.isoMonth, 5, "isoMonth result"); +assert.sameValue(result.isoDay, 1, "isoDay result"); +assert.sameValue(result.calendar, calendar, "calendar result"); diff --git a/test/built-ins/Temporal/PlainYearMonth/prototype/getISOFields/prototype.js b/test/built-ins/Temporal/PlainYearMonth/prototype/getISOFields/prototype.js new file mode 100644 index 0000000000..6df8852103 --- /dev/null +++ b/test/built-ins/Temporal/PlainYearMonth/prototype/getISOFields/prototype.js @@ -0,0 +1,12 @@ +// 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.plainyearmonth.prototype.getisofields +description: Correct prototype on the object returned from getISOFields +features: [Temporal] +---*/ + +const instance = new Temporal.PlainYearMonth(2000, 5); +const result = instance.getISOFields(); +assert.sameValue(Object.getPrototypeOf(result), Object.prototype, "prototype"); diff --git a/test/built-ins/Temporal/ZonedDateTime/prototype/getISOFields/custom.js b/test/built-ins/Temporal/ZonedDateTime/prototype/getISOFields/custom.js new file mode 100644 index 0000000000..972b3fcb1d --- /dev/null +++ b/test/built-ins/Temporal/ZonedDateTime/prototype/getISOFields/custom.js @@ -0,0 +1,26 @@ +// 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.getisofields +description: getISOFields does not call into user code. +includes: [temporalHelpers.js] +features: [Temporal] +---*/ + +const calendar = TemporalHelpers.calendarThrowEverything(); +const instance = new Temporal.ZonedDateTime(1_000_086_400_987_654_321n, "UTC", calendar); +const result = instance.getISOFields(); + +assert.sameValue(result.isoYear, 2001, "isoYear result"); +assert.sameValue(result.isoMonth, 9, "isoMonth result"); +assert.sameValue(result.isoDay, 10, "isoDay result"); +assert.sameValue(result.isoHour, 1, "isoHour result"); +assert.sameValue(result.isoMinute, 46, "isoMinute result"); +assert.sameValue(result.isoSecond, 40, "isoSecond result"); +assert.sameValue(result.isoMillisecond, 987, "isoMillisecond result"); +assert.sameValue(result.isoMicrosecond, 654, "isoMicrosecond result"); +assert.sameValue(result.isoNanosecond, 321, "isoNanosecond result"); +assert.sameValue(result.offset, "+00:00", "offset result"); +assert.sameValue(result.calendar, calendar, "calendar result"); +assert.sameValue(result.timeZone.id, "UTC", "timeZone result"); diff --git a/test/built-ins/Temporal/ZonedDateTime/prototype/getISOFields/prototype.js b/test/built-ins/Temporal/ZonedDateTime/prototype/getISOFields/prototype.js new file mode 100644 index 0000000000..83988ce431 --- /dev/null +++ b/test/built-ins/Temporal/ZonedDateTime/prototype/getISOFields/prototype.js @@ -0,0 +1,12 @@ +// 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.getisofields +description: Correct prototype on the object returned from getISOFields +features: [Temporal] +---*/ + +const instance = new Temporal.ZonedDateTime(1_000_086_400_987_654_321n, "UTC"); +const result = instance.getISOFields(); +assert.sameValue(Object.getPrototypeOf(result), Object.prototype, "prototype");