mirror of https://github.com/tc39/test262.git
split simple into different files
This commit is contained in:
parent
173684422c
commit
a585faf566
|
@ -1,50 +0,0 @@
|
|||
// 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.datefromfields
|
||||
description: Temporal.Calendar.prototype.dateFromFields
|
||||
info: |
|
||||
1. Let calendar be the this value.
|
||||
2. Perform ? RequireInternalSlot(calendar, [[InitializedTemporalCalendar]]).
|
||||
3. Assert: calendar.[[Identifier]] is "iso8601".
|
||||
4. If Type(fields) is not Object, throw a TypeError exception.
|
||||
5. Set options to ? GetOptionsObject(options).
|
||||
6. Let result be ? ISODateFromFields(fields, options).
|
||||
7. Return ? CreateTemporalDate(result.[[Year]], result.[[Month]], result.[[Day]], calendar).
|
||||
features: [Temporal]
|
||||
---*/
|
||||
let cal = new Temporal.Calendar("iso8601")
|
||||
|
||||
assert.sameValue("2021-07-15", cal.dateFromFields({year: 2021, month: 7, day: 15}).toJSON());
|
||||
assert.sameValue("2021-07-03", cal.dateFromFields({year: 2021, month: 7, day: 3}).toJSON());
|
||||
assert.sameValue("2021-12-31", cal.dateFromFields({year: 2021, month: 12, day: 31}).toJSON());
|
||||
assert.sameValue("2021-07-15", cal.dateFromFields({year: 2021, monthCode: "M07", day: 15}).toJSON());
|
||||
assert.sameValue("2021-07-03", cal.dateFromFields({year: 2021, monthCode: "M07", day: 3}).toJSON());
|
||||
assert.sameValue("2021-12-31", cal.dateFromFields({year: 2021, monthCode: "M12", day: 31}).toJSON());
|
||||
|
||||
assert.sameValue("2021-01-31", cal.dateFromFields({year: 2021, month: 1, day: 133}).toJSON());
|
||||
assert.sameValue("2021-02-28", cal.dateFromFields({year: 2021, month: 2, day: 133}).toJSON());
|
||||
assert.sameValue("2021-03-31", cal.dateFromFields({year: 2021, month: 3, day: 9033}).toJSON());
|
||||
assert.sameValue("2021-04-30", cal.dateFromFields({year: 2021, month: 4, day: 50}).toJSON());
|
||||
assert.sameValue("2021-05-31", cal.dateFromFields({year: 2021, month: 5, day: 77}).toJSON());
|
||||
assert.sameValue("2021-06-30", cal.dateFromFields({year: 2021, month: 6, day: 33}).toJSON());
|
||||
assert.sameValue("2021-07-31", cal.dateFromFields({year: 2021, month: 7, day: 33}).toJSON());
|
||||
assert.sameValue("2021-08-31", cal.dateFromFields({year: 2021, month: 8, day: 300}).toJSON());
|
||||
assert.sameValue("2021-09-30", cal.dateFromFields({year: 2021, month: 9, day: 400}).toJSON());
|
||||
assert.sameValue("2021-10-31", cal.dateFromFields({year: 2021, month: 10, day: 400}).toJSON());
|
||||
assert.sameValue("2021-11-30", cal.dateFromFields({year: 2021, month: 11, day: 400}).toJSON());
|
||||
assert.sameValue("2021-12-31", cal.dateFromFields({year: 2021, month: 12, day: 500}).toJSON());
|
||||
assert.sameValue("2021-12-31", cal.dateFromFields({year: 2021, month: 13, day: 500}).toJSON());
|
||||
assert.sameValue("2021-12-31", cal.dateFromFields({year: 2021, month: 999999, day: 500}).toJSON());
|
||||
assert.sameValue("2021-01-31", cal.dateFromFields({year: 2021, monthCode: "M01", day: 133}).toJSON());
|
||||
assert.sameValue("2021-02-28", cal.dateFromFields({year: 2021, monthCode: "M02", day: 133}).toJSON());
|
||||
assert.sameValue("2021-03-31", cal.dateFromFields({year: 2021, monthCode: "M03", day: 9033}).toJSON());
|
||||
assert.sameValue("2021-04-30", cal.dateFromFields({year: 2021, monthCode: "M04", day: 50}).toJSON());
|
||||
assert.sameValue("2021-05-31", cal.dateFromFields({year: 2021, monthCode: "M05", day: 77}).toJSON());
|
||||
assert.sameValue("2021-06-30", cal.dateFromFields({year: 2021, monthCode: "M06", day: 33}).toJSON());
|
||||
assert.sameValue("2021-07-31", cal.dateFromFields({year: 2021, monthCode: "M07", day: 33}).toJSON());
|
||||
assert.sameValue("2021-08-31", cal.dateFromFields({year: 2021, monthCode: "M08", day: 300}).toJSON());
|
||||
assert.sameValue("2021-09-30", cal.dateFromFields({year: 2021, monthCode: "M09", day: 400}).toJSON());
|
||||
assert.sameValue("2021-10-31", cal.dateFromFields({year: 2021, monthCode: "M10", day: 400}).toJSON());
|
||||
assert.sameValue("2021-11-30", cal.dateFromFields({year: 2021, monthCode: "M11", day: 400}).toJSON());
|
||||
assert.sameValue("2021-12-31", cal.dateFromFields({year: 2021, monthCode: "M12", day: 500}).toJSON());
|
|
@ -11,5 +11,5 @@ features: [Temporal]
|
|||
let cal = new Temporal.Calendar("iso8601")
|
||||
let badCal = {dateFromFields: cal.dateFromFields};
|
||||
|
||||
assert.throws(TypeError, () => badCal.dateFromFields({year: 2021, month: 3, day: 17}),
|
||||
assert.throws(TypeError, () => badCal.dateFromFields({}),
|
||||
"calendar has no [[InitializedTemporalCalendar]]");
|
||||
|
|
87
test/built-ins/Temporal/Calendar/prototype/dateFromFields/with-year-month-day-need-constrain.js
vendored
Normal file
87
test/built-ins/Temporal/Calendar/prototype/dateFromFields/with-year-month-day-need-constrain.js
vendored
Normal file
|
@ -0,0 +1,87 @@
|
|||
// 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.datefromfields
|
||||
description: Temporal.Calendar.prototype.dateFromFields with year/month/day and need constrain
|
||||
info: |
|
||||
1. Let calendar be the this value.
|
||||
2. Perform ? RequireInternalSlot(calendar, [[InitializedTemporalCalendar]]).
|
||||
3. Assert: calendar.[[Identifier]] is "iso8601".
|
||||
4. If Type(fields) is not Object, throw a TypeError exception.
|
||||
5. Set options to ? GetOptionsObject(options).
|
||||
6. Let result be ? ISODateFromFields(fields, options).
|
||||
7. Return ? CreateTemporalDate(result.[[Year]], result.[[Month]], result.[[Day]], calendar).
|
||||
features: [Temporal]
|
||||
includes: [temporalHelpers.js]
|
||||
---*/
|
||||
let cal = new Temporal.Calendar("iso8601")
|
||||
|
||||
TemporalHelpers.assertPlainDate(
|
||||
cal.dateFromFields({year: 2021, month: 1, day: 133}),
|
||||
2021, 1, "M01", 31,
|
||||
"year/month/day with day need to be constrained in Jan");
|
||||
|
||||
TemporalHelpers.assertPlainDate(
|
||||
cal.dateFromFields({year: 2021, month: 2, day: 133}),
|
||||
2021, 2, "M02", 28,
|
||||
"year/month/day with day need to be constrained in Feb");
|
||||
|
||||
TemporalHelpers.assertPlainDate(
|
||||
cal.dateFromFields({year: 2021, month: 3, day: 133}),
|
||||
2021, 3, "M03", 31,
|
||||
"year/month/day with day need to be constrained in March");
|
||||
|
||||
TemporalHelpers.assertPlainDate(
|
||||
cal.dateFromFields({year: 2021, month: 4, day: 133}),
|
||||
2021, 4, "M04", 30,
|
||||
"year/month/day with day need to be constrained in April");
|
||||
|
||||
TemporalHelpers.assertPlainDate(
|
||||
cal.dateFromFields({year: 2021, month: 5, day: 133}),
|
||||
2021, 5, "M05", 31,
|
||||
"year/month/day with day need to be constrained in May");
|
||||
|
||||
TemporalHelpers.assertPlainDate(
|
||||
cal.dateFromFields({year: 2021, month: 6, day: 133}),
|
||||
2021, 6, "M06", 30,
|
||||
"year/month/day with day need to be constrained in Jun");
|
||||
|
||||
TemporalHelpers.assertPlainDate(
|
||||
cal.dateFromFields({year: 2021, month: 7, day: 133}),
|
||||
2021, 7, "M07", 31,
|
||||
"year/month/day with day need to be constrained in July");
|
||||
|
||||
TemporalHelpers.assertPlainDate(
|
||||
cal.dateFromFields({year: 2021, month: 8, day: 133}),
|
||||
2021, 8, "M08", 31,
|
||||
"year/month/day with day need to be constrained in Aug");
|
||||
|
||||
TemporalHelpers.assertPlainDate(
|
||||
cal.dateFromFields({year: 2021, month: 9, day: 133}),
|
||||
2021, 9, "M09", 30,
|
||||
"year/month/day with day need to be constrained in Sept.");
|
||||
|
||||
TemporalHelpers.assertPlainDate(
|
||||
cal.dateFromFields({year: 2021, month: 10, day: 133}),
|
||||
2021, 10, "M10", 31,
|
||||
"year/month/day with day need to be constrained in Oct.");
|
||||
|
||||
TemporalHelpers.assertPlainDate(
|
||||
cal.dateFromFields({year: 2021, month: 11, day: 133}),
|
||||
2021, 11, "M11", 30,
|
||||
"year/month/day with day need to be constrained in Nov.");
|
||||
|
||||
TemporalHelpers.assertPlainDate(
|
||||
cal.dateFromFields({year: 2021, month: 12, day: 133}),
|
||||
2021, 12, "M12", 31,
|
||||
"year/month/day with day need to be constrained in Dec.");
|
||||
|
||||
TemporalHelpers.assertPlainDate(
|
||||
cal.dateFromFields({year: 2021, month: 13, day: 500}),
|
||||
2021, 12, "M12", 31,
|
||||
"year/month/day with month and day need to be constrained");
|
||||
|
||||
TemporalHelpers.assertPlainDate(
|
||||
cal.dateFromFields({year: 2021, month: 999999, day: 500}),
|
||||
2021, 12, "M12", 31,
|
||||
"year/month/day with month and day need to be constrained");
|
22
test/built-ins/Temporal/Calendar/prototype/dateFromFields/with-year-month-day.js
vendored
Normal file
22
test/built-ins/Temporal/Calendar/prototype/dateFromFields/with-year-month-day.js
vendored
Normal file
|
@ -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.datefromfields
|
||||
description: Temporal.Calendar.prototype.dateFromFields with year/month/day
|
||||
info: |
|
||||
1. Let calendar be the this value.
|
||||
2. Perform ? RequireInternalSlot(calendar, [[InitializedTemporalCalendar]]).
|
||||
3. Assert: calendar.[[Identifier]] is "iso8601".
|
||||
4. If Type(fields) is not Object, throw a TypeError exception.
|
||||
5. Set options to ? GetOptionsObject(options).
|
||||
6. Let result be ? ISODateFromFields(fields, options).
|
||||
7. Return ? CreateTemporalDate(result.[[Year]], result.[[Month]], result.[[Day]], calendar).
|
||||
features: [Temporal]
|
||||
includes: [temporalHelpers.js]
|
||||
---*/
|
||||
let cal = new Temporal.Calendar("iso8601")
|
||||
|
||||
TemporalHelpers.assertPlainDate(
|
||||
cal.dateFromFields({year: 2021, month: 7, day: 15}),
|
||||
2021, 7, "M07", 15,
|
||||
"year/month/day");
|
|
@ -0,0 +1,77 @@
|
|||
// 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.datefromfields
|
||||
description: Temporal.Calendar.prototype.dateFromFields with year, monthCode and day and need constrain
|
||||
info: |
|
||||
1. Let calendar be the this value.
|
||||
2. Perform ? RequireInternalSlot(calendar, [[InitializedTemporalCalendar]]).
|
||||
3. Assert: calendar.[[Identifier]] is "iso8601".
|
||||
4. If Type(fields) is not Object, throw a TypeError exception.
|
||||
5. Set options to ? GetOptionsObject(options).
|
||||
6. Let result be ? ISODateFromFields(fields, options).
|
||||
7. Return ? CreateTemporalDate(result.[[Year]], result.[[Month]], result.[[Day]], calendar).
|
||||
features: [Temporal]
|
||||
includes: [temporalHelpers.js]
|
||||
---*/
|
||||
let cal = new Temporal.Calendar("iso8601")
|
||||
|
||||
TemporalHelpers.assertPlainDate(
|
||||
cal.dateFromFields({year: 2021, monthCode: "M01", day: 133}),
|
||||
2021, 1, "M01", 31,
|
||||
"year/monthCode/day with day need to be constrained in Jan");
|
||||
|
||||
TemporalHelpers.assertPlainDate(
|
||||
cal.dateFromFields({year: 2021, monthCode: "M02", day: 133}),
|
||||
2021, 2, "M02", 28,
|
||||
"year/monthCode/day with day need to be constrained in Feb");
|
||||
|
||||
TemporalHelpers.assertPlainDate(
|
||||
cal.dateFromFields({year: 2021, monthCode: "M03", day: 133}),
|
||||
2021, 3, "M03", 31,
|
||||
"year/monthCode/day with day need to be constrained in March");
|
||||
|
||||
TemporalHelpers.assertPlainDate(
|
||||
cal.dateFromFields({year: 2021, monthCode: "M04", day: 133}),
|
||||
2021, 4, "M04", 30,
|
||||
"year/monthCode/day with day need to be constrained in April");
|
||||
|
||||
TemporalHelpers.assertPlainDate(
|
||||
cal.dateFromFields({year: 2021, monthCode: "M05", day: 133}),
|
||||
2021, 5, "M05", 31,
|
||||
"year/monthCode/day with day need to be constrained in May");
|
||||
|
||||
TemporalHelpers.assertPlainDate(
|
||||
cal.dateFromFields({year: 2021, monthCode: "M06", day: 133}),
|
||||
2021, 6, "M06", 30,
|
||||
"year/monthCode/day with day need to be constrained in Jun");
|
||||
|
||||
TemporalHelpers.assertPlainDate(
|
||||
cal.dateFromFields({year: 2021, monthCode: "M07", day: 133}),
|
||||
2021, 7, "M07", 31,
|
||||
"year/monthCode/day with day need to be constrained in July");
|
||||
|
||||
TemporalHelpers.assertPlainDate(
|
||||
cal.dateFromFields({year: 2021, monthCode: "M08", day: 133}),
|
||||
2021, 8, "M08", 31,
|
||||
"year/monthCode/day with day need to be constrained in Aug");
|
||||
|
||||
TemporalHelpers.assertPlainDate(
|
||||
cal.dateFromFields({year: 2021, monthCode: "M09", day: 133}),
|
||||
2021, 9, "M09", 30,
|
||||
"year/monthCode/day with day need to be constrained in Sept.");
|
||||
|
||||
TemporalHelpers.assertPlainDate(
|
||||
cal.dateFromFields({year: 2021, monthCode: "M10", day: 133}),
|
||||
2021, 10, "M10", 31,
|
||||
"year/monthCode/day with day need to be constrained in Oct.");
|
||||
|
||||
TemporalHelpers.assertPlainDate(
|
||||
cal.dateFromFields({year: 2021, monthCode: "M11", day: 133}),
|
||||
2021, 11, "M11", 30,
|
||||
"year/monthCode/day with day need to be constrained in Nov.");
|
||||
|
||||
TemporalHelpers.assertPlainDate(
|
||||
cal.dateFromFields({year: 2021, monthCode: "M12", day: 133}),
|
||||
2021, 12, "M12", 31,
|
||||
"year/monthCode/day with day need to be constrained in Dec.");
|
22
test/built-ins/Temporal/Calendar/prototype/dateFromFields/with-year-monthCode-day.js
vendored
Normal file
22
test/built-ins/Temporal/Calendar/prototype/dateFromFields/with-year-monthCode-day.js
vendored
Normal file
|
@ -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.datefromfields
|
||||
description: Temporal.Calendar.prototype.dateFromFields with year, monthCode and day.
|
||||
info: |
|
||||
1. Let calendar be the this value.
|
||||
2. Perform ? RequireInternalSlot(calendar, [[InitializedTemporalCalendar]]).
|
||||
3. Assert: calendar.[[Identifier]] is "iso8601".
|
||||
4. If Type(fields) is not Object, throw a TypeError exception.
|
||||
5. Set options to ? GetOptionsObject(options).
|
||||
6. Let result be ? ISODateFromFields(fields, options).
|
||||
7. Return ? CreateTemporalDate(result.[[Year]], result.[[Month]], result.[[Day]], calendar).
|
||||
features: [Temporal]
|
||||
includes: [temporalHelpers.js]
|
||||
---*/
|
||||
let cal = new Temporal.Calendar("iso8601")
|
||||
|
||||
TemporalHelpers.assertPlainDate(
|
||||
cal.dateFromFields({year: 2021, monthCode: "M07", day: 15}),
|
||||
2021, 7, "M07", 15,
|
||||
"year/monthCode/day");
|
Loading…
Reference in New Issue