diff --git a/test/built-ins/Temporal/PlainDate/prototype/daysInMonth/basic.js b/test/built-ins/Temporal/PlainDate/prototype/daysInMonth/basic.js new file mode 100644 index 0000000000..fb2cc1cdf9 --- /dev/null +++ b/test/built-ins/Temporal/PlainDate/prototype/daysInMonth/basic.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-get-temporal.plaindate.prototype.daysinmonth +description: Checking days in month for a "normal" case (non-undefined, non-boundary case, etc.) +features: [Temporal] +---*/ + +const tests = [ + [new Temporal.PlainDate(1976, 2, 18), 29], + [new Temporal.PlainDate(1976, 11, 18), 30], + [new Temporal.PlainDate(1976, 12, 18), 31], + [new Temporal.PlainDate(1977, 2, 18), 28], +]; +for (const [plainDate, expected] of tests) { + assert.sameValue(plainDate.daysInMonth, expected, `${expected} days in the month of ${plainDate}`); +} diff --git a/test/built-ins/Temporal/PlainDateTime/prototype/daysInMonth/basic.js b/test/built-ins/Temporal/PlainDateTime/prototype/daysInMonth/basic.js index 7059e7a0cb..76fcea4223 100644 --- a/test/built-ins/Temporal/PlainDateTime/prototype/daysInMonth/basic.js +++ b/test/built-ins/Temporal/PlainDateTime/prototype/daysInMonth/basic.js @@ -7,6 +7,12 @@ description: Checking days in month for a "normal" case (non-undefined, non-boun features: [Temporal] ---*/ -const calendar = Temporal.Calendar.from("iso8601"); -const datetime = new Temporal.PlainDateTime(1976, 11, 18, 15, 23, 30, 123, 456, 789, calendar); -assert.sameValue(datetime.daysInMonth, 30, "check days in month information"); +const tests = [ + [new Temporal.PlainDateTime(1976, 2, 18, 15, 23, 30, 123, 456, 789), 29], + [new Temporal.PlainDateTime(1976, 11, 18, 15, 23, 30, 123, 456, 789), 30], + [new Temporal.PlainDateTime(1976, 12, 18, 15, 23, 30, 123, 456, 789), 31], + [new Temporal.PlainDateTime(1977, 2, 18, 15, 23, 30, 123, 456, 789), 28], +]; +for (const [plainDateTime, expected] of tests) { + assert.sameValue(plainDateTime.daysInMonth, expected, `${expected} days in the month of ${plainDateTime}`); +} diff --git a/test/built-ins/Temporal/PlainYearMonth/prototype/daysInMonth/basic.js b/test/built-ins/Temporal/PlainYearMonth/prototype/daysInMonth/basic.js index 94883e5868..c8977a2807 100644 --- a/test/built-ins/Temporal/PlainYearMonth/prototype/daysInMonth/basic.js +++ b/test/built-ins/Temporal/PlainYearMonth/prototype/daysInMonth/basic.js @@ -7,5 +7,12 @@ description: daysInMonth works features: [Temporal] ---*/ -const ym = new Temporal.PlainYearMonth(1976, 11); -assert.sameValue(ym.daysInMonth, 30); +const tests = [ + [new Temporal.PlainYearMonth(1976, 2), 29], + [new Temporal.PlainYearMonth(1976, 11), 30], + [new Temporal.PlainYearMonth(1976, 12), 31], + [new Temporal.PlainYearMonth(1977, 2), 28], +]; +for (const [plainYearMonth, expected] of tests) { + assert.sameValue(plainYearMonth.daysInMonth, expected, `${expected} days in the month of ${plainYearMonth}`); +}