From f36b7d42a699a03328f652178cacfcc65949dcb1 Mon Sep 17 00:00:00 2001 From: Frank Tang Date: Sat, 17 Jul 2021 02:19:34 -0700 Subject: [PATCH 1/5] Add tests for Temporal.Calendar.prototype.dayOf* --- .../prototype/day-of-week/plain-date-time.js | 34 +++++++++++++++++ .../prototype/day-of-week/plain-date.js | 37 +++++++++++++++++++ .../Calendar/prototype/day-of-week/string.js | 33 +++++++++++++++++ .../prototype/day-of-year/plain-date-time.js | 24 ++++++++++++ .../prototype/day-of-year/plain-date.js | 29 +++++++++++++++ .../Calendar/prototype/day-of-year/string.js | 22 +++++++++++ 6 files changed, 179 insertions(+) create mode 100644 test/built-ins/Temporal/Calendar/prototype/day-of-week/plain-date-time.js create mode 100644 test/built-ins/Temporal/Calendar/prototype/day-of-week/plain-date.js create mode 100644 test/built-ins/Temporal/Calendar/prototype/day-of-week/string.js create mode 100644 test/built-ins/Temporal/Calendar/prototype/day-of-year/plain-date-time.js create mode 100644 test/built-ins/Temporal/Calendar/prototype/day-of-year/plain-date.js create mode 100644 test/built-ins/Temporal/Calendar/prototype/day-of-year/string.js diff --git a/test/built-ins/Temporal/Calendar/prototype/day-of-week/plain-date-time.js b/test/built-ins/Temporal/Calendar/prototype/day-of-week/plain-date-time.js new file mode 100644 index 00000000000..0b12240785c --- /dev/null +++ b/test/built-ins/Temporal/Calendar/prototype/day-of-week/plain-date-time.js @@ -0,0 +1,34 @@ +// Copyright (C) 2021 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-temporal.calendar.prototype.dayofweek +description: Temporal.Calendar.prototype.dayOfWeek will take Temporal.PlainDateTime objects + and return the day of week. + +info: | + 1. Let calendar be the this value. + 2. Perform ? RequireInternalSlot(calendar, [[InitializedTemporalCalendar]]). + 3. Assert: calendar.[[Identifier]] is "iso8601". + 4. Let temporalDate be ? ToTemporalDate(temporalDateLike). + 5. Return 𝔽(! ToISODayOfWeek(temporalDate.[[ISOYear]], temporalDate.[[ISOMonth]], temporalDate.[[ISODay]])). +features: [Temporal] +---*/ +let cal = new Temporal.Calendar("iso8601"); + +assert.sameValue(4, cal.dayOfWeek(new Temporal.PlainDateTime(1997, 1, 23, 5, 30, 13))); +// leap year +assert.sameValue(5, cal.dayOfWeek(new Temporal.PlainDateTime(1996, 2, 23, 5, 30, 13))); +assert.sameValue(3, cal.dayOfWeek(new Temporal.PlainDateTime(2000, 2, 23, 5, 30, 13))); +// non leap year +assert.sameValue(7, cal.dayOfWeek(new Temporal.PlainDateTime(1997, 2, 23, 5, 30, 13))); +assert.sameValue(7, cal.dayOfWeek(new Temporal.PlainDateTime(1997, 3, 23, 5, 30, 13))); +assert.sameValue(3, cal.dayOfWeek(new Temporal.PlainDateTime(1997, 4, 23, 5, 30, 13))); +assert.sameValue(5, cal.dayOfWeek(new Temporal.PlainDateTime(1997, 5, 23, 5, 30, 13))); +assert.sameValue(1, cal.dayOfWeek(new Temporal.PlainDateTime(1997, 6, 23, 5, 30, 13))); +assert.sameValue(3, cal.dayOfWeek(new Temporal.PlainDateTime(1997, 7, 23, 5, 30, 13))); +assert.sameValue(6, cal.dayOfWeek(new Temporal.PlainDateTime(1997, 8, 23, 5, 30, 13))); +assert.sameValue(2, cal.dayOfWeek(new Temporal.PlainDateTime(1997, 9, 23, 5, 30, 13))); +assert.sameValue(4, cal.dayOfWeek(new Temporal.PlainDateTime(1997, 10, 23, 5, 30, 13))); +assert.sameValue(7, cal.dayOfWeek(new Temporal.PlainDateTime(1997, 11, 23, 5, 30, 13))); +assert.sameValue(2, cal.dayOfWeek(new Temporal.PlainDateTime(1997, 12, 23, 5, 30, 13))); diff --git a/test/built-ins/Temporal/Calendar/prototype/day-of-week/plain-date.js b/test/built-ins/Temporal/Calendar/prototype/day-of-week/plain-date.js new file mode 100644 index 00000000000..34f7da6d021 --- /dev/null +++ b/test/built-ins/Temporal/Calendar/prototype/day-of-week/plain-date.js @@ -0,0 +1,37 @@ +// Copyright (C) 2021 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-temporal.calendar.prototype.dayofweek +description: Temporal.Calendar.prototype.dayOfWeek will take Temporal.PlainDate objects + and return the day of week. + +info: | + 1. Let calendar be the this value. + 2. Perform ? RequireInternalSlot(calendar, [[InitializedTemporalCalendar]]). + 3. Assert: calendar.[[Identifier]] is "iso8601". + 4. Let temporalDate be ? ToTemporalDate(temporalDateLike). + 5. Return 𝔽(! ToISODayOfWeek(temporalDate.[[ISOYear]], temporalDate.[[ISOMonth]], temporalDate.[[ISODay]])). +features: [Temporal] +---*/ +let cal = new Temporal.Calendar("iso8601"); + +assert.sameValue(4, cal.dayOfWeek(new Temporal.PlainDate(1970, 1, 1))); +assert.sameValue(6, cal.dayOfWeek(new Temporal.PlainDate(2000, 1, 1))); + +assert.sameValue(5, cal.dayOfWeek(new Temporal.PlainDate(2021, 1, 15))); +// leap year +assert.sameValue(6, cal.dayOfWeek(new Temporal.PlainDate(2020, 2, 15))); +assert.sameValue(2, cal.dayOfWeek(new Temporal.PlainDate(2000, 2, 15))); +// non-leap year +assert.sameValue(1, cal.dayOfWeek(new Temporal.PlainDate(2021, 2, 15))); +assert.sameValue(1, cal.dayOfWeek(new Temporal.PlainDate(2021, 3, 15))); +assert.sameValue(4, cal.dayOfWeek(new Temporal.PlainDate(2021, 4, 15))); +assert.sameValue(6, cal.dayOfWeek(new Temporal.PlainDate(2021, 5, 15))); +assert.sameValue(2, cal.dayOfWeek(new Temporal.PlainDate(2021, 6, 15))); +assert.sameValue(4, cal.dayOfWeek(new Temporal.PlainDate(2021, 7, 15))); +assert.sameValue(7, cal.dayOfWeek(new Temporal.PlainDate(2021, 8, 15))); +assert.sameValue(3, cal.dayOfWeek(new Temporal.PlainDate(2021, 9, 15))); +assert.sameValue(5, cal.dayOfWeek(new Temporal.PlainDate(2021, 10, 15))); +assert.sameValue(1, cal.dayOfWeek(new Temporal.PlainDate(2021, 11, 15))); +assert.sameValue(3, cal.dayOfWeek(new Temporal.PlainDate(2021, 12, 15))); diff --git a/test/built-ins/Temporal/Calendar/prototype/day-of-week/string.js b/test/built-ins/Temporal/Calendar/prototype/day-of-week/string.js new file mode 100644 index 00000000000..4b42a87f9a1 --- /dev/null +++ b/test/built-ins/Temporal/Calendar/prototype/day-of-week/string.js @@ -0,0 +1,33 @@ +// Copyright (C) 2021 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-temporal.calendar.prototype.dayofweek +description: Temporal.Calendar.prototype.dayOfWeek will take ISO8601 string + and return the day of week. + +info: | + 1. Let calendar be the this value. + 2. Perform ? RequireInternalSlot(calendar, [[InitializedTemporalCalendar]]). + 3. Assert: calendar.[[Identifier]] is "iso8601". + 4. Let temporalDate be ? ToTemporalDate(temporalDateLike). + 5. Return 𝔽(! ToISODayOfWeek(temporalDate.[[ISOYear]], temporalDate.[[ISOMonth]], temporalDate.[[ISODay]])). +features: [Temporal] +---*/ +let cal = new Temporal.Calendar("iso8601"); + +assert.sameValue(5, cal.dayOfWeek("2019-01-18")); +// leap year +assert.sameValue(2, cal.dayOfWeek("2020-02-18")); +// non leap +assert.sameValue(1, cal.dayOfWeek("2019-02-18")); +assert.sameValue(1, cal.dayOfWeek("2019-03-18")); +assert.sameValue(4, cal.dayOfWeek("2019-04-18")); +assert.sameValue(6, cal.dayOfWeek("2019-05-18")); +assert.sameValue(2, cal.dayOfWeek("2019-06-18")); +assert.sameValue(4, cal.dayOfWeek("2019-07-18")); +assert.sameValue(7, cal.dayOfWeek("2019-08-18")); +assert.sameValue(3, cal.dayOfWeek("2019-09-18")); +assert.sameValue(5, cal.dayOfWeek("2019-10-18")); +assert.sameValue(1, cal.dayOfWeek("2019-11-18")); +assert.sameValue(3, cal.dayOfWeek("2019-12-18")); diff --git a/test/built-ins/Temporal/Calendar/prototype/day-of-year/plain-date-time.js b/test/built-ins/Temporal/Calendar/prototype/day-of-year/plain-date-time.js new file mode 100644 index 00000000000..f90e7ec44d9 --- /dev/null +++ b/test/built-ins/Temporal/Calendar/prototype/day-of-year/plain-date-time.js @@ -0,0 +1,24 @@ +// Copyright (C) 2021 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-temporal.calendar.prototype.dayofyear +description: Temporal.Calendar.prototype.dayOfYear will take PlainDateTime object and +return the day of year. + and return Array of the same content. +info: | + 1. Let calendar be the this value. + 2. Perform ? RequireInternalSlot(calendar, [[InitializedTemporalCalendar]]). + 3. Assert: calendar.[[Identifier]] is "iso8601". + 4. Let temporalDate be ? ToTemporalDate(temporalDateLike). + 5. Return 𝔽(! ToISODayOfYear(temporalDate.[[ISOYear]], temporalDate.[[ISOMonth]], temporalDate.[[ISODay]])). +features: [Temporal] +---*/ +let cal = new Temporal.Calendar("iso8601"); + +assert.sameValue(23, cal.dayOfYear(new Temporal.PlainDateTime(1997, 1, 23, 5, 30, 13))); +assert.sameValue(54, cal.dayOfYear(new Temporal.PlainDateTime(1997, 2, 23, 5, 30, 13))); +assert.sameValue(83, cal.dayOfYear(new Temporal.PlainDateTime(1996, 3, 23, 5, 30, 13))); +assert.sameValue(82, cal.dayOfYear(new Temporal.PlainDateTime(1997, 3, 23, 5, 30, 13))); +assert.sameValue(365, cal.dayOfYear(new Temporal.PlainDateTime(1997, 12, 31, 5, 30, 13))); +assert.sameValue(366, cal.dayOfYear(new Temporal.PlainDateTime(1996, 12, 31, 5, 30, 13))); diff --git a/test/built-ins/Temporal/Calendar/prototype/day-of-year/plain-date.js b/test/built-ins/Temporal/Calendar/prototype/day-of-year/plain-date.js new file mode 100644 index 00000000000..5e80fa49e84 --- /dev/null +++ b/test/built-ins/Temporal/Calendar/prototype/day-of-year/plain-date.js @@ -0,0 +1,29 @@ +// Copyright (C) 2021 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-temporal.calendar.prototype.dayofyear +description: Temporal.Calendar.prototype.dayOfYear will take PlainDate object and +return the day of year. + and return Array of the same content. +info: | + 1. Let calendar be the this value. + 2. Perform ? RequireInternalSlot(calendar, [[InitializedTemporalCalendar]]). + 3. Assert: calendar.[[Identifier]] is "iso8601". + 4. Let temporalDate be ? ToTemporalDate(temporalDateLike). + 5. Return 𝔽(! ToISODayOfYear(temporalDate.[[ISOYear]], temporalDate.[[ISOMonth]], temporalDate.[[ISODay]])). +features: [Temporal] +---*/ +let cal = new Temporal.Calendar("iso8601"); + +assert.sameValue(1, cal.dayOfYear(new Temporal.PlainDate(1970, 1, 1))); +assert.sameValue(1, cal.dayOfYear(new Temporal.PlainDate(2000, 1, 1))); + +assert.sameValue(15, cal.dayOfYear(new Temporal.PlainDate(2021, 1, 15))); +assert.sameValue(46, cal.dayOfYear(new Temporal.PlainDate(2020, 2, 15))); +assert.sameValue(46, cal.dayOfYear(new Temporal.PlainDate(2000, 2, 15))); +assert.sameValue(75, cal.dayOfYear(new Temporal.PlainDate(2020, 3, 15))); +assert.sameValue(75, cal.dayOfYear(new Temporal.PlainDate(2000, 3, 15))); +assert.sameValue(74, cal.dayOfYear(new Temporal.PlainDate(2001, 3, 15))); +assert.sameValue(366, cal.dayOfYear(new Temporal.PlainDate(2000, 12, 31))); +assert.sameValue(365, cal.dayOfYear(new Temporal.PlainDate(2001, 12, 31))); diff --git a/test/built-ins/Temporal/Calendar/prototype/day-of-year/string.js b/test/built-ins/Temporal/Calendar/prototype/day-of-year/string.js new file mode 100644 index 00000000000..9c39583bd26 --- /dev/null +++ b/test/built-ins/Temporal/Calendar/prototype/day-of-year/string.js @@ -0,0 +1,22 @@ +// Copyright (C) 2021 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-temporal.calendar.prototype.dayofyear +description: Temporal.Calendar.prototype.dayOfYear will take ISO8601 string and +return the day of year. + and return Array of the same content. +info: | + 1. Let calendar be the this value. + 2. Perform ? RequireInternalSlot(calendar, [[InitializedTemporalCalendar]]). + 3. Assert: calendar.[[Identifier]] is "iso8601". + 4. Let temporalDate be ? ToTemporalDate(temporalDateLike). + 5. Return 𝔽(! ToISODayOfYear(temporalDate.[[ISOYear]], temporalDate.[[ISOMonth]], temporalDate.[[ISODay]])). +features: [Temporal] +---*/ +let cal = new Temporal.Calendar("iso8601"); + +assert.sameValue(18, cal.dayOfYear("2019-01-18")); +assert.sameValue(49, cal.dayOfYear("2020-02-18")); +assert.sameValue(365, cal.dayOfYear("2019-12-31")); +assert.sameValue(366, cal.dayOfYear("2000-12-31")); From 7b27e20df87e7e2ba3e8776dd223580c6dc1c633 Mon Sep 17 00:00:00 2001 From: Frank Tang Date: Mon, 19 Jul 2021 11:18:43 -0700 Subject: [PATCH 2/5] Fix directory name --- .../prototype/{day-of-week => dayOfWeek}/plain-date-time.js | 0 .../Calendar/prototype/{day-of-week => dayOfWeek}/plain-date.js | 0 .../Calendar/prototype/{day-of-week => dayOfWeek}/string.js | 0 .../prototype/{day-of-year => dayOfYear}/plain-date-time.js | 0 .../Calendar/prototype/{day-of-year => dayOfYear}/plain-date.js | 0 .../Calendar/prototype/{day-of-year => dayOfYear}/string.js | 0 6 files changed, 0 insertions(+), 0 deletions(-) rename test/built-ins/Temporal/Calendar/prototype/{day-of-week => dayOfWeek}/plain-date-time.js (100%) rename test/built-ins/Temporal/Calendar/prototype/{day-of-week => dayOfWeek}/plain-date.js (100%) rename test/built-ins/Temporal/Calendar/prototype/{day-of-week => dayOfWeek}/string.js (100%) rename test/built-ins/Temporal/Calendar/prototype/{day-of-year => dayOfYear}/plain-date-time.js (100%) rename test/built-ins/Temporal/Calendar/prototype/{day-of-year => dayOfYear}/plain-date.js (100%) rename test/built-ins/Temporal/Calendar/prototype/{day-of-year => dayOfYear}/string.js (100%) diff --git a/test/built-ins/Temporal/Calendar/prototype/day-of-week/plain-date-time.js b/test/built-ins/Temporal/Calendar/prototype/dayOfWeek/plain-date-time.js similarity index 100% rename from test/built-ins/Temporal/Calendar/prototype/day-of-week/plain-date-time.js rename to test/built-ins/Temporal/Calendar/prototype/dayOfWeek/plain-date-time.js diff --git a/test/built-ins/Temporal/Calendar/prototype/day-of-week/plain-date.js b/test/built-ins/Temporal/Calendar/prototype/dayOfWeek/plain-date.js similarity index 100% rename from test/built-ins/Temporal/Calendar/prototype/day-of-week/plain-date.js rename to test/built-ins/Temporal/Calendar/prototype/dayOfWeek/plain-date.js diff --git a/test/built-ins/Temporal/Calendar/prototype/day-of-week/string.js b/test/built-ins/Temporal/Calendar/prototype/dayOfWeek/string.js similarity index 100% rename from test/built-ins/Temporal/Calendar/prototype/day-of-week/string.js rename to test/built-ins/Temporal/Calendar/prototype/dayOfWeek/string.js diff --git a/test/built-ins/Temporal/Calendar/prototype/day-of-year/plain-date-time.js b/test/built-ins/Temporal/Calendar/prototype/dayOfYear/plain-date-time.js similarity index 100% rename from test/built-ins/Temporal/Calendar/prototype/day-of-year/plain-date-time.js rename to test/built-ins/Temporal/Calendar/prototype/dayOfYear/plain-date-time.js diff --git a/test/built-ins/Temporal/Calendar/prototype/day-of-year/plain-date.js b/test/built-ins/Temporal/Calendar/prototype/dayOfYear/plain-date.js similarity index 100% rename from test/built-ins/Temporal/Calendar/prototype/day-of-year/plain-date.js rename to test/built-ins/Temporal/Calendar/prototype/dayOfYear/plain-date.js diff --git a/test/built-ins/Temporal/Calendar/prototype/day-of-year/string.js b/test/built-ins/Temporal/Calendar/prototype/dayOfYear/string.js similarity index 100% rename from test/built-ins/Temporal/Calendar/prototype/day-of-year/string.js rename to test/built-ins/Temporal/Calendar/prototype/dayOfYear/string.js From 9c1b1fe42f5a92cae510bcafcd3b688252b311cf Mon Sep 17 00:00:00 2001 From: Frank Tang Date: Tue, 20 Jul 2021 01:21:18 -0700 Subject: [PATCH 3/5] Fix YAML indent issue --- .../Temporal/Calendar/prototype/dayOfWeek/plain-date-time.js | 1 - .../Temporal/Calendar/prototype/dayOfWeek/plain-date.js | 1 - test/built-ins/Temporal/Calendar/prototype/dayOfWeek/string.js | 1 - .../Temporal/Calendar/prototype/dayOfYear/plain-date-time.js | 3 +-- .../Temporal/Calendar/prototype/dayOfYear/plain-date.js | 3 +-- test/built-ins/Temporal/Calendar/prototype/dayOfYear/string.js | 3 +-- 6 files changed, 3 insertions(+), 9 deletions(-) diff --git a/test/built-ins/Temporal/Calendar/prototype/dayOfWeek/plain-date-time.js b/test/built-ins/Temporal/Calendar/prototype/dayOfWeek/plain-date-time.js index 0b12240785c..38c27e827ff 100644 --- a/test/built-ins/Temporal/Calendar/prototype/dayOfWeek/plain-date-time.js +++ b/test/built-ins/Temporal/Calendar/prototype/dayOfWeek/plain-date-time.js @@ -5,7 +5,6 @@ esid: sec-temporal.calendar.prototype.dayofweek description: Temporal.Calendar.prototype.dayOfWeek will take Temporal.PlainDateTime objects and return the day of week. - info: | 1. Let calendar be the this value. 2. Perform ? RequireInternalSlot(calendar, [[InitializedTemporalCalendar]]). diff --git a/test/built-ins/Temporal/Calendar/prototype/dayOfWeek/plain-date.js b/test/built-ins/Temporal/Calendar/prototype/dayOfWeek/plain-date.js index 34f7da6d021..c94b757a6d1 100644 --- a/test/built-ins/Temporal/Calendar/prototype/dayOfWeek/plain-date.js +++ b/test/built-ins/Temporal/Calendar/prototype/dayOfWeek/plain-date.js @@ -5,7 +5,6 @@ esid: sec-temporal.calendar.prototype.dayofweek description: Temporal.Calendar.prototype.dayOfWeek will take Temporal.PlainDate objects and return the day of week. - info: | 1. Let calendar be the this value. 2. Perform ? RequireInternalSlot(calendar, [[InitializedTemporalCalendar]]). diff --git a/test/built-ins/Temporal/Calendar/prototype/dayOfWeek/string.js b/test/built-ins/Temporal/Calendar/prototype/dayOfWeek/string.js index 4b42a87f9a1..55353170d2a 100644 --- a/test/built-ins/Temporal/Calendar/prototype/dayOfWeek/string.js +++ b/test/built-ins/Temporal/Calendar/prototype/dayOfWeek/string.js @@ -5,7 +5,6 @@ esid: sec-temporal.calendar.prototype.dayofweek description: Temporal.Calendar.prototype.dayOfWeek will take ISO8601 string and return the day of week. - info: | 1. Let calendar be the this value. 2. Perform ? RequireInternalSlot(calendar, [[InitializedTemporalCalendar]]). diff --git a/test/built-ins/Temporal/Calendar/prototype/dayOfYear/plain-date-time.js b/test/built-ins/Temporal/Calendar/prototype/dayOfYear/plain-date-time.js index f90e7ec44d9..892085feb14 100644 --- a/test/built-ins/Temporal/Calendar/prototype/dayOfYear/plain-date-time.js +++ b/test/built-ins/Temporal/Calendar/prototype/dayOfYear/plain-date-time.js @@ -4,8 +4,7 @@ /*--- esid: sec-temporal.calendar.prototype.dayofyear description: Temporal.Calendar.prototype.dayOfYear will take PlainDateTime object and -return the day of year. - and return Array of the same content. + return the day of year. info: | 1. Let calendar be the this value. 2. Perform ? RequireInternalSlot(calendar, [[InitializedTemporalCalendar]]). diff --git a/test/built-ins/Temporal/Calendar/prototype/dayOfYear/plain-date.js b/test/built-ins/Temporal/Calendar/prototype/dayOfYear/plain-date.js index 5e80fa49e84..137d2ccb5a5 100644 --- a/test/built-ins/Temporal/Calendar/prototype/dayOfYear/plain-date.js +++ b/test/built-ins/Temporal/Calendar/prototype/dayOfYear/plain-date.js @@ -4,8 +4,7 @@ /*--- esid: sec-temporal.calendar.prototype.dayofyear description: Temporal.Calendar.prototype.dayOfYear will take PlainDate object and -return the day of year. - and return Array of the same content. + return the day of year. info: | 1. Let calendar be the this value. 2. Perform ? RequireInternalSlot(calendar, [[InitializedTemporalCalendar]]). diff --git a/test/built-ins/Temporal/Calendar/prototype/dayOfYear/string.js b/test/built-ins/Temporal/Calendar/prototype/dayOfYear/string.js index 9c39583bd26..e7276cc0f42 100644 --- a/test/built-ins/Temporal/Calendar/prototype/dayOfYear/string.js +++ b/test/built-ins/Temporal/Calendar/prototype/dayOfYear/string.js @@ -4,8 +4,7 @@ /*--- esid: sec-temporal.calendar.prototype.dayofyear description: Temporal.Calendar.prototype.dayOfYear will take ISO8601 string and -return the day of year. - and return Array of the same content. + return the day of year. info: | 1. Let calendar be the this value. 2. Perform ? RequireInternalSlot(calendar, [[InitializedTemporalCalendar]]). From ea2383100d543ae08cfcf90dcab687d408d47e32 Mon Sep 17 00:00:00 2001 From: Frank Tang Date: Thu, 5 Aug 2021 15:01:19 -0700 Subject: [PATCH 4/5] add more tests --- .../prototype/dayOfWeek/plain-date-time.js | 28 ++++-------- .../prototype/dayOfWeek/plain-date.js | 29 +++---------- .../Calendar/prototype/dayOfWeek/string.js | 14 ------ .../throw-range-error-ToTemporalDate.js | 15 +++++++ .../throw-type-error-RequireInternalSlot.js | 16 +++++++ .../prototype/dayOfYear/plain-date-time.js | 29 ++++++++----- .../prototype/dayOfYear/plain-date.js | 43 ++++++++++++------- .../Calendar/prototype/dayOfYear/string.js | 6 +-- .../throw-range-error-ToTemporalDate.js | 15 +++++++ .../throw-type-error-RequireInternalSlot.js | 16 +++++++ 10 files changed, 124 insertions(+), 87 deletions(-) create mode 100644 test/built-ins/Temporal/Calendar/prototype/dayOfWeek/throw-range-error-ToTemporalDate.js create mode 100644 test/built-ins/Temporal/Calendar/prototype/dayOfWeek/throw-type-error-RequireInternalSlot.js create mode 100644 test/built-ins/Temporal/Calendar/prototype/dayOfYear/throw-range-error-ToTemporalDate.js create mode 100644 test/built-ins/Temporal/Calendar/prototype/dayOfYear/throw-type-error-RequireInternalSlot.js diff --git a/test/built-ins/Temporal/Calendar/prototype/dayOfWeek/plain-date-time.js b/test/built-ins/Temporal/Calendar/prototype/dayOfWeek/plain-date-time.js index 38c27e827ff..0fc49779a9b 100644 --- a/test/built-ins/Temporal/Calendar/prototype/dayOfWeek/plain-date-time.js +++ b/test/built-ins/Temporal/Calendar/prototype/dayOfWeek/plain-date-time.js @@ -6,28 +6,16 @@ esid: sec-temporal.calendar.prototype.dayofweek description: Temporal.Calendar.prototype.dayOfWeek will take Temporal.PlainDateTime objects and return the day of week. info: | - 1. Let calendar be the this value. - 2. Perform ? RequireInternalSlot(calendar, [[InitializedTemporalCalendar]]). - 3. Assert: calendar.[[Identifier]] is "iso8601". - 4. Let temporalDate be ? ToTemporalDate(temporalDateLike). 5. Return 𝔽(! ToISODayOfWeek(temporalDate.[[ISOYear]], temporalDate.[[ISOMonth]], temporalDate.[[ISODay]])). features: [Temporal] ---*/ let cal = new Temporal.Calendar("iso8601"); -assert.sameValue(4, cal.dayOfWeek(new Temporal.PlainDateTime(1997, 1, 23, 5, 30, 13))); -// leap year -assert.sameValue(5, cal.dayOfWeek(new Temporal.PlainDateTime(1996, 2, 23, 5, 30, 13))); -assert.sameValue(3, cal.dayOfWeek(new Temporal.PlainDateTime(2000, 2, 23, 5, 30, 13))); -// non leap year -assert.sameValue(7, cal.dayOfWeek(new Temporal.PlainDateTime(1997, 2, 23, 5, 30, 13))); -assert.sameValue(7, cal.dayOfWeek(new Temporal.PlainDateTime(1997, 3, 23, 5, 30, 13))); -assert.sameValue(3, cal.dayOfWeek(new Temporal.PlainDateTime(1997, 4, 23, 5, 30, 13))); -assert.sameValue(5, cal.dayOfWeek(new Temporal.PlainDateTime(1997, 5, 23, 5, 30, 13))); -assert.sameValue(1, cal.dayOfWeek(new Temporal.PlainDateTime(1997, 6, 23, 5, 30, 13))); -assert.sameValue(3, cal.dayOfWeek(new Temporal.PlainDateTime(1997, 7, 23, 5, 30, 13))); -assert.sameValue(6, cal.dayOfWeek(new Temporal.PlainDateTime(1997, 8, 23, 5, 30, 13))); -assert.sameValue(2, cal.dayOfWeek(new Temporal.PlainDateTime(1997, 9, 23, 5, 30, 13))); -assert.sameValue(4, cal.dayOfWeek(new Temporal.PlainDateTime(1997, 10, 23, 5, 30, 13))); -assert.sameValue(7, cal.dayOfWeek(new Temporal.PlainDateTime(1997, 11, 23, 5, 30, 13))); -assert.sameValue(2, cal.dayOfWeek(new Temporal.PlainDateTime(1997, 12, 23, 5, 30, 13))); +let dt = new Temporal.PlainDateTime(1997, 1, 23, 5, 30, 13); +assert.sameValue(4, cal.dayOfWeek(dt)); +dt = new Temporal.PlainDateTime(1996, 2, 23, 5, 30, 13); +assert.sameValue(5, cal.dayOfWeek(dt)); +dt = new Temporal.PlainDateTime(1997, 2, 23, 5, 30, 13); +assert.sameValue(7, cal.dayOfWeek(dt)); +dt = new Temporal.PlainDateTime(1997, 6, 23, 5, 30, 13); +assert.sameValue(1, cal.dayOfWeek(dt)); diff --git a/test/built-ins/Temporal/Calendar/prototype/dayOfWeek/plain-date.js b/test/built-ins/Temporal/Calendar/prototype/dayOfWeek/plain-date.js index c94b757a6d1..e63deb29558 100644 --- a/test/built-ins/Temporal/Calendar/prototype/dayOfWeek/plain-date.js +++ b/test/built-ins/Temporal/Calendar/prototype/dayOfWeek/plain-date.js @@ -6,31 +6,14 @@ esid: sec-temporal.calendar.prototype.dayofweek description: Temporal.Calendar.prototype.dayOfWeek will take Temporal.PlainDate objects and return the day of week. info: | - 1. Let calendar be the this value. - 2. Perform ? RequireInternalSlot(calendar, [[InitializedTemporalCalendar]]). - 3. Assert: calendar.[[Identifier]] is "iso8601". - 4. Let temporalDate be ? ToTemporalDate(temporalDateLike). 5. Return 𝔽(! ToISODayOfWeek(temporalDate.[[ISOYear]], temporalDate.[[ISOMonth]], temporalDate.[[ISODay]])). features: [Temporal] ---*/ let cal = new Temporal.Calendar("iso8601"); -assert.sameValue(4, cal.dayOfWeek(new Temporal.PlainDate(1970, 1, 1))); -assert.sameValue(6, cal.dayOfWeek(new Temporal.PlainDate(2000, 1, 1))); - -assert.sameValue(5, cal.dayOfWeek(new Temporal.PlainDate(2021, 1, 15))); -// leap year -assert.sameValue(6, cal.dayOfWeek(new Temporal.PlainDate(2020, 2, 15))); -assert.sameValue(2, cal.dayOfWeek(new Temporal.PlainDate(2000, 2, 15))); -// non-leap year -assert.sameValue(1, cal.dayOfWeek(new Temporal.PlainDate(2021, 2, 15))); -assert.sameValue(1, cal.dayOfWeek(new Temporal.PlainDate(2021, 3, 15))); -assert.sameValue(4, cal.dayOfWeek(new Temporal.PlainDate(2021, 4, 15))); -assert.sameValue(6, cal.dayOfWeek(new Temporal.PlainDate(2021, 5, 15))); -assert.sameValue(2, cal.dayOfWeek(new Temporal.PlainDate(2021, 6, 15))); -assert.sameValue(4, cal.dayOfWeek(new Temporal.PlainDate(2021, 7, 15))); -assert.sameValue(7, cal.dayOfWeek(new Temporal.PlainDate(2021, 8, 15))); -assert.sameValue(3, cal.dayOfWeek(new Temporal.PlainDate(2021, 9, 15))); -assert.sameValue(5, cal.dayOfWeek(new Temporal.PlainDate(2021, 10, 15))); -assert.sameValue(1, cal.dayOfWeek(new Temporal.PlainDate(2021, 11, 15))); -assert.sameValue(3, cal.dayOfWeek(new Temporal.PlainDate(2021, 12, 15))); +let d = new Temporal.PlainDate(1970, 1, 1); +assert.sameValue(4, cal.dayOfWeek(d)); +d = new Temporal.PlainDate(2021, 2, 15); +assert.sameValue(1, cal.dayOfWeek(d)); +d = new Temporal.PlainDate(2021, 8, 15); +assert.sameValue(7, cal.dayOfWeek(d)); diff --git a/test/built-ins/Temporal/Calendar/prototype/dayOfWeek/string.js b/test/built-ins/Temporal/Calendar/prototype/dayOfWeek/string.js index 55353170d2a..57652820d05 100644 --- a/test/built-ins/Temporal/Calendar/prototype/dayOfWeek/string.js +++ b/test/built-ins/Temporal/Calendar/prototype/dayOfWeek/string.js @@ -6,9 +6,6 @@ esid: sec-temporal.calendar.prototype.dayofweek description: Temporal.Calendar.prototype.dayOfWeek will take ISO8601 string and return the day of week. info: | - 1. Let calendar be the this value. - 2. Perform ? RequireInternalSlot(calendar, [[InitializedTemporalCalendar]]). - 3. Assert: calendar.[[Identifier]] is "iso8601". 4. Let temporalDate be ? ToTemporalDate(temporalDateLike). 5. Return 𝔽(! ToISODayOfWeek(temporalDate.[[ISOYear]], temporalDate.[[ISOMonth]], temporalDate.[[ISODay]])). features: [Temporal] @@ -16,17 +13,6 @@ features: [Temporal] let cal = new Temporal.Calendar("iso8601"); assert.sameValue(5, cal.dayOfWeek("2019-01-18")); -// leap year -assert.sameValue(2, cal.dayOfWeek("2020-02-18")); -// non leap -assert.sameValue(1, cal.dayOfWeek("2019-02-18")); assert.sameValue(1, cal.dayOfWeek("2019-03-18")); -assert.sameValue(4, cal.dayOfWeek("2019-04-18")); assert.sameValue(6, cal.dayOfWeek("2019-05-18")); -assert.sameValue(2, cal.dayOfWeek("2019-06-18")); -assert.sameValue(4, cal.dayOfWeek("2019-07-18")); assert.sameValue(7, cal.dayOfWeek("2019-08-18")); -assert.sameValue(3, cal.dayOfWeek("2019-09-18")); -assert.sameValue(5, cal.dayOfWeek("2019-10-18")); -assert.sameValue(1, cal.dayOfWeek("2019-11-18")); -assert.sameValue(3, cal.dayOfWeek("2019-12-18")); diff --git a/test/built-ins/Temporal/Calendar/prototype/dayOfWeek/throw-range-error-ToTemporalDate.js b/test/built-ins/Temporal/Calendar/prototype/dayOfWeek/throw-range-error-ToTemporalDate.js new file mode 100644 index 00000000000..d390dd7d767 --- /dev/null +++ b/test/built-ins/Temporal/Calendar/prototype/dayOfWeek/throw-range-error-ToTemporalDate.js @@ -0,0 +1,15 @@ +// Copyright (C) 2021 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-temporal.calendar.prototype.dayOfWeek +description: Temporal.Calendar.prototype.dayOfWeek throws RangeError on + ToTemporalDate when temporalDateLike is invalid string. +info: | + 4. Let temporalDate be ? ToTemporalDate(temporalDateLike). +features: [Temporal] +---*/ +let cal = new Temporal.Calendar("iso8601"); + +assert.throws(RangeError, () => cal.dayOfWeek("invalid string"), + "Throw RangeError if temporalDateLike is invalid"); diff --git a/test/built-ins/Temporal/Calendar/prototype/dayOfWeek/throw-type-error-RequireInternalSlot.js b/test/built-ins/Temporal/Calendar/prototype/dayOfWeek/throw-type-error-RequireInternalSlot.js new file mode 100644 index 00000000000..3b0fc41f7d5 --- /dev/null +++ b/test/built-ins/Temporal/Calendar/prototype/dayOfWeek/throw-type-error-RequireInternalSlot.js @@ -0,0 +1,16 @@ +// Copyright (C) 2021 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-temporal.calendar.prototype.dayOfWeek +description: Temporal.Calendar.prototype.dayOfWeek throws TypeError + when the internal lot is not presented. +info: | + 2. Perform ? RequireInternalSlot(calendar, [[InitializedTemporalCalendar]]). +features: [Temporal] +---*/ +let cal = new Temporal.Calendar("iso8601"); + +let badCal = { dayOfWeek: cal.dayOfWeek } +assert.throws(TypeError, () => badCal.dayOfWeek("2021-03-04"), + "Throw TypeError if no internal slot"); diff --git a/test/built-ins/Temporal/Calendar/prototype/dayOfYear/plain-date-time.js b/test/built-ins/Temporal/Calendar/prototype/dayOfYear/plain-date-time.js index 892085feb14..a811ba1e4e6 100644 --- a/test/built-ins/Temporal/Calendar/prototype/dayOfYear/plain-date-time.js +++ b/test/built-ins/Temporal/Calendar/prototype/dayOfYear/plain-date-time.js @@ -4,20 +4,29 @@ /*--- esid: sec-temporal.calendar.prototype.dayofyear description: Temporal.Calendar.prototype.dayOfYear will take PlainDateTime object and - return the day of year. +return the day of year. + and return Array of the same content. info: | - 1. Let calendar be the this value. - 2. Perform ? RequireInternalSlot(calendar, [[InitializedTemporalCalendar]]). - 3. Assert: calendar.[[Identifier]] is "iso8601". 4. Let temporalDate be ? ToTemporalDate(temporalDateLike). 5. Return 𝔽(! ToISODayOfYear(temporalDate.[[ISOYear]], temporalDate.[[ISOMonth]], temporalDate.[[ISODay]])). features: [Temporal] ---*/ let cal = new Temporal.Calendar("iso8601"); -assert.sameValue(23, cal.dayOfYear(new Temporal.PlainDateTime(1997, 1, 23, 5, 30, 13))); -assert.sameValue(54, cal.dayOfYear(new Temporal.PlainDateTime(1997, 2, 23, 5, 30, 13))); -assert.sameValue(83, cal.dayOfYear(new Temporal.PlainDateTime(1996, 3, 23, 5, 30, 13))); -assert.sameValue(82, cal.dayOfYear(new Temporal.PlainDateTime(1997, 3, 23, 5, 30, 13))); -assert.sameValue(365, cal.dayOfYear(new Temporal.PlainDateTime(1997, 12, 31, 5, 30, 13))); -assert.sameValue(366, cal.dayOfYear(new Temporal.PlainDateTime(1996, 12, 31, 5, 30, 13))); +let dt = new Temporal.PlainDateTime(1997, 1, 23, 5, 30, 13); +assert.sameValue(23, cal.dayOfYear(dt)); + +dt = new Temporal.PlainDateTime(1997, 2, 23, 5, 30, 13); +assert.sameValue(54, cal.dayOfYear(dt)); + +dt = new Temporal.PlainDateTime(1996, 3, 23, 5, 30, 13); +assert.sameValue(83, cal.dayOfYear(dt)); + +dt = new Temporal.PlainDateTime(1997, 3, 23, 5, 30, 13); +assert.sameValue(82, cal.dayOfYear(dt)); + +dt = new Temporal.PlainDateTime(1997, 12, 31, 5, 30, 13); +assert.sameValue(365, cal.dayOfYear(dt)); + +dt = new Temporal.PlainDateTime(1996, 12, 31, 5, 30, 13); +assert.sameValue(366, cal.dayOfYear(dt)); diff --git a/test/built-ins/Temporal/Calendar/prototype/dayOfYear/plain-date.js b/test/built-ins/Temporal/Calendar/prototype/dayOfYear/plain-date.js index 137d2ccb5a5..51067063d52 100644 --- a/test/built-ins/Temporal/Calendar/prototype/dayOfYear/plain-date.js +++ b/test/built-ins/Temporal/Calendar/prototype/dayOfYear/plain-date.js @@ -4,25 +4,36 @@ /*--- esid: sec-temporal.calendar.prototype.dayofyear description: Temporal.Calendar.prototype.dayOfYear will take PlainDate object and - return the day of year. +return the day of year. + and return Array of the same content. info: | - 1. Let calendar be the this value. - 2. Perform ? RequireInternalSlot(calendar, [[InitializedTemporalCalendar]]). - 3. Assert: calendar.[[Identifier]] is "iso8601". - 4. Let temporalDate be ? ToTemporalDate(temporalDateLike). 5. Return 𝔽(! ToISODayOfYear(temporalDate.[[ISOYear]], temporalDate.[[ISOMonth]], temporalDate.[[ISODay]])). features: [Temporal] ---*/ let cal = new Temporal.Calendar("iso8601"); -assert.sameValue(1, cal.dayOfYear(new Temporal.PlainDate(1970, 1, 1))); -assert.sameValue(1, cal.dayOfYear(new Temporal.PlainDate(2000, 1, 1))); - -assert.sameValue(15, cal.dayOfYear(new Temporal.PlainDate(2021, 1, 15))); -assert.sameValue(46, cal.dayOfYear(new Temporal.PlainDate(2020, 2, 15))); -assert.sameValue(46, cal.dayOfYear(new Temporal.PlainDate(2000, 2, 15))); -assert.sameValue(75, cal.dayOfYear(new Temporal.PlainDate(2020, 3, 15))); -assert.sameValue(75, cal.dayOfYear(new Temporal.PlainDate(2000, 3, 15))); -assert.sameValue(74, cal.dayOfYear(new Temporal.PlainDate(2001, 3, 15))); -assert.sameValue(366, cal.dayOfYear(new Temporal.PlainDate(2000, 12, 31))); -assert.sameValue(365, cal.dayOfYear(new Temporal.PlainDate(2001, 12, 31))); +let d = new Temporal.PlainDate(1970, 1, 1); +assert.sameValue(1, cal.dayOfYear(d)); +d = new Temporal.PlainDate(2000, 1, 1); +assert.sameValue(1, cal.dayOfYear(d)); + +d = new Temporal.PlainDate(2021, 1, 15); +assert.sameValue(15, cal.dayOfYear(d)); + +d = new Temporal.PlainDate(2020, 2, 15); +assert.sameValue(46, cal.dayOfYear(d)); + +d = new Temporal.PlainDate(2020, 3, 15); +assert.sameValue(75, cal.dayOfYear(d)); + +d = new Temporal.PlainDate(2000, 3, 15); +assert.sameValue(75, cal.dayOfYear(d)); + +d = new Temporal.PlainDate(2001, 3, 15); +assert.sameValue(74, cal.dayOfYear(d)); + +d = new Temporal.PlainDate(2000, 12, 31); +assert.sameValue(366, cal.dayOfYear(d)); + +d = new Temporal.PlainDate(2001, 12, 31); +assert.sameValue(365, cal.dayOfYear(d)); diff --git a/test/built-ins/Temporal/Calendar/prototype/dayOfYear/string.js b/test/built-ins/Temporal/Calendar/prototype/dayOfYear/string.js index e7276cc0f42..fac42af7e62 100644 --- a/test/built-ins/Temporal/Calendar/prototype/dayOfYear/string.js +++ b/test/built-ins/Temporal/Calendar/prototype/dayOfYear/string.js @@ -4,11 +4,9 @@ /*--- esid: sec-temporal.calendar.prototype.dayofyear description: Temporal.Calendar.prototype.dayOfYear will take ISO8601 string and - return the day of year. +return the day of year. + and return Array of the same content. info: | - 1. Let calendar be the this value. - 2. Perform ? RequireInternalSlot(calendar, [[InitializedTemporalCalendar]]). - 3. Assert: calendar.[[Identifier]] is "iso8601". 4. Let temporalDate be ? ToTemporalDate(temporalDateLike). 5. Return 𝔽(! ToISODayOfYear(temporalDate.[[ISOYear]], temporalDate.[[ISOMonth]], temporalDate.[[ISODay]])). features: [Temporal] diff --git a/test/built-ins/Temporal/Calendar/prototype/dayOfYear/throw-range-error-ToTemporalDate.js b/test/built-ins/Temporal/Calendar/prototype/dayOfYear/throw-range-error-ToTemporalDate.js new file mode 100644 index 00000000000..ac8b2a9006d --- /dev/null +++ b/test/built-ins/Temporal/Calendar/prototype/dayOfYear/throw-range-error-ToTemporalDate.js @@ -0,0 +1,15 @@ +// Copyright (C) 2021 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-temporal.calendar.prototype.dayOfYear +description: Temporal.Calendar.prototype.dayOfYear throws RangeError on + ToTemporalDate when temporalDateLike is invalid string. +info: | + 4. Let temporalDate be ? ToTemporalDate(temporalDateLike). +features: [Temporal] +---*/ +let cal = new Temporal.Calendar("iso8601"); + +assert.throws(RangeError, () => cal.dayOfYear("invalid string"), + "Throw RangeError if temporalDateLike is invalid"); diff --git a/test/built-ins/Temporal/Calendar/prototype/dayOfYear/throw-type-error-RequireInternalSlot.js b/test/built-ins/Temporal/Calendar/prototype/dayOfYear/throw-type-error-RequireInternalSlot.js new file mode 100644 index 00000000000..93713101511 --- /dev/null +++ b/test/built-ins/Temporal/Calendar/prototype/dayOfYear/throw-type-error-RequireInternalSlot.js @@ -0,0 +1,16 @@ +// Copyright (C) 2021 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-temporal.calendar.prototype.dayOfYear +description: Temporal.Calendar.prototype.dayOfYear throws TypeError + when the internal lot is not presented. +info: | + 2. Perform ? RequireInternalSlot(calendar, [[InitializedTemporalCalendar]]). +features: [Temporal] +---*/ +let cal = new Temporal.Calendar("iso8601"); + +let badCal = { dayOfYear: cal.dayOfYear } +assert.throws(TypeError, () => badCal.dayOfYear("2021-03-04"), + "Throw TypeError if no internal slot"); From 38183a6e10320945aa0ca9a6232256c0fa53f86d Mon Sep 17 00:00:00 2001 From: Frank Tang Date: Thu, 5 Aug 2021 15:06:20 -0700 Subject: [PATCH 5/5] fix comments --- .../Temporal/Calendar/prototype/dayOfWeek/plain-date-time.js | 1 - .../Temporal/Calendar/prototype/dayOfWeek/plain-date.js | 1 - .../built-ins/Temporal/Calendar/prototype/dayOfWeek/string.js | 1 - .../prototype/dayOfWeek/throw-range-error-ToTemporalDate.js | 1 - .../dayOfWeek/throw-type-error-RequireInternalSlot.js | 1 - .../Temporal/Calendar/prototype/dayOfYear/plain-date-time.js | 4 +--- .../Temporal/Calendar/prototype/dayOfYear/plain-date.js | 4 +--- .../built-ins/Temporal/Calendar/prototype/dayOfYear/string.js | 4 +--- .../prototype/dayOfYear/throw-range-error-ToTemporalDate.js | 1 - .../dayOfYear/throw-type-error-RequireInternalSlot.js | 1 - 10 files changed, 3 insertions(+), 16 deletions(-) diff --git a/test/built-ins/Temporal/Calendar/prototype/dayOfWeek/plain-date-time.js b/test/built-ins/Temporal/Calendar/prototype/dayOfWeek/plain-date-time.js index 0fc49779a9b..bb966e09a24 100644 --- a/test/built-ins/Temporal/Calendar/prototype/dayOfWeek/plain-date-time.js +++ b/test/built-ins/Temporal/Calendar/prototype/dayOfWeek/plain-date-time.js @@ -1,6 +1,5 @@ // Copyright (C) 2021 the V8 project authors. All rights reserved. // This code is governed by the BSD license found in the LICENSE file. - /*--- esid: sec-temporal.calendar.prototype.dayofweek description: Temporal.Calendar.prototype.dayOfWeek will take Temporal.PlainDateTime objects diff --git a/test/built-ins/Temporal/Calendar/prototype/dayOfWeek/plain-date.js b/test/built-ins/Temporal/Calendar/prototype/dayOfWeek/plain-date.js index e63deb29558..a15508c7c5f 100644 --- a/test/built-ins/Temporal/Calendar/prototype/dayOfWeek/plain-date.js +++ b/test/built-ins/Temporal/Calendar/prototype/dayOfWeek/plain-date.js @@ -1,6 +1,5 @@ // Copyright (C) 2021 the V8 project authors. All rights reserved. // This code is governed by the BSD license found in the LICENSE file. - /*--- esid: sec-temporal.calendar.prototype.dayofweek description: Temporal.Calendar.prototype.dayOfWeek will take Temporal.PlainDate objects diff --git a/test/built-ins/Temporal/Calendar/prototype/dayOfWeek/string.js b/test/built-ins/Temporal/Calendar/prototype/dayOfWeek/string.js index 57652820d05..567be1068fa 100644 --- a/test/built-ins/Temporal/Calendar/prototype/dayOfWeek/string.js +++ b/test/built-ins/Temporal/Calendar/prototype/dayOfWeek/string.js @@ -1,6 +1,5 @@ // Copyright (C) 2021 the V8 project authors. All rights reserved. // This code is governed by the BSD license found in the LICENSE file. - /*--- esid: sec-temporal.calendar.prototype.dayofweek description: Temporal.Calendar.prototype.dayOfWeek will take ISO8601 string diff --git a/test/built-ins/Temporal/Calendar/prototype/dayOfWeek/throw-range-error-ToTemporalDate.js b/test/built-ins/Temporal/Calendar/prototype/dayOfWeek/throw-range-error-ToTemporalDate.js index d390dd7d767..6f5bac10e0a 100644 --- a/test/built-ins/Temporal/Calendar/prototype/dayOfWeek/throw-range-error-ToTemporalDate.js +++ b/test/built-ins/Temporal/Calendar/prototype/dayOfWeek/throw-range-error-ToTemporalDate.js @@ -1,6 +1,5 @@ // Copyright (C) 2021 the V8 project authors. All rights reserved. // This code is governed by the BSD license found in the LICENSE file. - /*--- esid: sec-temporal.calendar.prototype.dayOfWeek description: Temporal.Calendar.prototype.dayOfWeek throws RangeError on diff --git a/test/built-ins/Temporal/Calendar/prototype/dayOfWeek/throw-type-error-RequireInternalSlot.js b/test/built-ins/Temporal/Calendar/prototype/dayOfWeek/throw-type-error-RequireInternalSlot.js index 3b0fc41f7d5..786f662c139 100644 --- a/test/built-ins/Temporal/Calendar/prototype/dayOfWeek/throw-type-error-RequireInternalSlot.js +++ b/test/built-ins/Temporal/Calendar/prototype/dayOfWeek/throw-type-error-RequireInternalSlot.js @@ -1,6 +1,5 @@ // Copyright (C) 2021 the V8 project authors. All rights reserved. // This code is governed by the BSD license found in the LICENSE file. - /*--- esid: sec-temporal.calendar.prototype.dayOfWeek description: Temporal.Calendar.prototype.dayOfWeek throws TypeError diff --git a/test/built-ins/Temporal/Calendar/prototype/dayOfYear/plain-date-time.js b/test/built-ins/Temporal/Calendar/prototype/dayOfYear/plain-date-time.js index a811ba1e4e6..129e3adc12c 100644 --- a/test/built-ins/Temporal/Calendar/prototype/dayOfYear/plain-date-time.js +++ b/test/built-ins/Temporal/Calendar/prototype/dayOfYear/plain-date-time.js @@ -1,11 +1,9 @@ // Copyright (C) 2021 the V8 project authors. All rights reserved. // This code is governed by the BSD license found in the LICENSE file. - /*--- esid: sec-temporal.calendar.prototype.dayofyear description: Temporal.Calendar.prototype.dayOfYear will take PlainDateTime object and -return the day of year. - and return Array of the same content. + return the day of year. info: | 4. Let temporalDate be ? ToTemporalDate(temporalDateLike). 5. Return 𝔽(! ToISODayOfYear(temporalDate.[[ISOYear]], temporalDate.[[ISOMonth]], temporalDate.[[ISODay]])). diff --git a/test/built-ins/Temporal/Calendar/prototype/dayOfYear/plain-date.js b/test/built-ins/Temporal/Calendar/prototype/dayOfYear/plain-date.js index 51067063d52..d335f5c402c 100644 --- a/test/built-ins/Temporal/Calendar/prototype/dayOfYear/plain-date.js +++ b/test/built-ins/Temporal/Calendar/prototype/dayOfYear/plain-date.js @@ -1,11 +1,9 @@ // Copyright (C) 2021 the V8 project authors. All rights reserved. // This code is governed by the BSD license found in the LICENSE file. - /*--- esid: sec-temporal.calendar.prototype.dayofyear description: Temporal.Calendar.prototype.dayOfYear will take PlainDate object and -return the day of year. - and return Array of the same content. + return the day of year. info: | 5. Return 𝔽(! ToISODayOfYear(temporalDate.[[ISOYear]], temporalDate.[[ISOMonth]], temporalDate.[[ISODay]])). features: [Temporal] diff --git a/test/built-ins/Temporal/Calendar/prototype/dayOfYear/string.js b/test/built-ins/Temporal/Calendar/prototype/dayOfYear/string.js index fac42af7e62..e17225c4e36 100644 --- a/test/built-ins/Temporal/Calendar/prototype/dayOfYear/string.js +++ b/test/built-ins/Temporal/Calendar/prototype/dayOfYear/string.js @@ -1,11 +1,9 @@ // Copyright (C) 2021 the V8 project authors. All rights reserved. // This code is governed by the BSD license found in the LICENSE file. - /*--- esid: sec-temporal.calendar.prototype.dayofyear description: Temporal.Calendar.prototype.dayOfYear will take ISO8601 string and -return the day of year. - and return Array of the same content. + return the day of year. info: | 4. Let temporalDate be ? ToTemporalDate(temporalDateLike). 5. Return 𝔽(! ToISODayOfYear(temporalDate.[[ISOYear]], temporalDate.[[ISOMonth]], temporalDate.[[ISODay]])). diff --git a/test/built-ins/Temporal/Calendar/prototype/dayOfYear/throw-range-error-ToTemporalDate.js b/test/built-ins/Temporal/Calendar/prototype/dayOfYear/throw-range-error-ToTemporalDate.js index ac8b2a9006d..3f1e301d913 100644 --- a/test/built-ins/Temporal/Calendar/prototype/dayOfYear/throw-range-error-ToTemporalDate.js +++ b/test/built-ins/Temporal/Calendar/prototype/dayOfYear/throw-range-error-ToTemporalDate.js @@ -1,6 +1,5 @@ // Copyright (C) 2021 the V8 project authors. All rights reserved. // This code is governed by the BSD license found in the LICENSE file. - /*--- esid: sec-temporal.calendar.prototype.dayOfYear description: Temporal.Calendar.prototype.dayOfYear throws RangeError on diff --git a/test/built-ins/Temporal/Calendar/prototype/dayOfYear/throw-type-error-RequireInternalSlot.js b/test/built-ins/Temporal/Calendar/prototype/dayOfYear/throw-type-error-RequireInternalSlot.js index 93713101511..d9c28e495d0 100644 --- a/test/built-ins/Temporal/Calendar/prototype/dayOfYear/throw-type-error-RequireInternalSlot.js +++ b/test/built-ins/Temporal/Calendar/prototype/dayOfYear/throw-type-error-RequireInternalSlot.js @@ -1,6 +1,5 @@ // Copyright (C) 2021 the V8 project authors. All rights reserved. // This code is governed by the BSD license found in the LICENSE file. - /*--- esid: sec-temporal.calendar.prototype.dayOfYear description: Temporal.Calendar.prototype.dayOfYear throws TypeError