mirror of https://github.com/tc39/test262.git
Regularize year zero tests
Some of these strings wouldn't have been valid even with a valid year in them (e.g. strings ending in +01:00[UTC]) so fix up the strings that we test. While touching these tests, I took the opportunity to regularize them, and add some missing ones for ISO strings that convert to Calendar and TimeZone.
This commit is contained in:
parent
020faf5c7a
commit
65a7ace1cb
24
test/built-ins/Temporal/Calendar/prototype/dateAdd/argument-propertybag-calendar-year-zero.js
vendored
Normal file
24
test/built-ins/Temporal/Calendar/prototype/dateAdd/argument-propertybag-calendar-year-zero.js
vendored
Normal file
|
@ -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.calendar.prototype.dateadd
|
||||
description: Negative zero, as an extended year, is rejected
|
||||
features: [Temporal, arrow-function]
|
||||
---*/
|
||||
|
||||
const invalidStrings = [
|
||||
"-000000-10-31",
|
||||
"-000000-10-31T17:45",
|
||||
"-000000-10-31T17:45Z",
|
||||
"-000000-10-31T17:45+01:00",
|
||||
"-000000-10-31T17:45+00:00[UTC]",
|
||||
];
|
||||
const instance = new Temporal.Calendar("iso8601");
|
||||
invalidStrings.forEach((arg) => {
|
||||
assert.throws(
|
||||
RangeError,
|
||||
() => instance.dateAdd(arg, new Temporal.Duration()),
|
||||
"reject minus zero as extended year"
|
||||
);
|
||||
});
|
|
@ -7,11 +7,17 @@ description: Negative zero, as an extended year, is rejected
|
|||
features: [Temporal, arrow-function]
|
||||
---*/
|
||||
|
||||
const arg = "-000000-10-31";
|
||||
const invalidStrings = [
|
||||
"-000000-10-31",
|
||||
"-000000-10-31T00:45",
|
||||
"-000000-10-31T00:45+01:00",
|
||||
"-000000-10-31T00:45+00:00[UTC]",
|
||||
];
|
||||
const instance = new Temporal.Calendar("iso8601");
|
||||
|
||||
assert.throws(
|
||||
invalidStrings.forEach((arg) => {
|
||||
assert.throws(
|
||||
RangeError,
|
||||
() => { instance.dateAdd(arg, new Temporal.Duration()); },
|
||||
() => instance.dateAdd(arg, new Temporal.Duration()),
|
||||
"reject minus zero as extended year"
|
||||
);
|
||||
);
|
||||
});
|
||||
|
|
29
test/built-ins/Temporal/Calendar/prototype/dateUntil/argument-propertybag-calendar-year-zero.js
vendored
Normal file
29
test/built-ins/Temporal/Calendar/prototype/dateUntil/argument-propertybag-calendar-year-zero.js
vendored
Normal file
|
@ -0,0 +1,29 @@
|
|||
// 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.calendar.prototype.dateuntil
|
||||
description: Negative zero, as an extended year, is rejected
|
||||
features: [Temporal, arrow-function]
|
||||
---*/
|
||||
|
||||
const invalidStrings = [
|
||||
"-000000-10-31",
|
||||
"-000000-10-31T17:45",
|
||||
"-000000-10-31T17:45Z",
|
||||
"-000000-10-31T17:45+01:00",
|
||||
"-000000-10-31T17:45+00:00[UTC]",
|
||||
];
|
||||
const instance = new Temporal.Calendar("iso8601");
|
||||
invalidStrings.forEach((arg) => {
|
||||
assert.throws(
|
||||
RangeError,
|
||||
() => instance.dateUntil(arg, new Temporal.PlainDate(1977, 11, 19)),
|
||||
"reject minus zero as extended year (first argument)"
|
||||
);
|
||||
assert.throws(
|
||||
RangeError,
|
||||
() => instance.dateUntil(new Temporal.PlainDate(1977, 11, 19), arg),
|
||||
"reject minus zero as extended year (second argument)"
|
||||
);
|
||||
});
|
|
@ -9,16 +9,23 @@ features: [Temporal]
|
|||
|
||||
const calendar = new Temporal.Calendar("iso8601");
|
||||
const date = new Temporal.PlainDate(2000, 5, 2);
|
||||
const bad = "-000000-03-14";
|
||||
const invalidStrings = [
|
||||
"-000000-10-31",
|
||||
"-000000-10-31T00:45",
|
||||
"-000000-10-31T00:45+01:00",
|
||||
"-000000-10-31T00:45+00:00[UTC]",
|
||||
];
|
||||
|
||||
assert.throws(
|
||||
RangeError,
|
||||
() => calendar.dateUntil(bad, date),
|
||||
"cannot use minus zero as extended date (first argument)"
|
||||
);
|
||||
invalidStrings.forEach((arg) => {
|
||||
assert.throws(
|
||||
RangeError,
|
||||
() => calendar.dateUntil(arg, date),
|
||||
"cannot use minus zero as extended date (first argument)"
|
||||
);
|
||||
|
||||
assert.throws(
|
||||
RangeError,
|
||||
() => calendar.dateUntil(date, bad),
|
||||
"cannot use minus zero as extended date (second argument)"
|
||||
);
|
||||
assert.throws(
|
||||
RangeError,
|
||||
() => calendar.dateUntil(date, arg),
|
||||
"cannot use minus zero as extended date (second argument)"
|
||||
);
|
||||
});
|
||||
|
|
24
test/built-ins/Temporal/Calendar/prototype/day/argument-propertybag-calendar-year-zero.js
vendored
Normal file
24
test/built-ins/Temporal/Calendar/prototype/day/argument-propertybag-calendar-year-zero.js
vendored
Normal file
|
@ -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.calendar.prototype.day
|
||||
description: Negative zero, as an extended year, is rejected
|
||||
features: [Temporal, arrow-function]
|
||||
---*/
|
||||
|
||||
const invalidStrings = [
|
||||
"-000000-10-31",
|
||||
"-000000-10-31T17:45",
|
||||
"-000000-10-31T17:45Z",
|
||||
"-000000-10-31T17:45+01:00",
|
||||
"-000000-10-31T17:45+00:00[UTC]",
|
||||
];
|
||||
const instance = new Temporal.Calendar("iso8601");
|
||||
invalidStrings.forEach((arg) => {
|
||||
assert.throws(
|
||||
RangeError,
|
||||
() => instance.day(arg),
|
||||
"reject minus zero as extended year"
|
||||
);
|
||||
});
|
|
@ -7,11 +7,17 @@ description: Negative zero, as an extended year, is rejected
|
|||
features: [Temporal, arrow-function]
|
||||
---*/
|
||||
|
||||
const arg = "-000000-10-31";
|
||||
const invalidStrings = [
|
||||
"-000000-10-31",
|
||||
"-000000-10-31T00:45",
|
||||
"-000000-10-31T00:45+01:00",
|
||||
"-000000-10-31T00:45+00:00[UTC]",
|
||||
];
|
||||
const instance = new Temporal.Calendar("iso8601");
|
||||
|
||||
assert.throws(
|
||||
invalidStrings.forEach((arg) => {
|
||||
assert.throws(
|
||||
RangeError,
|
||||
() => { instance.day(arg); },
|
||||
() => instance.day(arg),
|
||||
"reject minus zero as extended year"
|
||||
);
|
||||
);
|
||||
});
|
||||
|
|
24
test/built-ins/Temporal/Calendar/prototype/dayOfWeek/argument-propertybag-calendar-year-zero.js
vendored
Normal file
24
test/built-ins/Temporal/Calendar/prototype/dayOfWeek/argument-propertybag-calendar-year-zero.js
vendored
Normal file
|
@ -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.calendar.prototype.dayofweek
|
||||
description: Negative zero, as an extended year, is rejected
|
||||
features: [Temporal, arrow-function]
|
||||
---*/
|
||||
|
||||
const invalidStrings = [
|
||||
"-000000-10-31",
|
||||
"-000000-10-31T17:45",
|
||||
"-000000-10-31T17:45Z",
|
||||
"-000000-10-31T17:45+01:00",
|
||||
"-000000-10-31T17:45+00:00[UTC]",
|
||||
];
|
||||
const instance = new Temporal.Calendar("iso8601");
|
||||
invalidStrings.forEach((arg) => {
|
||||
assert.throws(
|
||||
RangeError,
|
||||
() => instance.dayOfWeek(arg),
|
||||
"reject minus zero as extended year"
|
||||
);
|
||||
});
|
|
@ -7,11 +7,17 @@ description: Negative zero, as an extended year, is rejected
|
|||
features: [Temporal, arrow-function]
|
||||
---*/
|
||||
|
||||
const arg = "-000000-10-31";
|
||||
const invalidStrings = [
|
||||
"-000000-10-31",
|
||||
"-000000-10-31T00:45",
|
||||
"-000000-10-31T00:45+01:00",
|
||||
"-000000-10-31T00:45+00:00[UTC]",
|
||||
];
|
||||
const instance = new Temporal.Calendar("iso8601");
|
||||
|
||||
assert.throws(
|
||||
invalidStrings.forEach((arg) => {
|
||||
assert.throws(
|
||||
RangeError,
|
||||
() => { instance.dayOfWeek(arg); },
|
||||
() => instance.dayOfWeek(arg),
|
||||
"reject minus zero as extended year"
|
||||
);
|
||||
);
|
||||
});
|
||||
|
|
24
test/built-ins/Temporal/Calendar/prototype/dayOfYear/argument-propertybag-calendar-year-zero.js
vendored
Normal file
24
test/built-ins/Temporal/Calendar/prototype/dayOfYear/argument-propertybag-calendar-year-zero.js
vendored
Normal file
|
@ -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.calendar.prototype.dayofyear
|
||||
description: Negative zero, as an extended year, is rejected
|
||||
features: [Temporal, arrow-function]
|
||||
---*/
|
||||
|
||||
const invalidStrings = [
|
||||
"-000000-10-31",
|
||||
"-000000-10-31T17:45",
|
||||
"-000000-10-31T17:45Z",
|
||||
"-000000-10-31T17:45+01:00",
|
||||
"-000000-10-31T17:45+00:00[UTC]",
|
||||
];
|
||||
const instance = new Temporal.Calendar("iso8601");
|
||||
invalidStrings.forEach((arg) => {
|
||||
assert.throws(
|
||||
RangeError,
|
||||
() => instance.dayOfYear(arg),
|
||||
"reject minus zero as extended year"
|
||||
);
|
||||
});
|
|
@ -7,11 +7,17 @@ description: Negative zero, as an extended year, is rejected
|
|||
features: [Temporal, arrow-function]
|
||||
---*/
|
||||
|
||||
const arg = "-000000-10-31";
|
||||
const invalidStrings = [
|
||||
"-000000-10-31",
|
||||
"-000000-10-31T00:45",
|
||||
"-000000-10-31T00:45+01:00",
|
||||
"-000000-10-31T00:45+00:00[UTC]",
|
||||
];
|
||||
const instance = new Temporal.Calendar("iso8601");
|
||||
|
||||
assert.throws(
|
||||
invalidStrings.forEach((arg) => {
|
||||
assert.throws(
|
||||
RangeError,
|
||||
() => { instance.dayOfYear(arg); },
|
||||
() => instance.dayOfYear(arg),
|
||||
"reject minus zero as extended year"
|
||||
);
|
||||
);
|
||||
});
|
||||
|
|
|
@ -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.calendar.prototype.daysinmonth
|
||||
description: Negative zero, as an extended year, is rejected
|
||||
features: [Temporal, arrow-function]
|
||||
---*/
|
||||
|
||||
const invalidStrings = [
|
||||
"-000000-10-31",
|
||||
"-000000-10-31T17:45",
|
||||
"-000000-10-31T17:45Z",
|
||||
"-000000-10-31T17:45+01:00",
|
||||
"-000000-10-31T17:45+00:00[UTC]",
|
||||
];
|
||||
const instance = new Temporal.Calendar("iso8601");
|
||||
invalidStrings.forEach((arg) => {
|
||||
assert.throws(
|
||||
RangeError,
|
||||
() => instance.daysInMonth(arg),
|
||||
"reject minus zero as extended year"
|
||||
);
|
||||
});
|
|
@ -7,11 +7,17 @@ description: Negative zero, as an extended year, is rejected
|
|||
features: [Temporal, arrow-function]
|
||||
---*/
|
||||
|
||||
const arg = "-000000-10-31";
|
||||
const invalidStrings = [
|
||||
"-000000-10-31",
|
||||
"-000000-10-31T00:45",
|
||||
"-000000-10-31T00:45+01:00",
|
||||
"-000000-10-31T00:45+00:00[UTC]",
|
||||
];
|
||||
const instance = new Temporal.Calendar("iso8601");
|
||||
|
||||
assert.throws(
|
||||
invalidStrings.forEach((arg) => {
|
||||
assert.throws(
|
||||
RangeError,
|
||||
() => { instance.daysInMonth(arg); },
|
||||
() => instance.daysInMonth(arg),
|
||||
"reject minus zero as extended year"
|
||||
);
|
||||
);
|
||||
});
|
||||
|
|
24
test/built-ins/Temporal/Calendar/prototype/daysInWeek/argument-propertybag-calendar-year-zero.js
vendored
Normal file
24
test/built-ins/Temporal/Calendar/prototype/daysInWeek/argument-propertybag-calendar-year-zero.js
vendored
Normal file
|
@ -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.calendar.prototype.daysinweek
|
||||
description: Negative zero, as an extended year, is rejected
|
||||
features: [Temporal, arrow-function]
|
||||
---*/
|
||||
|
||||
const invalidStrings = [
|
||||
"-000000-10-31",
|
||||
"-000000-10-31T17:45",
|
||||
"-000000-10-31T17:45Z",
|
||||
"-000000-10-31T17:45+01:00",
|
||||
"-000000-10-31T17:45+00:00[UTC]",
|
||||
];
|
||||
const instance = new Temporal.Calendar("iso8601");
|
||||
invalidStrings.forEach((arg) => {
|
||||
assert.throws(
|
||||
RangeError,
|
||||
() => instance.daysInWeek(arg),
|
||||
"reject minus zero as extended year"
|
||||
);
|
||||
});
|
|
@ -7,11 +7,17 @@ description: Negative zero, as an extended year, is rejected
|
|||
features: [Temporal, arrow-function]
|
||||
---*/
|
||||
|
||||
const arg = "-000000-10-31";
|
||||
const invalidStrings = [
|
||||
"-000000-10-31",
|
||||
"-000000-10-31T00:45",
|
||||
"-000000-10-31T00:45+01:00",
|
||||
"-000000-10-31T00:45+00:00[UTC]",
|
||||
];
|
||||
const instance = new Temporal.Calendar("iso8601");
|
||||
|
||||
assert.throws(
|
||||
invalidStrings.forEach((arg) => {
|
||||
assert.throws(
|
||||
RangeError,
|
||||
() => { instance.daysInWeek(arg); },
|
||||
() => instance.daysInWeek(arg),
|
||||
"reject minus zero as extended year"
|
||||
);
|
||||
);
|
||||
});
|
||||
|
|
24
test/built-ins/Temporal/Calendar/prototype/daysInYear/argument-propertybag-calendar-year-zero.js
vendored
Normal file
24
test/built-ins/Temporal/Calendar/prototype/daysInYear/argument-propertybag-calendar-year-zero.js
vendored
Normal file
|
@ -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.calendar.prototype.daysinyear
|
||||
description: Negative zero, as an extended year, is rejected
|
||||
features: [Temporal, arrow-function]
|
||||
---*/
|
||||
|
||||
const invalidStrings = [
|
||||
"-000000-10-31",
|
||||
"-000000-10-31T17:45",
|
||||
"-000000-10-31T17:45Z",
|
||||
"-000000-10-31T17:45+01:00",
|
||||
"-000000-10-31T17:45+00:00[UTC]",
|
||||
];
|
||||
const instance = new Temporal.Calendar("iso8601");
|
||||
invalidStrings.forEach((arg) => {
|
||||
assert.throws(
|
||||
RangeError,
|
||||
() => instance.daysInYear(arg),
|
||||
"reject minus zero as extended year"
|
||||
);
|
||||
});
|
|
@ -7,11 +7,17 @@ description: Negative zero, as an extended year, is rejected
|
|||
features: [Temporal, arrow-function]
|
||||
---*/
|
||||
|
||||
const arg = "-000000-10-31";
|
||||
const invalidStrings = [
|
||||
"-000000-10-31",
|
||||
"-000000-10-31T00:45",
|
||||
"-000000-10-31T00:45+01:00",
|
||||
"-000000-10-31T00:45+00:00[UTC]",
|
||||
];
|
||||
const instance = new Temporal.Calendar("iso8601");
|
||||
|
||||
assert.throws(
|
||||
invalidStrings.forEach((arg) => {
|
||||
assert.throws(
|
||||
RangeError,
|
||||
() => { instance.daysInYear(arg); },
|
||||
() => instance.daysInYear(arg),
|
||||
"reject minus zero as extended year"
|
||||
);
|
||||
);
|
||||
});
|
||||
|
|
24
test/built-ins/Temporal/Calendar/prototype/inLeapYear/argument-propertybag-calendar-year-zero.js
vendored
Normal file
24
test/built-ins/Temporal/Calendar/prototype/inLeapYear/argument-propertybag-calendar-year-zero.js
vendored
Normal file
|
@ -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.calendar.prototype.inleapyear
|
||||
description: Negative zero, as an extended year, is rejected
|
||||
features: [Temporal, arrow-function]
|
||||
---*/
|
||||
|
||||
const invalidStrings = [
|
||||
"-000000-10-31",
|
||||
"-000000-10-31T17:45",
|
||||
"-000000-10-31T17:45Z",
|
||||
"-000000-10-31T17:45+01:00",
|
||||
"-000000-10-31T17:45+00:00[UTC]",
|
||||
];
|
||||
const instance = new Temporal.Calendar("iso8601");
|
||||
invalidStrings.forEach((arg) => {
|
||||
assert.throws(
|
||||
RangeError,
|
||||
() => instance.inLeapYear(arg),
|
||||
"reject minus zero as extended year"
|
||||
);
|
||||
});
|
|
@ -7,11 +7,17 @@ description: Negative zero, as an extended year, is rejected
|
|||
features: [Temporal, arrow-function]
|
||||
---*/
|
||||
|
||||
const arg = "-000000-10-31";
|
||||
const invalidStrings = [
|
||||
"-000000-10-31",
|
||||
"-000000-10-31T00:45",
|
||||
"-000000-10-31T00:45+01:00",
|
||||
"-000000-10-31T00:45+00:00[UTC]",
|
||||
];
|
||||
const instance = new Temporal.Calendar("iso8601");
|
||||
|
||||
assert.throws(
|
||||
invalidStrings.forEach((arg) => {
|
||||
assert.throws(
|
||||
RangeError,
|
||||
() => { instance.inLeapYear(arg); },
|
||||
() => instance.inLeapYear(arg),
|
||||
"reject minus zero as extended year"
|
||||
);
|
||||
);
|
||||
});
|
||||
|
|
24
test/built-ins/Temporal/Calendar/prototype/month/argument-propertybag-calendar-year-zero.js
vendored
Normal file
24
test/built-ins/Temporal/Calendar/prototype/month/argument-propertybag-calendar-year-zero.js
vendored
Normal file
|
@ -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.calendar.prototype.month
|
||||
description: Negative zero, as an extended year, is rejected
|
||||
features: [Temporal, arrow-function]
|
||||
---*/
|
||||
|
||||
const invalidStrings = [
|
||||
"-000000-10-31",
|
||||
"-000000-10-31T17:45",
|
||||
"-000000-10-31T17:45Z",
|
||||
"-000000-10-31T17:45+01:00",
|
||||
"-000000-10-31T17:45+00:00[UTC]",
|
||||
];
|
||||
const instance = new Temporal.Calendar("iso8601");
|
||||
invalidStrings.forEach((arg) => {
|
||||
assert.throws(
|
||||
RangeError,
|
||||
() => instance.month(arg),
|
||||
"reject minus zero as extended year"
|
||||
);
|
||||
});
|
|
@ -7,11 +7,17 @@ description: Negative zero, as an extended year, is rejected
|
|||
features: [Temporal, arrow-function]
|
||||
---*/
|
||||
|
||||
const arg = "-000000-10-31";
|
||||
const invalidStrings = [
|
||||
"-000000-10-31",
|
||||
"-000000-10-31T00:45",
|
||||
"-000000-10-31T00:45+01:00",
|
||||
"-000000-10-31T00:45+00:00[UTC]",
|
||||
];
|
||||
const instance = new Temporal.Calendar("iso8601");
|
||||
|
||||
assert.throws(
|
||||
invalidStrings.forEach((arg) => {
|
||||
assert.throws(
|
||||
RangeError,
|
||||
() => { instance.month(arg); },
|
||||
() => instance.month(arg),
|
||||
"reject minus zero as extended year"
|
||||
);
|
||||
);
|
||||
});
|
||||
|
|
24
test/built-ins/Temporal/Calendar/prototype/monthCode/argument-propertybag-calendar-year-zero.js
vendored
Normal file
24
test/built-ins/Temporal/Calendar/prototype/monthCode/argument-propertybag-calendar-year-zero.js
vendored
Normal file
|
@ -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.calendar.prototype.monthcode
|
||||
description: Negative zero, as an extended year, is rejected
|
||||
features: [Temporal, arrow-function]
|
||||
---*/
|
||||
|
||||
const invalidStrings = [
|
||||
"-000000-10-31",
|
||||
"-000000-10-31T17:45",
|
||||
"-000000-10-31T17:45Z",
|
||||
"-000000-10-31T17:45+01:00",
|
||||
"-000000-10-31T17:45+00:00[UTC]",
|
||||
];
|
||||
const instance = new Temporal.Calendar("iso8601");
|
||||
invalidStrings.forEach((arg) => {
|
||||
assert.throws(
|
||||
RangeError,
|
||||
() => instance.monthCode(arg),
|
||||
"reject minus zero as extended year"
|
||||
);
|
||||
});
|
|
@ -7,11 +7,17 @@ description: Negative zero, as an extended year, is rejected
|
|||
features: [Temporal, arrow-function]
|
||||
---*/
|
||||
|
||||
const arg = "-000000-10-31";
|
||||
const invalidStrings = [
|
||||
"-000000-10-31",
|
||||
"-000000-10-31T00:45",
|
||||
"-000000-10-31T00:45+01:00",
|
||||
"-000000-10-31T00:45+00:00[UTC]",
|
||||
];
|
||||
const instance = new Temporal.Calendar("iso8601");
|
||||
|
||||
assert.throws(
|
||||
invalidStrings.forEach((arg) => {
|
||||
assert.throws(
|
||||
RangeError,
|
||||
() => { instance.monthCode(arg); },
|
||||
() => instance.monthCode(arg),
|
||||
"reject minus zero as extended year"
|
||||
);
|
||||
);
|
||||
});
|
||||
|
|
|
@ -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.calendar.prototype.monthsinyear
|
||||
description: Negative zero, as an extended year, is rejected
|
||||
features: [Temporal, arrow-function]
|
||||
---*/
|
||||
|
||||
const invalidStrings = [
|
||||
"-000000-10-31",
|
||||
"-000000-10-31T17:45",
|
||||
"-000000-10-31T17:45Z",
|
||||
"-000000-10-31T17:45+01:00",
|
||||
"-000000-10-31T17:45+00:00[UTC]",
|
||||
];
|
||||
const instance = new Temporal.Calendar("iso8601");
|
||||
invalidStrings.forEach((arg) => {
|
||||
assert.throws(
|
||||
RangeError,
|
||||
() => instance.monthsInYear(arg),
|
||||
"reject minus zero as extended year"
|
||||
);
|
||||
});
|
|
@ -7,11 +7,17 @@ description: Negative zero, as an extended year, is rejected
|
|||
features: [Temporal, arrow-function]
|
||||
---*/
|
||||
|
||||
const arg = "-000000-10-31";
|
||||
const invalidStrings = [
|
||||
"-000000-10-31",
|
||||
"-000000-10-31T00:45",
|
||||
"-000000-10-31T00:45+01:00",
|
||||
"-000000-10-31T00:45+00:00[UTC]",
|
||||
];
|
||||
const instance = new Temporal.Calendar("iso8601");
|
||||
|
||||
assert.throws(
|
||||
invalidStrings.forEach((arg) => {
|
||||
assert.throws(
|
||||
RangeError,
|
||||
() => { instance.monthsInYear(arg); },
|
||||
() => instance.monthsInYear(arg),
|
||||
"reject minus zero as extended year"
|
||||
);
|
||||
);
|
||||
});
|
||||
|
|
24
test/built-ins/Temporal/Calendar/prototype/weekOfYear/argument-propertybag-calendar-year-zero.js
vendored
Normal file
24
test/built-ins/Temporal/Calendar/prototype/weekOfYear/argument-propertybag-calendar-year-zero.js
vendored
Normal file
|
@ -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.calendar.prototype.weekofyear
|
||||
description: Negative zero, as an extended year, is rejected
|
||||
features: [Temporal, arrow-function]
|
||||
---*/
|
||||
|
||||
const invalidStrings = [
|
||||
"-000000-10-31",
|
||||
"-000000-10-31T17:45",
|
||||
"-000000-10-31T17:45Z",
|
||||
"-000000-10-31T17:45+01:00",
|
||||
"-000000-10-31T17:45+00:00[UTC]",
|
||||
];
|
||||
const instance = new Temporal.Calendar("iso8601");
|
||||
invalidStrings.forEach((arg) => {
|
||||
assert.throws(
|
||||
RangeError,
|
||||
() => instance.weekOfYear(arg),
|
||||
"reject minus zero as extended year"
|
||||
);
|
||||
});
|
|
@ -7,11 +7,17 @@ description: Negative zero, as an extended year, is rejected
|
|||
features: [Temporal, arrow-function]
|
||||
---*/
|
||||
|
||||
const arg = "-000000-10-31";
|
||||
const invalidStrings = [
|
||||
"-000000-10-31",
|
||||
"-000000-10-31T00:45",
|
||||
"-000000-10-31T00:45+01:00",
|
||||
"-000000-10-31T00:45+00:00[UTC]",
|
||||
];
|
||||
const instance = new Temporal.Calendar("iso8601");
|
||||
|
||||
assert.throws(
|
||||
invalidStrings.forEach((arg) => {
|
||||
assert.throws(
|
||||
RangeError,
|
||||
() => { instance.weekOfYear(arg); },
|
||||
() => instance.weekOfYear(arg),
|
||||
"reject minus zero as extended year"
|
||||
);
|
||||
);
|
||||
});
|
||||
|
|
24
test/built-ins/Temporal/Calendar/prototype/year/argument-propertybag-calendar-year-zero.js
vendored
Normal file
24
test/built-ins/Temporal/Calendar/prototype/year/argument-propertybag-calendar-year-zero.js
vendored
Normal file
|
@ -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.calendar.prototype.year
|
||||
description: Negative zero, as an extended year, is rejected
|
||||
features: [Temporal, arrow-function]
|
||||
---*/
|
||||
|
||||
const invalidStrings = [
|
||||
"-000000-10-31",
|
||||
"-000000-10-31T17:45",
|
||||
"-000000-10-31T17:45Z",
|
||||
"-000000-10-31T17:45+01:00",
|
||||
"-000000-10-31T17:45+00:00[UTC]",
|
||||
];
|
||||
const instance = new Temporal.Calendar("iso8601");
|
||||
invalidStrings.forEach((arg) => {
|
||||
assert.throws(
|
||||
RangeError,
|
||||
() => instance.year(arg),
|
||||
"reject minus zero as extended year"
|
||||
);
|
||||
});
|
|
@ -7,11 +7,17 @@ description: Negative zero, as an extended year, is rejected
|
|||
features: [Temporal, arrow-function]
|
||||
---*/
|
||||
|
||||
const arg = "-000000-10-31";
|
||||
const invalidStrings = [
|
||||
"-000000-10-31",
|
||||
"-000000-10-31T00:45",
|
||||
"-000000-10-31T00:45+01:00",
|
||||
"-000000-10-31T00:45+00:00[UTC]",
|
||||
];
|
||||
const instance = new Temporal.Calendar("iso8601");
|
||||
|
||||
assert.throws(
|
||||
invalidStrings.forEach((arg) => {
|
||||
assert.throws(
|
||||
RangeError,
|
||||
() => { instance.year(arg); },
|
||||
() => instance.year(arg),
|
||||
"reject minus zero as extended year"
|
||||
);
|
||||
);
|
||||
});
|
||||
|
|
|
@ -0,0 +1,25 @@
|
|||
// 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.duration.compare
|
||||
description: Negative zero, as an extended year, is rejected
|
||||
features: [Temporal, arrow-function]
|
||||
---*/
|
||||
|
||||
const invalidStrings = [
|
||||
"-000000-10-31T17:45Z",
|
||||
"-000000-10-31T17:45+00:00[UTC]",
|
||||
];
|
||||
invalidStrings.forEach((timeZone) => {
|
||||
assert.throws(
|
||||
RangeError,
|
||||
() => Temporal.Duration.compare(new Temporal.Duration(), new Temporal.Duration(), { relativeTo: { year: 2000, month: 5, day: 2, timeZone } }),
|
||||
"reject minus zero as extended year"
|
||||
);
|
||||
assert.throws(
|
||||
RangeError,
|
||||
() => Temporal.Duration.compare(new Temporal.Duration(), new Temporal.Duration(), { relativeTo: { year: 2000, month: 5, day: 2, timeZone: { timeZone } } }),
|
||||
"reject minus zero as extended year (nested property)"
|
||||
);
|
||||
});
|
|
@ -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.duration.prototype.add
|
||||
description: Negative zero, as an extended year, is rejected
|
||||
features: [Temporal, arrow-function]
|
||||
---*/
|
||||
|
||||
const invalidStrings = [
|
||||
"-000000-10-31T17:45Z",
|
||||
"-000000-10-31T17:45+00:00[UTC]",
|
||||
];
|
||||
const instance = new Temporal.Duration(1);
|
||||
invalidStrings.forEach((timeZone) => {
|
||||
assert.throws(
|
||||
RangeError,
|
||||
() => instance.add(new Temporal.Duration(1), { relativeTo: { year: 2000, month: 5, day: 2, timeZone } }),
|
||||
"reject minus zero as extended year"
|
||||
);
|
||||
assert.throws(
|
||||
RangeError,
|
||||
() => instance.add(new Temporal.Duration(1), { relativeTo: { year: 2000, month: 5, day: 2, timeZone: { timeZone } } }),
|
||||
"reject minus zero as extended year (nested property)"
|
||||
);
|
||||
});
|
26
test/built-ins/Temporal/Duration/prototype/round/timezone-string-year-zero.js
vendored
Normal file
26
test/built-ins/Temporal/Duration/prototype/round/timezone-string-year-zero.js
vendored
Normal file
|
@ -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.duration.prototype.round
|
||||
description: Negative zero, as an extended year, is rejected
|
||||
features: [Temporal, arrow-function]
|
||||
---*/
|
||||
|
||||
const invalidStrings = [
|
||||
"-000000-10-31T17:45Z",
|
||||
"-000000-10-31T17:45+00:00[UTC]",
|
||||
];
|
||||
const instance = new Temporal.Duration(1);
|
||||
invalidStrings.forEach((timeZone) => {
|
||||
assert.throws(
|
||||
RangeError,
|
||||
() => instance.round({ largestUnit: "months", relativeTo: { year: 2000, month: 5, day: 2, timeZone } }),
|
||||
"reject minus zero as extended year"
|
||||
);
|
||||
assert.throws(
|
||||
RangeError,
|
||||
() => instance.round({ largestUnit: "months", relativeTo: { year: 2000, month: 5, day: 2, timeZone: { timeZone } } }),
|
||||
"reject minus zero as extended year (nested property)"
|
||||
);
|
||||
});
|
26
test/built-ins/Temporal/Duration/prototype/subtract/timezone-string-year-zero.js
vendored
Normal file
26
test/built-ins/Temporal/Duration/prototype/subtract/timezone-string-year-zero.js
vendored
Normal file
|
@ -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.duration.prototype.subtract
|
||||
description: Negative zero, as an extended year, is rejected
|
||||
features: [Temporal, arrow-function]
|
||||
---*/
|
||||
|
||||
const invalidStrings = [
|
||||
"-000000-10-31T17:45Z",
|
||||
"-000000-10-31T17:45+00:00[UTC]",
|
||||
];
|
||||
const instance = new Temporal.Duration(1);
|
||||
invalidStrings.forEach((timeZone) => {
|
||||
assert.throws(
|
||||
RangeError,
|
||||
() => instance.subtract(new Temporal.Duration(1), { relativeTo: { year: 2000, month: 5, day: 2, timeZone } }),
|
||||
"reject minus zero as extended year"
|
||||
);
|
||||
assert.throws(
|
||||
RangeError,
|
||||
() => instance.subtract(new Temporal.Duration(1), { relativeTo: { year: 2000, month: 5, day: 2, timeZone: { timeZone } } }),
|
||||
"reject minus zero as extended year (nested property)"
|
||||
);
|
||||
});
|
26
test/built-ins/Temporal/Duration/prototype/total/timezone-string-year-zero.js
vendored
Normal file
26
test/built-ins/Temporal/Duration/prototype/total/timezone-string-year-zero.js
vendored
Normal file
|
@ -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.duration.prototype.total
|
||||
description: Negative zero, as an extended year, is rejected
|
||||
features: [Temporal, arrow-function]
|
||||
---*/
|
||||
|
||||
const invalidStrings = [
|
||||
"-000000-10-31T17:45Z",
|
||||
"-000000-10-31T17:45+00:00[UTC]",
|
||||
];
|
||||
const instance = new Temporal.Duration(1);
|
||||
invalidStrings.forEach((timeZone) => {
|
||||
assert.throws(
|
||||
RangeError,
|
||||
() => instance.total({ unit: "months", relativeTo: { year: 2000, month: 5, day: 2, timeZone } }),
|
||||
"reject minus zero as extended year"
|
||||
);
|
||||
assert.throws(
|
||||
RangeError,
|
||||
() => instance.total({ unit: "months", relativeTo: { year: 2000, month: 5, day: 2, timeZone: { timeZone } } }),
|
||||
"reject minus zero as extended year (nested property)"
|
||||
);
|
||||
});
|
|
@ -8,12 +8,18 @@ features: [Temporal]
|
|||
---*/
|
||||
|
||||
const instance = new Temporal.Instant(0n);
|
||||
const bad = '-000000-03-30T00:45Z';
|
||||
const invalidStrings = [
|
||||
"-000000-03-30T00:45Z",
|
||||
"-000000-03-30T01:45+01:00",
|
||||
"-000000-03-30T01:45:00+00:00[UTC]",
|
||||
];
|
||||
|
||||
assert.throws(RangeError,
|
||||
() => Temporal.Instant.compare(bad, instance),
|
||||
"minus zero is invalid extended year (first argument)");
|
||||
assert.throws(RangeError,
|
||||
() => Temporal.Instant.compare(instance, bad),
|
||||
"minus zero is invalid extended year (second argument)"
|
||||
);
|
||||
invalidStrings.forEach((arg) => {
|
||||
assert.throws(RangeError,
|
||||
() => Temporal.Instant.compare(arg, instance),
|
||||
"minus zero is invalid extended year (first argument)");
|
||||
assert.throws(RangeError,
|
||||
() => Temporal.Instant.compare(instance, arg),
|
||||
"minus zero is invalid extended year (second argument)"
|
||||
);
|
||||
});
|
||||
|
|
|
@ -4,19 +4,19 @@
|
|||
/*---
|
||||
esid: sec-temporal.instant.from
|
||||
description: Negative zero, as an extended year, is rejected
|
||||
features: [Temporal]
|
||||
features: [Temporal, arrow-function]
|
||||
---*/
|
||||
|
||||
const invalidStrings = [
|
||||
"-000000-03-31T00:45Z",
|
||||
"-000000-03-31T01:45+01:00",
|
||||
"-000000-03-31T01:45:00+01:00[UTC]"
|
||||
"-000000-03-30T00:45Z",
|
||||
"-000000-03-30T01:45+01:00",
|
||||
"-000000-03-30T01:45:00+00:00[UTC]",
|
||||
];
|
||||
|
||||
invalidStrings.forEach((str) => {
|
||||
invalidStrings.forEach((arg) => {
|
||||
assert.throws(
|
||||
RangeError,
|
||||
() => Temporal.Instant.from(str),
|
||||
() => Temporal.Instant.from(arg),
|
||||
"reject minus zero as extended year"
|
||||
);
|
||||
});
|
||||
|
|
|
@ -4,19 +4,19 @@
|
|||
/*---
|
||||
esid: sec-temporal.instant.prototype.equals
|
||||
description: Negative zero, as an extended year, is rejected
|
||||
features: [Temporal]
|
||||
features: [Temporal, arrow-function]
|
||||
---*/
|
||||
|
||||
const invalidStrings = [
|
||||
"-000000-03-30T00:45Z",
|
||||
"-000000-03-30T01:45+01:00",
|
||||
"-000000-03-30T01:45:00+01:00[UTC]"
|
||||
"-000000-03-30T00:45Z",
|
||||
"-000000-03-30T01:45+01:00",
|
||||
"-000000-03-30T01:45:00+00:00[UTC]",
|
||||
];
|
||||
const instance = new Temporal.Instant(0n);
|
||||
invalidStrings.forEach((str) => {
|
||||
invalidStrings.forEach((arg) => {
|
||||
assert.throws(
|
||||
RangeError,
|
||||
() => instance.equals(str),
|
||||
() => instance.equals(arg),
|
||||
"reject minus zero as extended year"
|
||||
);
|
||||
});
|
||||
|
|
|
@ -4,19 +4,19 @@
|
|||
/*---
|
||||
esid: sec-temporal.instant.prototype.since
|
||||
description: Negative zero, as an extended year, is rejected
|
||||
features: [Temporal]
|
||||
features: [Temporal, arrow-function]
|
||||
---*/
|
||||
|
||||
const invalidStrings = [
|
||||
"-000000-03-30T00:45Z",
|
||||
"-000000-03-30T01:45+01:00",
|
||||
"-000000-03-30T01:45:00+01:00[UTC]"
|
||||
"-000000-03-30T00:45Z",
|
||||
"-000000-03-30T01:45+01:00",
|
||||
"-000000-03-30T01:45:00+00:00[UTC]",
|
||||
];
|
||||
const instance = new Temporal.Instant(0n);
|
||||
invalidStrings.forEach((str) => {
|
||||
invalidStrings.forEach((arg) => {
|
||||
assert.throws(
|
||||
RangeError,
|
||||
() => instance.since(str),
|
||||
() => instance.since(arg),
|
||||
"reject minus zero as extended year"
|
||||
);
|
||||
});
|
||||
|
|
26
test/built-ins/Temporal/Instant/prototype/toString/timezone-string-year-zero.js
vendored
Normal file
26
test/built-ins/Temporal/Instant/prototype/toString/timezone-string-year-zero.js
vendored
Normal file
|
@ -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.instant.prototype.tostring
|
||||
description: Negative zero, as an extended year, is rejected
|
||||
features: [Temporal, arrow-function]
|
||||
---*/
|
||||
|
||||
const invalidStrings = [
|
||||
"-000000-10-31T17:45Z",
|
||||
"-000000-10-31T17:45+00:00[UTC]",
|
||||
];
|
||||
const instance = new Temporal.Instant(0n);
|
||||
invalidStrings.forEach((timeZone) => {
|
||||
assert.throws(
|
||||
RangeError,
|
||||
() => instance.toString({ timeZone }),
|
||||
"reject minus zero as extended year"
|
||||
);
|
||||
assert.throws(
|
||||
RangeError,
|
||||
() => instance.toString({ timeZone: { timeZone } }),
|
||||
"reject minus zero as extended year (nested property)"
|
||||
);
|
||||
});
|
26
test/built-ins/Temporal/Instant/prototype/toZonedDateTime/timezone-string-year-zero.js
vendored
Normal file
26
test/built-ins/Temporal/Instant/prototype/toZonedDateTime/timezone-string-year-zero.js
vendored
Normal file
|
@ -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.instant.prototype.tozoneddatetime
|
||||
description: Negative zero, as an extended year, is rejected
|
||||
features: [Temporal, arrow-function]
|
||||
---*/
|
||||
|
||||
const invalidStrings = [
|
||||
"-000000-10-31T17:45Z",
|
||||
"-000000-10-31T17:45+00:00[UTC]",
|
||||
];
|
||||
const instance = new Temporal.Instant(0n);
|
||||
invalidStrings.forEach((timeZone) => {
|
||||
assert.throws(
|
||||
RangeError,
|
||||
() => instance.toZonedDateTime({ timeZone, calendar: "iso8601" }),
|
||||
"reject minus zero as extended year"
|
||||
);
|
||||
assert.throws(
|
||||
RangeError,
|
||||
() => instance.toZonedDateTime({ timeZone: { timeZone }, calendar: "iso8601" }),
|
||||
"reject minus zero as extended year (nested property)"
|
||||
);
|
||||
});
|
26
test/built-ins/Temporal/Instant/prototype/toZonedDateTimeISO/timezone-string-year-zero.js
vendored
Normal file
26
test/built-ins/Temporal/Instant/prototype/toZonedDateTimeISO/timezone-string-year-zero.js
vendored
Normal file
|
@ -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.instant.prototype.tozoneddatetimeiso
|
||||
description: Negative zero, as an extended year, is rejected
|
||||
features: [Temporal, arrow-function]
|
||||
---*/
|
||||
|
||||
const invalidStrings = [
|
||||
"-000000-10-31T17:45Z",
|
||||
"-000000-10-31T17:45+00:00[UTC]",
|
||||
];
|
||||
const instance = new Temporal.Instant(0n);
|
||||
invalidStrings.forEach((timeZone) => {
|
||||
assert.throws(
|
||||
RangeError,
|
||||
() => instance.toZonedDateTimeISO(timeZone),
|
||||
"reject minus zero as extended year"
|
||||
);
|
||||
assert.throws(
|
||||
RangeError,
|
||||
() => instance.toZonedDateTimeISO({ timeZone }),
|
||||
"reject minus zero as extended year (nested property)"
|
||||
);
|
||||
});
|
|
@ -4,19 +4,19 @@
|
|||
/*---
|
||||
esid: sec-temporal.instant.prototype.until
|
||||
description: Negative zero, as an extended year, is rejected
|
||||
features: [Temporal]
|
||||
features: [Temporal, arrow-function]
|
||||
---*/
|
||||
|
||||
const invalidStrings = [
|
||||
"-000000-03-30T00:45Z",
|
||||
"-000000-03-30T01:45+01:00",
|
||||
"-000000-03-30T01:45:00+01:00[UTC]"
|
||||
"-000000-03-30T00:45Z",
|
||||
"-000000-03-30T01:45+01:00",
|
||||
"-000000-03-30T01:45:00+00:00[UTC]",
|
||||
];
|
||||
const instance = new Temporal.Instant(0n);
|
||||
invalidStrings.forEach((str) => {
|
||||
invalidStrings.forEach((arg) => {
|
||||
assert.throws(
|
||||
RangeError,
|
||||
() => instance.until(str),
|
||||
() => instance.until(arg),
|
||||
"reject minus zero as extended year"
|
||||
);
|
||||
});
|
||||
|
|
|
@ -0,0 +1,25 @@
|
|||
// 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.now.plaindate
|
||||
description: Negative zero, as an extended year, is rejected
|
||||
features: [Temporal, arrow-function]
|
||||
---*/
|
||||
|
||||
const invalidStrings = [
|
||||
"-000000-10-31T17:45Z",
|
||||
"-000000-10-31T17:45+00:00[UTC]",
|
||||
];
|
||||
invalidStrings.forEach((timeZone) => {
|
||||
assert.throws(
|
||||
RangeError,
|
||||
() => Temporal.Now.plainDate("iso8601", timeZone),
|
||||
"reject minus zero as extended year"
|
||||
);
|
||||
assert.throws(
|
||||
RangeError,
|
||||
() => Temporal.Now.plainDate("iso8601", { timeZone }),
|
||||
"reject minus zero as extended year (nested property)"
|
||||
);
|
||||
});
|
|
@ -0,0 +1,25 @@
|
|||
// 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.now.plaindateiso
|
||||
description: Negative zero, as an extended year, is rejected
|
||||
features: [Temporal, arrow-function]
|
||||
---*/
|
||||
|
||||
const invalidStrings = [
|
||||
"-000000-10-31T17:45Z",
|
||||
"-000000-10-31T17:45+00:00[UTC]",
|
||||
];
|
||||
invalidStrings.forEach((timeZone) => {
|
||||
assert.throws(
|
||||
RangeError,
|
||||
() => Temporal.Now.plainDateISO(timeZone),
|
||||
"reject minus zero as extended year"
|
||||
);
|
||||
assert.throws(
|
||||
RangeError,
|
||||
() => Temporal.Now.plainDateISO({ timeZone }),
|
||||
"reject minus zero as extended year (nested property)"
|
||||
);
|
||||
});
|
|
@ -0,0 +1,25 @@
|
|||
// 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.now.plaindatetime
|
||||
description: Negative zero, as an extended year, is rejected
|
||||
features: [Temporal, arrow-function]
|
||||
---*/
|
||||
|
||||
const invalidStrings = [
|
||||
"-000000-10-31T17:45Z",
|
||||
"-000000-10-31T17:45+00:00[UTC]",
|
||||
];
|
||||
invalidStrings.forEach((timeZone) => {
|
||||
assert.throws(
|
||||
RangeError,
|
||||
() => Temporal.Now.plainDateTime("iso8601", timeZone),
|
||||
"reject minus zero as extended year"
|
||||
);
|
||||
assert.throws(
|
||||
RangeError,
|
||||
() => Temporal.Now.plainDateTime("iso8601", { timeZone }),
|
||||
"reject minus zero as extended year (nested property)"
|
||||
);
|
||||
});
|
|
@ -0,0 +1,25 @@
|
|||
// 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.now.plaindatetimeiso
|
||||
description: Negative zero, as an extended year, is rejected
|
||||
features: [Temporal, arrow-function]
|
||||
---*/
|
||||
|
||||
const invalidStrings = [
|
||||
"-000000-10-31T17:45Z",
|
||||
"-000000-10-31T17:45+00:00[UTC]",
|
||||
];
|
||||
invalidStrings.forEach((timeZone) => {
|
||||
assert.throws(
|
||||
RangeError,
|
||||
() => Temporal.Now.plainDateTimeISO(timeZone),
|
||||
"reject minus zero as extended year"
|
||||
);
|
||||
assert.throws(
|
||||
RangeError,
|
||||
() => Temporal.Now.plainDateTimeISO({ timeZone }),
|
||||
"reject minus zero as extended year (nested property)"
|
||||
);
|
||||
});
|
|
@ -0,0 +1,25 @@
|
|||
// 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.now.plaintimeiso
|
||||
description: Negative zero, as an extended year, is rejected
|
||||
features: [Temporal, arrow-function]
|
||||
---*/
|
||||
|
||||
const invalidStrings = [
|
||||
"-000000-10-31T17:45Z",
|
||||
"-000000-10-31T17:45+00:00[UTC]",
|
||||
];
|
||||
invalidStrings.forEach((timeZone) => {
|
||||
assert.throws(
|
||||
RangeError,
|
||||
() => Temporal.Now.plainTimeISO(timeZone),
|
||||
"reject minus zero as extended year"
|
||||
);
|
||||
assert.throws(
|
||||
RangeError,
|
||||
() => Temporal.Now.plainTimeISO({ timeZone }),
|
||||
"reject minus zero as extended year (nested property)"
|
||||
);
|
||||
});
|
|
@ -0,0 +1,25 @@
|
|||
// 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.now.zoneddatetime
|
||||
description: Negative zero, as an extended year, is rejected
|
||||
features: [Temporal, arrow-function]
|
||||
---*/
|
||||
|
||||
const invalidStrings = [
|
||||
"-000000-10-31T17:45Z",
|
||||
"-000000-10-31T17:45+00:00[UTC]",
|
||||
];
|
||||
invalidStrings.forEach((timeZone) => {
|
||||
assert.throws(
|
||||
RangeError,
|
||||
() => Temporal.Now.zonedDateTime("iso8601", timeZone),
|
||||
"reject minus zero as extended year"
|
||||
);
|
||||
assert.throws(
|
||||
RangeError,
|
||||
() => Temporal.Now.zonedDateTime("iso8601", { timeZone }),
|
||||
"reject minus zero as extended year (nested property)"
|
||||
);
|
||||
});
|
|
@ -0,0 +1,25 @@
|
|||
// 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.now.zoneddatetimeiso
|
||||
description: Negative zero, as an extended year, is rejected
|
||||
features: [Temporal, arrow-function]
|
||||
---*/
|
||||
|
||||
const invalidStrings = [
|
||||
"-000000-10-31T17:45Z",
|
||||
"-000000-10-31T17:45+00:00[UTC]",
|
||||
];
|
||||
invalidStrings.forEach((timeZone) => {
|
||||
assert.throws(
|
||||
RangeError,
|
||||
() => Temporal.Now.zonedDateTimeISO(timeZone),
|
||||
"reject minus zero as extended year"
|
||||
);
|
||||
assert.throws(
|
||||
RangeError,
|
||||
() => Temporal.Now.zonedDateTimeISO({ timeZone }),
|
||||
"reject minus zero as extended year (nested property)"
|
||||
);
|
||||
});
|
|
@ -0,0 +1,29 @@
|
|||
// 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.compare
|
||||
description: Negative zero, as an extended year, is rejected
|
||||
features: [Temporal, arrow-function]
|
||||
---*/
|
||||
|
||||
const invalidStrings = [
|
||||
"-000000-10-31",
|
||||
"-000000-10-31T17:45",
|
||||
"-000000-10-31T17:45Z",
|
||||
"-000000-10-31T17:45+01:00",
|
||||
"-000000-10-31T17:45+00:00[UTC]",
|
||||
];
|
||||
|
||||
invalidStrings.forEach((arg) => {
|
||||
assert.throws(
|
||||
RangeError,
|
||||
() => Temporal.PlainDate.compare(arg, new Temporal.PlainDate(1976, 11, 18)),
|
||||
"reject minus zero as extended year (first argument)"
|
||||
);
|
||||
assert.throws(
|
||||
RangeError,
|
||||
() => Temporal.PlainDate.compare(new Temporal.PlainDate(1976, 11, 18), arg),
|
||||
"reject minus zero as extended year (second argument)"
|
||||
);
|
||||
});
|
|
@ -8,14 +8,21 @@ features: [Temporal]
|
|||
---*/
|
||||
|
||||
const instance = new Temporal.PlainDate(2000, 5, 2);
|
||||
const bad = "-000000-08-24";
|
||||
const invalidStrings = [
|
||||
"-000000-10-31",
|
||||
"-000000-10-31T00:45",
|
||||
"-000000-10-31T00:45+01:00",
|
||||
"-000000-10-31T00:45+00:00[UTC]",
|
||||
];
|
||||
|
||||
assert.throws(RangeError,
|
||||
() => Temporal.PlainDate.compare(bad, instance),
|
||||
"Minus zero is an invalid extended year (first argument)"
|
||||
);
|
||||
invalidStrings.forEach((arg) => {
|
||||
assert.throws(RangeError,
|
||||
() => Temporal.PlainDate.compare(arg, instance),
|
||||
"Minus zero is an invalid extended year (first argument)"
|
||||
);
|
||||
|
||||
assert.throws(RangeError,
|
||||
() => Temporal.PlainDate.compare(instance, bad),
|
||||
"Minus zero is an invalid extended year (second argument)"
|
||||
);
|
||||
assert.throws(RangeError,
|
||||
() => Temporal.PlainDate.compare(instance, arg),
|
||||
"Minus zero is an invalid extended year (second argument)"
|
||||
);
|
||||
});
|
||||
|
|
|
@ -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.plaindate.from
|
||||
description: Negative zero, as an extended year, is rejected
|
||||
features: [Temporal, arrow-function]
|
||||
---*/
|
||||
|
||||
const invalidStrings = [
|
||||
"-000000-10-31",
|
||||
"-000000-10-31T17:45",
|
||||
"-000000-10-31T17:45Z",
|
||||
"-000000-10-31T17:45+01:00",
|
||||
"-000000-10-31T17:45+00:00[UTC]",
|
||||
];
|
||||
|
||||
invalidStrings.forEach((arg) => {
|
||||
assert.throws(
|
||||
RangeError,
|
||||
() => Temporal.PlainDate.from(arg),
|
||||
"reject minus zero as extended year"
|
||||
);
|
||||
});
|
|
@ -4,14 +4,20 @@
|
|||
/*---
|
||||
esid: sec-temporal.plaindate.from
|
||||
description: Negative zero, as an extended year, is rejected
|
||||
features: [Temporal]
|
||||
features: [Temporal, arrow-function]
|
||||
---*/
|
||||
|
||||
const arg = "-000000-10-31";
|
||||
const invalidStrings = [
|
||||
"-000000-10-31",
|
||||
"-000000-10-31T00:45",
|
||||
"-000000-10-31T00:45+01:00",
|
||||
"-000000-10-31T00:45+00:00[UTC]",
|
||||
];
|
||||
|
||||
assert.throws(
|
||||
invalidStrings.forEach((arg) => {
|
||||
assert.throws(
|
||||
RangeError,
|
||||
() => { Temporal.PlainDate.from(arg); },
|
||||
() => Temporal.PlainDate.from(arg),
|
||||
"reject minus zero as extended year"
|
||||
);
|
||||
|
||||
);
|
||||
});
|
||||
|
|
24
test/built-ins/Temporal/PlainDate/prototype/equals/argument-propertybag-calendar-year-zero.js
vendored
Normal file
24
test/built-ins/Temporal/PlainDate/prototype/equals/argument-propertybag-calendar-year-zero.js
vendored
Normal file
|
@ -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.plaindate.prototype.equals
|
||||
description: Negative zero, as an extended year, is rejected
|
||||
features: [Temporal, arrow-function]
|
||||
---*/
|
||||
|
||||
const invalidStrings = [
|
||||
"-000000-10-31",
|
||||
"-000000-10-31T17:45",
|
||||
"-000000-10-31T17:45Z",
|
||||
"-000000-10-31T17:45+01:00",
|
||||
"-000000-10-31T17:45+00:00[UTC]",
|
||||
];
|
||||
const instance = new Temporal.PlainDate(2000, 5, 2);
|
||||
invalidStrings.forEach((arg) => {
|
||||
assert.throws(
|
||||
RangeError,
|
||||
() => instance.equals(arg),
|
||||
"reject minus zero as extended year"
|
||||
);
|
||||
});
|
|
@ -7,11 +7,17 @@ description: Negative zero, as an extended year, is rejected
|
|||
features: [Temporal, arrow-function]
|
||||
---*/
|
||||
|
||||
const arg = "-000000-10-31";
|
||||
const invalidStrings = [
|
||||
"-000000-10-31",
|
||||
"-000000-10-31T00:45",
|
||||
"-000000-10-31T00:45+01:00",
|
||||
"-000000-10-31T00:45+00:00[UTC]",
|
||||
];
|
||||
const instance = new Temporal.PlainDate(2000, 5, 2);
|
||||
|
||||
assert.throws(
|
||||
invalidStrings.forEach((arg) => {
|
||||
assert.throws(
|
||||
RangeError,
|
||||
() => { instance.equals(arg); },
|
||||
() => instance.equals(arg),
|
||||
"reject minus zero as extended year"
|
||||
);
|
||||
);
|
||||
});
|
||||
|
|
24
test/built-ins/Temporal/PlainDate/prototype/since/argument-propertybag-calendar-year-zero.js
vendored
Normal file
24
test/built-ins/Temporal/PlainDate/prototype/since/argument-propertybag-calendar-year-zero.js
vendored
Normal file
|
@ -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.plaindate.prototype.since
|
||||
description: Negative zero, as an extended year, is rejected
|
||||
features: [Temporal, arrow-function]
|
||||
---*/
|
||||
|
||||
const invalidStrings = [
|
||||
"-000000-10-31",
|
||||
"-000000-10-31T17:45",
|
||||
"-000000-10-31T17:45Z",
|
||||
"-000000-10-31T17:45+01:00",
|
||||
"-000000-10-31T17:45+00:00[UTC]",
|
||||
];
|
||||
const instance = new Temporal.PlainDate(2000, 5, 2);
|
||||
invalidStrings.forEach((arg) => {
|
||||
assert.throws(
|
||||
RangeError,
|
||||
() => instance.since(arg),
|
||||
"reject minus zero as extended year"
|
||||
);
|
||||
});
|
|
@ -7,11 +7,17 @@ description: Negative zero, as an extended year, is rejected
|
|||
features: [Temporal, arrow-function]
|
||||
---*/
|
||||
|
||||
const arg = "-000000-10-31";
|
||||
const invalidStrings = [
|
||||
"-000000-10-31",
|
||||
"-000000-10-31T00:45",
|
||||
"-000000-10-31T00:45+01:00",
|
||||
"-000000-10-31T00:45+00:00[UTC]",
|
||||
];
|
||||
const instance = new Temporal.PlainDate(2000, 5, 2);
|
||||
|
||||
assert.throws(
|
||||
invalidStrings.forEach((arg) => {
|
||||
assert.throws(
|
||||
RangeError,
|
||||
() => { instance.since(arg); },
|
||||
() => instance.since(arg),
|
||||
"reject minus zero as extended year"
|
||||
);
|
||||
);
|
||||
});
|
||||
|
|
|
@ -9,7 +9,8 @@ features: [Temporal, arrow-function]
|
|||
|
||||
const invalidStrings = [
|
||||
"-000000-12-07T03:24:30",
|
||||
"-000000-12-07T03:24:30+01:00[UTC]"
|
||||
"-000000-12-07T03:24:30+01:00",
|
||||
"-000000-12-07T03:24:30+00:00[UTC]",
|
||||
];
|
||||
const instance = new Temporal.PlainDate(2000, 5, 2);
|
||||
invalidStrings.forEach((arg) => {
|
||||
|
|
26
test/built-ins/Temporal/PlainDate/prototype/toZonedDateTime/timezone-string-year-zero.js
vendored
Normal file
26
test/built-ins/Temporal/PlainDate/prototype/toZonedDateTime/timezone-string-year-zero.js
vendored
Normal file
|
@ -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.plaindate.prototype.tozoneddatetime
|
||||
description: Negative zero, as an extended year, is rejected
|
||||
features: [Temporal, arrow-function]
|
||||
---*/
|
||||
|
||||
const invalidStrings = [
|
||||
"-000000-10-31T17:45Z",
|
||||
"-000000-10-31T17:45+00:00[UTC]",
|
||||
];
|
||||
const instance = new Temporal.PlainDate(2000, 5, 2);
|
||||
invalidStrings.forEach((timeZone) => {
|
||||
assert.throws(
|
||||
RangeError,
|
||||
() => instance.toZonedDateTime(timeZone),
|
||||
"reject minus zero as extended year"
|
||||
);
|
||||
assert.throws(
|
||||
RangeError,
|
||||
() => instance.toZonedDateTime({ timeZone }),
|
||||
"reject minus zero as extended year (nested property)"
|
||||
);
|
||||
});
|
|
@ -9,7 +9,8 @@ features: [Temporal, arrow-function]
|
|||
|
||||
const invalidStrings = [
|
||||
"-000000-12-07T03:24:30",
|
||||
"-000000-12-07T03:24:30+01:00[UTC]"
|
||||
"-000000-12-07T03:24:30+01:00",
|
||||
"-000000-12-07T03:24:30+00:00[UTC]",
|
||||
];
|
||||
const instance = new Temporal.PlainDate(2000, 5, 2);
|
||||
invalidStrings.forEach((arg) => {
|
||||
|
|
24
test/built-ins/Temporal/PlainDate/prototype/until/argument-propertybag-calendar-year-zero.js
vendored
Normal file
24
test/built-ins/Temporal/PlainDate/prototype/until/argument-propertybag-calendar-year-zero.js
vendored
Normal file
|
@ -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.plaindate.prototype.until
|
||||
description: Negative zero, as an extended year, is rejected
|
||||
features: [Temporal, arrow-function]
|
||||
---*/
|
||||
|
||||
const invalidStrings = [
|
||||
"-000000-10-31",
|
||||
"-000000-10-31T17:45",
|
||||
"-000000-10-31T17:45Z",
|
||||
"-000000-10-31T17:45+01:00",
|
||||
"-000000-10-31T17:45+00:00[UTC]",
|
||||
];
|
||||
const instance = new Temporal.PlainDate(2000, 5, 2);
|
||||
invalidStrings.forEach((arg) => {
|
||||
assert.throws(
|
||||
RangeError,
|
||||
() => instance.until(arg),
|
||||
"reject minus zero as extended year"
|
||||
);
|
||||
});
|
|
@ -7,11 +7,17 @@ description: Negative zero, as an extended year, is rejected
|
|||
features: [Temporal, arrow-function]
|
||||
---*/
|
||||
|
||||
const arg = "-000000-10-31";
|
||||
const invalidStrings = [
|
||||
"-000000-10-31",
|
||||
"-000000-10-31T00:45",
|
||||
"-000000-10-31T00:45+01:00",
|
||||
"-000000-10-31T00:45+00:00[UTC]",
|
||||
];
|
||||
const instance = new Temporal.PlainDate(2000, 5, 2);
|
||||
|
||||
assert.throws(
|
||||
invalidStrings.forEach((arg) => {
|
||||
assert.throws(
|
||||
RangeError,
|
||||
() => { instance.until(arg); },
|
||||
() => instance.until(arg),
|
||||
"reject minus zero as extended year"
|
||||
);
|
||||
);
|
||||
});
|
||||
|
|
|
@ -0,0 +1,29 @@
|
|||
// 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.compare
|
||||
description: Negative zero, as an extended year, is rejected
|
||||
features: [Temporal, arrow-function]
|
||||
---*/
|
||||
|
||||
const invalidStrings = [
|
||||
"-000000-10-31",
|
||||
"-000000-10-31T17:45",
|
||||
"-000000-10-31T17:45Z",
|
||||
"-000000-10-31T17:45+01:00",
|
||||
"-000000-10-31T17:45+00:00[UTC]",
|
||||
];
|
||||
|
||||
invalidStrings.forEach((arg) => {
|
||||
assert.throws(
|
||||
RangeError,
|
||||
() => Temporal.PlainDateTime.compare(arg, new Temporal.PlainDateTime(1976, 11, 18)),
|
||||
"reject minus zero as extended year (first argument)"
|
||||
);
|
||||
assert.throws(
|
||||
RangeError,
|
||||
() => Temporal.PlainDateTime.compare(new Temporal.PlainDateTime(1976, 11, 18), arg),
|
||||
"reject minus zero as extended year (second argument)"
|
||||
);
|
||||
});
|
|
@ -8,14 +8,21 @@ features: [Temporal]
|
|||
---*/
|
||||
|
||||
const ok = new Temporal.PlainDateTime(2000, 5, 2, 15);
|
||||
const bad = "-000000-12-07T03:24:30";
|
||||
const invalidStrings = [
|
||||
"-000000-12-07",
|
||||
"-000000-12-07T03:24:30",
|
||||
"-000000-12-07T03:24:30+01:00",
|
||||
"-000000-12-07T03:24:30+00:00[UTC]",
|
||||
];
|
||||
|
||||
assert.throws(RangeError,
|
||||
() => Temporal.PlainDateTime.compare(bad,ok),
|
||||
"Cannot use minus zero as extended year (first argument)"
|
||||
);
|
||||
invalidStrings.forEach((arg) => {
|
||||
assert.throws(RangeError,
|
||||
() => Temporal.PlainDateTime.compare(arg, ok),
|
||||
"Cannot use minus zero as extended year (first argument)"
|
||||
);
|
||||
|
||||
assert.throws(RangeError,
|
||||
() => Temporal.PlainDateTime.compare(ok, bad),
|
||||
"Cannot use minus zero as extended year (second argument)"
|
||||
);
|
||||
assert.throws(RangeError,
|
||||
() => Temporal.PlainDateTime.compare(ok, arg),
|
||||
"Cannot use minus zero as extended year (second argument)"
|
||||
);
|
||||
});
|
||||
|
|
|
@ -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.from
|
||||
description: Negative zero, as an extended year, is rejected
|
||||
features: [Temporal, arrow-function]
|
||||
---*/
|
||||
|
||||
const invalidStrings = [
|
||||
"-000000-10-31",
|
||||
"-000000-10-31T17:45",
|
||||
"-000000-10-31T17:45Z",
|
||||
"-000000-10-31T17:45+01:00",
|
||||
"-000000-10-31T17:45+00:00[UTC]",
|
||||
];
|
||||
|
||||
invalidStrings.forEach((arg) => {
|
||||
assert.throws(
|
||||
RangeError,
|
||||
() => Temporal.PlainDateTime.from(arg),
|
||||
"reject minus zero as extended year"
|
||||
);
|
||||
});
|
|
@ -8,13 +8,16 @@ features: [Temporal, arrow-function]
|
|||
---*/
|
||||
|
||||
const invalidStrings = [
|
||||
"-000000-12-07",
|
||||
"-000000-12-07T03:24:30",
|
||||
"-000000-12-07T03:24:30+01:00[UTC]"
|
||||
"-000000-12-07T03:24:30+01:00",
|
||||
"-000000-12-07T03:24:30+00:00[UTC]",
|
||||
];
|
||||
|
||||
invalidStrings.forEach((arg) => {
|
||||
assert.throws(
|
||||
RangeError,
|
||||
() => { Temporal.PlainDateTime.from(arg); },
|
||||
() => Temporal.PlainDateTime.from(arg),
|
||||
"reject minus zero as extended year"
|
||||
);
|
||||
});
|
||||
|
|
|
@ -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.equals
|
||||
description: Negative zero, as an extended year, is rejected
|
||||
features: [Temporal, arrow-function]
|
||||
---*/
|
||||
|
||||
const invalidStrings = [
|
||||
"-000000-10-31",
|
||||
"-000000-10-31T17:45",
|
||||
"-000000-10-31T17:45Z",
|
||||
"-000000-10-31T17:45+01:00",
|
||||
"-000000-10-31T17:45+00:00[UTC]",
|
||||
];
|
||||
const instance = new Temporal.PlainDateTime(2000, 5, 2, 12, 34, 56, 987, 654, 321);
|
||||
invalidStrings.forEach((arg) => {
|
||||
assert.throws(
|
||||
RangeError,
|
||||
() => instance.equals(arg),
|
||||
"reject minus zero as extended year"
|
||||
);
|
||||
});
|
|
@ -8,14 +8,16 @@ features: [Temporal, arrow-function]
|
|||
---*/
|
||||
|
||||
const invalidStrings = [
|
||||
"-000000-12-07",
|
||||
"-000000-12-07T03:24:30",
|
||||
"-000000-12-07T03:24:30+01:00[UTC]"
|
||||
"-000000-12-07T03:24:30+01:00",
|
||||
"-000000-12-07T03:24:30+00:00[UTC]",
|
||||
];
|
||||
const instance = new Temporal.PlainDateTime(2000, 5, 2, 12, 34, 56, 987, 654, 321);
|
||||
invalidStrings.forEach((arg) => {
|
||||
assert.throws(
|
||||
RangeError,
|
||||
() => { instance.equals(arg); },
|
||||
() => instance.equals(arg),
|
||||
"reject minus zero as extended year"
|
||||
);
|
||||
});
|
||||
|
|
24
test/built-ins/Temporal/PlainDateTime/prototype/since/argument-propertybag-calendar-year-zero.js
vendored
Normal file
24
test/built-ins/Temporal/PlainDateTime/prototype/since/argument-propertybag-calendar-year-zero.js
vendored
Normal file
|
@ -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.since
|
||||
description: Negative zero, as an extended year, is rejected
|
||||
features: [Temporal, arrow-function]
|
||||
---*/
|
||||
|
||||
const invalidStrings = [
|
||||
"-000000-10-31",
|
||||
"-000000-10-31T17:45",
|
||||
"-000000-10-31T17:45Z",
|
||||
"-000000-10-31T17:45+01:00",
|
||||
"-000000-10-31T17:45+00:00[UTC]",
|
||||
];
|
||||
const instance = new Temporal.PlainDateTime(2000, 5, 2, 12, 34, 56, 987, 654, 321);
|
||||
invalidStrings.forEach((arg) => {
|
||||
assert.throws(
|
||||
RangeError,
|
||||
() => instance.since(arg),
|
||||
"reject minus zero as extended year"
|
||||
);
|
||||
});
|
|
@ -8,14 +8,16 @@ features: [Temporal, arrow-function]
|
|||
---*/
|
||||
|
||||
const invalidStrings = [
|
||||
"-000000-12-07",
|
||||
"-000000-12-07T03:24:30",
|
||||
"-000000-12-07T03:24:30+01:00[UTC]"
|
||||
"-000000-12-07T03:24:30+01:00",
|
||||
"-000000-12-07T03:24:30+00:00[UTC]",
|
||||
];
|
||||
const instance = new Temporal.PlainDateTime(2000, 5, 2, 12, 34, 56, 987, 654, 321);
|
||||
invalidStrings.forEach((arg) => {
|
||||
assert.throws(
|
||||
RangeError,
|
||||
() => { instance.since(arg); },
|
||||
() => instance.since(arg),
|
||||
"reject minus zero as extended year"
|
||||
);
|
||||
});
|
||||
|
|
26
test/built-ins/Temporal/PlainDateTime/prototype/toZonedDateTime/timezone-string-year-zero.js
vendored
Normal file
26
test/built-ins/Temporal/PlainDateTime/prototype/toZonedDateTime/timezone-string-year-zero.js
vendored
Normal file
|
@ -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.plaindatetime.prototype.tozoneddatetime
|
||||
description: Negative zero, as an extended year, is rejected
|
||||
features: [Temporal, arrow-function]
|
||||
---*/
|
||||
|
||||
const invalidStrings = [
|
||||
"-000000-10-31T17:45Z",
|
||||
"-000000-10-31T17:45+00:00[UTC]",
|
||||
];
|
||||
const instance = new Temporal.PlainDateTime(2000, 5, 2);
|
||||
invalidStrings.forEach((timeZone) => {
|
||||
assert.throws(
|
||||
RangeError,
|
||||
() => instance.toZonedDateTime(timeZone),
|
||||
"reject minus zero as extended year"
|
||||
);
|
||||
assert.throws(
|
||||
RangeError,
|
||||
() => instance.toZonedDateTime({ timeZone }),
|
||||
"reject minus zero as extended year (nested property)"
|
||||
);
|
||||
});
|
24
test/built-ins/Temporal/PlainDateTime/prototype/until/argument-propertybag-calendar-year-zero.js
vendored
Normal file
24
test/built-ins/Temporal/PlainDateTime/prototype/until/argument-propertybag-calendar-year-zero.js
vendored
Normal file
|
@ -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.until
|
||||
description: Negative zero, as an extended year, is rejected
|
||||
features: [Temporal, arrow-function]
|
||||
---*/
|
||||
|
||||
const invalidStrings = [
|
||||
"-000000-10-31",
|
||||
"-000000-10-31T17:45",
|
||||
"-000000-10-31T17:45Z",
|
||||
"-000000-10-31T17:45+01:00",
|
||||
"-000000-10-31T17:45+00:00[UTC]",
|
||||
];
|
||||
const instance = new Temporal.PlainDateTime(2000, 5, 2, 12, 34, 56, 987, 654, 321);
|
||||
invalidStrings.forEach((arg) => {
|
||||
assert.throws(
|
||||
RangeError,
|
||||
() => instance.until(arg),
|
||||
"reject minus zero as extended year"
|
||||
);
|
||||
});
|
|
@ -8,14 +8,16 @@ features: [Temporal, arrow-function]
|
|||
---*/
|
||||
|
||||
const invalidStrings = [
|
||||
"-000000-12-07",
|
||||
"-000000-12-07T03:24:30",
|
||||
"-000000-12-07T03:24:30+01:00[UTC]"
|
||||
"-000000-12-07T03:24:30+01:00",
|
||||
"-000000-12-07T03:24:30+00:00[UTC]",
|
||||
];
|
||||
const instance = new Temporal.PlainDateTime(2000, 5, 2, 12, 34, 56, 987, 654, 321);
|
||||
invalidStrings.forEach((arg) => {
|
||||
assert.throws(
|
||||
RangeError,
|
||||
() => { instance.until(arg); },
|
||||
() => instance.until(arg),
|
||||
"reject minus zero as extended year"
|
||||
);
|
||||
});
|
||||
|
|
|
@ -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.withplaindate
|
||||
description: Negative zero, as an extended year, is rejected
|
||||
features: [Temporal, arrow-function]
|
||||
---*/
|
||||
|
||||
const invalidStrings = [
|
||||
"-000000-10-31",
|
||||
"-000000-10-31T17:45",
|
||||
"-000000-10-31T17:45Z",
|
||||
"-000000-10-31T17:45+01:00",
|
||||
"-000000-10-31T17:45+00:00[UTC]",
|
||||
];
|
||||
const instance = new Temporal.PlainDateTime(2000, 5, 2, 12, 34, 56, 987, 654, 321);
|
||||
invalidStrings.forEach((arg) => {
|
||||
assert.throws(
|
||||
RangeError,
|
||||
() => instance.withPlainDate(arg),
|
||||
"reject minus zero as extended year"
|
||||
);
|
||||
});
|
|
@ -7,11 +7,17 @@ description: Negative zero, as an extended year, is rejected
|
|||
features: [Temporal, arrow-function]
|
||||
---*/
|
||||
|
||||
const arg = "-000000-10-31";
|
||||
const invalidStrings = [
|
||||
"-000000-10-31",
|
||||
"-000000-10-31T00:45",
|
||||
"-000000-10-31T00:45+01:00",
|
||||
"-000000-10-31T00:45+00:00[UTC]",
|
||||
];
|
||||
const instance = new Temporal.PlainDateTime(2000, 5, 2, 12, 34, 56, 987, 654, 321);
|
||||
|
||||
assert.throws(
|
||||
invalidStrings.forEach((arg) => {
|
||||
assert.throws(
|
||||
RangeError,
|
||||
() => { instance.withPlainDate(arg); },
|
||||
() => instance.withPlainDate(arg),
|
||||
"reject minus zero as extended year"
|
||||
);
|
||||
);
|
||||
});
|
||||
|
|
|
@ -9,7 +9,8 @@ features: [Temporal, arrow-function]
|
|||
|
||||
const invalidStrings = [
|
||||
"-000000-12-07T03:24:30",
|
||||
"-000000-12-07T03:24:30+01:00[UTC]"
|
||||
"-000000-12-07T03:24:30+01:00",
|
||||
"-000000-12-07T03:24:30+00:00[UTC]",
|
||||
];
|
||||
const instance = new Temporal.PlainDateTime(2000, 5, 2, 12, 34, 56, 987, 654, 321);
|
||||
invalidStrings.forEach((arg) => {
|
||||
|
|
|
@ -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.plainmonthday.from
|
||||
description: Negative zero, as an extended year, is rejected
|
||||
features: [Temporal, arrow-function]
|
||||
---*/
|
||||
|
||||
const invalidStrings = [
|
||||
"-000000-10-31",
|
||||
"-000000-10-31T17:45",
|
||||
"-000000-10-31T17:45Z",
|
||||
"-000000-10-31T17:45+01:00",
|
||||
"-000000-10-31T17:45+00:00[UTC]",
|
||||
];
|
||||
|
||||
invalidStrings.forEach((arg) => {
|
||||
assert.throws(
|
||||
RangeError,
|
||||
() => Temporal.PlainMonthDay.from(arg),
|
||||
"reject minus zero as extended year"
|
||||
);
|
||||
});
|
|
@ -8,15 +8,16 @@ features: [Temporal, arrow-function]
|
|||
---*/
|
||||
|
||||
const invalidStrings = [
|
||||
"-000000-08",
|
||||
"-000000-08-24",
|
||||
"-000000-08-24T15:43:27",
|
||||
"-000000-08-24T15:43:27+01:00[UTC]"
|
||||
"-000000-08-24",
|
||||
"-000000-08-24T15:43:27",
|
||||
"-000000-08-24T15:43:27+01:00",
|
||||
"-000000-08-24T15:43:27+00:00[UTC]",
|
||||
];
|
||||
|
||||
invalidStrings.forEach((arg) => {
|
||||
assert.throws(
|
||||
RangeError,
|
||||
() => { Temporal.PlainMonthDay.from(arg); },
|
||||
() => Temporal.PlainMonthDay.from(arg),
|
||||
"reject minus zero as extended year"
|
||||
);
|
||||
});
|
||||
|
|
|
@ -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.plainmonthday.prototype.equals
|
||||
description: Negative zero, as an extended year, is rejected
|
||||
features: [Temporal, arrow-function]
|
||||
---*/
|
||||
|
||||
const invalidStrings = [
|
||||
"-000000-10-31",
|
||||
"-000000-10-31T17:45",
|
||||
"-000000-10-31T17:45Z",
|
||||
"-000000-10-31T17:45+01:00",
|
||||
"-000000-10-31T17:45+00:00[UTC]",
|
||||
];
|
||||
const instance = new Temporal.PlainMonthDay(5, 2);
|
||||
invalidStrings.forEach((arg) => {
|
||||
assert.throws(
|
||||
RangeError,
|
||||
() => instance.equals(arg),
|
||||
"reject minus zero as extended year"
|
||||
);
|
||||
});
|
|
@ -8,10 +8,10 @@ features: [Temporal, arrow-function]
|
|||
---*/
|
||||
|
||||
const invalidStrings = [
|
||||
"-000000-08",
|
||||
"-000000-08-24",
|
||||
"-000000-08-24T15:43:27",
|
||||
"-000000-08-24T15:43:27+01:00[UTC]"
|
||||
"-000000-08-24",
|
||||
"-000000-08-24T15:43:27",
|
||||
"-000000-08-24T15:43:27+01:00",
|
||||
"-000000-08-24T15:43:27+00:00[UTC]",
|
||||
];
|
||||
const instance = new Temporal.PlainMonthDay(5, 2);
|
||||
invalidStrings.forEach((arg) => {
|
||||
|
|
|
@ -8,16 +8,22 @@ features: [Temporal]
|
|||
---*/
|
||||
|
||||
const time = new Temporal.PlainTime(12, 34, 56, 987, 654, 321);
|
||||
const bad = "-000000-12-07T03:24:30";
|
||||
const invalidStrings = [
|
||||
"-000000-12-07T03:24:30",
|
||||
"-000000-12-07T03:24:30+01:00",
|
||||
"-000000-12-07T03:24:30+00:00[UTC]",
|
||||
];
|
||||
|
||||
assert.throws(
|
||||
RangeError,
|
||||
() => Temporal.PlainTime.compare(bad, time),
|
||||
"Cannot use minus zero as extended year (first argument)"
|
||||
);
|
||||
invalidStrings.forEach((arg) => {
|
||||
assert.throws(
|
||||
RangeError,
|
||||
() => Temporal.PlainTime.compare(arg, time),
|
||||
"Cannot use minus zero as extended year (first argument)"
|
||||
);
|
||||
|
||||
assert.throws(
|
||||
RangeError,
|
||||
() => Temporal.PlainTime.compare(time, bad),
|
||||
"Cannot use minus zero as extended year (second argument)"
|
||||
);
|
||||
assert.throws(
|
||||
RangeError,
|
||||
() => Temporal.PlainTime.compare(time, arg),
|
||||
"Cannot use minus zero as extended year (second argument)"
|
||||
);
|
||||
});
|
||||
|
|
|
@ -9,12 +9,14 @@ features: [Temporal, arrow-function]
|
|||
|
||||
const invalidStrings = [
|
||||
"-000000-12-07T03:24:30",
|
||||
"-000000-12-07T03:24:30+01:00[UTC]"
|
||||
"-000000-12-07T03:24:30+01:00",
|
||||
"-000000-12-07T03:24:30+00:00[UTC]",
|
||||
];
|
||||
|
||||
invalidStrings.forEach((arg) => {
|
||||
assert.throws(
|
||||
RangeError,
|
||||
() => { Temporal.PlainTime.from(arg); },
|
||||
() => Temporal.PlainTime.from(arg),
|
||||
"reject minus zero as extended year"
|
||||
);
|
||||
});
|
||||
|
|
|
@ -9,7 +9,8 @@ features: [Temporal, arrow-function]
|
|||
|
||||
const invalidStrings = [
|
||||
"-000000-12-07T03:24:30",
|
||||
"-000000-12-07T03:24:30+01:00[UTC]"
|
||||
"-000000-12-07T03:24:30+01:00",
|
||||
"-000000-12-07T03:24:30+00:00[UTC]",
|
||||
];
|
||||
const instance = new Temporal.PlainTime(12, 34, 56, 987, 654, 321);
|
||||
invalidStrings.forEach((arg) => {
|
||||
|
|
|
@ -9,7 +9,8 @@ features: [Temporal, arrow-function]
|
|||
|
||||
const invalidStrings = [
|
||||
"-000000-12-07T03:24:30",
|
||||
"-000000-12-07T03:24:30+01:00[UTC]"
|
||||
"-000000-12-07T03:24:30+01:00",
|
||||
"-000000-12-07T03:24:30+00:00[UTC]",
|
||||
];
|
||||
const instance = new Temporal.PlainTime(12, 34, 56, 987, 654, 321);
|
||||
invalidStrings.forEach((arg) => {
|
||||
|
|
|
@ -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.plaintime.prototype.toplaindatetime
|
||||
description: Negative zero, as an extended year, is rejected
|
||||
features: [Temporal, arrow-function]
|
||||
---*/
|
||||
|
||||
const invalidStrings = [
|
||||
"-000000-10-31",
|
||||
"-000000-10-31T17:45",
|
||||
"-000000-10-31T17:45Z",
|
||||
"-000000-10-31T17:45+01:00",
|
||||
"-000000-10-31T17:45+00:00[UTC]",
|
||||
];
|
||||
const instance = new Temporal.PlainTime(12, 34, 56, 987, 654, 321);
|
||||
invalidStrings.forEach((arg) => {
|
||||
assert.throws(
|
||||
RangeError,
|
||||
() => instance.toPlainDateTime(arg),
|
||||
"reject minus zero as extended year"
|
||||
);
|
||||
});
|
|
@ -7,11 +7,17 @@ description: Negative zero, as an extended year, is rejected
|
|||
features: [Temporal, arrow-function]
|
||||
---*/
|
||||
|
||||
const arg = "-000000-10-31";
|
||||
const invalidStrings = [
|
||||
"-000000-10-31",
|
||||
"-000000-10-31T00:45",
|
||||
"-000000-10-31T00:45+01:00",
|
||||
"-000000-10-31T00:45+00:00[UTC]",
|
||||
];
|
||||
const instance = new Temporal.PlainTime(12, 34, 56, 987, 654, 321);
|
||||
|
||||
assert.throws(
|
||||
invalidStrings.forEach((arg) => {
|
||||
assert.throws(
|
||||
RangeError,
|
||||
() => { instance.toPlainDateTime(arg); },
|
||||
() => instance.toPlainDateTime(arg),
|
||||
"reject minus zero as extended year"
|
||||
);
|
||||
);
|
||||
});
|
||||
|
|
|
@ -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.plaintime.prototype.tozoneddatetime
|
||||
description: Negative zero, as an extended year, is rejected
|
||||
features: [Temporal, arrow-function]
|
||||
---*/
|
||||
|
||||
const invalidStrings = [
|
||||
"-000000-10-31",
|
||||
"-000000-10-31T17:45",
|
||||
"-000000-10-31T17:45Z",
|
||||
"-000000-10-31T17:45+01:00",
|
||||
"-000000-10-31T17:45+00:00[UTC]",
|
||||
];
|
||||
const instance = new Temporal.PlainTime(12, 34, 56, 987, 654, 321);
|
||||
invalidStrings.forEach((arg) => {
|
||||
assert.throws(
|
||||
RangeError,
|
||||
() => instance.toZonedDateTime({ plainDate: arg, timeZone: "UTC" }),
|
||||
"reject minus zero as extended year"
|
||||
);
|
||||
});
|
26
test/built-ins/Temporal/PlainTime/prototype/toZonedDateTime/timezone-string-year-zero.js
vendored
Normal file
26
test/built-ins/Temporal/PlainTime/prototype/toZonedDateTime/timezone-string-year-zero.js
vendored
Normal file
|
@ -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.plaintime.prototype.tozoneddatetime
|
||||
description: Negative zero, as an extended year, is rejected
|
||||
features: [Temporal, arrow-function]
|
||||
---*/
|
||||
|
||||
const invalidStrings = [
|
||||
"-000000-10-31T17:45Z",
|
||||
"-000000-10-31T17:45+00:00[UTC]",
|
||||
];
|
||||
const instance = new Temporal.PlainTime();
|
||||
invalidStrings.forEach((timeZone) => {
|
||||
assert.throws(
|
||||
RangeError,
|
||||
() => instance.toZonedDateTime({ plainDate: new Temporal.PlainDate(2000, 5, 2), timeZone }),
|
||||
"reject minus zero as extended year"
|
||||
);
|
||||
assert.throws(
|
||||
RangeError,
|
||||
() => instance.toZonedDateTime({ plainDate: new Temporal.PlainDate(2000, 5, 2), timeZone: { timeZone } }),
|
||||
"reject minus zero as extended year (nested property)"
|
||||
);
|
||||
});
|
|
@ -7,11 +7,17 @@ description: Negative zero, as an extended year, is rejected
|
|||
features: [Temporal, arrow-function]
|
||||
---*/
|
||||
|
||||
const arg = "-000000-10-31";
|
||||
const invalidStrings = [
|
||||
"-000000-10-31",
|
||||
"-000000-10-31T00:45",
|
||||
"-000000-10-31T00:45+01:00",
|
||||
"-000000-10-31T00:45+00:00[UTC]",
|
||||
];
|
||||
const instance = new Temporal.PlainTime(12, 34, 56, 987, 654, 321);
|
||||
|
||||
assert.throws(
|
||||
invalidStrings.forEach((arg) => {
|
||||
assert.throws(
|
||||
RangeError,
|
||||
() => { instance.toZonedDateTime({ plainDate: arg, timeZone: "UTC" }); },
|
||||
() => instance.toZonedDateTime({ plainDate: arg, timeZone: "UTC" }),
|
||||
"reject minus zero as extended year"
|
||||
);
|
||||
);
|
||||
});
|
||||
|
|
|
@ -9,7 +9,8 @@ features: [Temporal, arrow-function]
|
|||
|
||||
const invalidStrings = [
|
||||
"-000000-12-07T03:24:30",
|
||||
"-000000-12-07T03:24:30+01:00[UTC]"
|
||||
"-000000-12-07T03:24:30+01:00",
|
||||
"-000000-12-07T03:24:30+00:00[UTC]",
|
||||
];
|
||||
const instance = new Temporal.PlainTime(12, 34, 56, 987, 654, 321);
|
||||
invalidStrings.forEach((arg) => {
|
||||
|
|
|
@ -0,0 +1,29 @@
|
|||
// 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.compare
|
||||
description: Negative zero, as an extended year, is rejected
|
||||
features: [Temporal, arrow-function]
|
||||
---*/
|
||||
|
||||
const invalidStrings = [
|
||||
"-000000-10-31",
|
||||
"-000000-10-31T17:45",
|
||||
"-000000-10-31T17:45Z",
|
||||
"-000000-10-31T17:45+01:00",
|
||||
"-000000-10-31T17:45+00:00[UTC]",
|
||||
];
|
||||
|
||||
invalidStrings.forEach((arg) => {
|
||||
assert.throws(
|
||||
RangeError,
|
||||
() => Temporal.PlainYearMonth.compare(arg, new Temporal.PlainYearMonth(2019, 6)),
|
||||
"reject minus zero as extended year (first argument)"
|
||||
);
|
||||
assert.throws(
|
||||
RangeError,
|
||||
() => Temporal.PlainYearMonth.compare(new Temporal.PlainYearMonth(2019, 6), arg),
|
||||
"reject minus zero as extended year (second argument)"
|
||||
);
|
||||
});
|
|
@ -8,16 +8,24 @@ features: [Temporal]
|
|||
---*/
|
||||
|
||||
const ok = new Temporal.PlainYearMonth(2000, 5);
|
||||
const bad = "-000000-06";
|
||||
const invalidStrings = [
|
||||
"-000000-06",
|
||||
"-000000-06-24",
|
||||
"-000000-06-24T15:43:27",
|
||||
"-000000-06-24T15:43:27+01:00",
|
||||
"-000000-06-24T15:43:27+00:00[UTC]",
|
||||
];
|
||||
|
||||
assert.throws(
|
||||
RangeError,
|
||||
() => Temporal.PlainYearMonth.compare(bad, ok),
|
||||
"Cannot use minus zero as extended year (first argument)"
|
||||
);
|
||||
invalidStrings.forEach((arg) => {
|
||||
assert.throws(
|
||||
RangeError,
|
||||
() => Temporal.PlainYearMonth.compare(arg, ok),
|
||||
"Cannot use minus zero as extended year (first argument)"
|
||||
);
|
||||
|
||||
assert.throws(
|
||||
RangeError,
|
||||
() => Temporal.PlainYearMonth.compare(ok, bad),
|
||||
"Cannot use minus zero as extended year (second argument)"
|
||||
);
|
||||
assert.throws(
|
||||
RangeError,
|
||||
() => Temporal.PlainYearMonth.compare(ok, arg),
|
||||
"Cannot use minus zero as extended year (second argument)"
|
||||
);
|
||||
});
|
||||
|
|
|
@ -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.plainyearmonth.from
|
||||
description: Negative zero, as an extended year, is rejected
|
||||
features: [Temporal, arrow-function]
|
||||
---*/
|
||||
|
||||
const invalidStrings = [
|
||||
"-000000-10-31",
|
||||
"-000000-10-31T17:45",
|
||||
"-000000-10-31T17:45Z",
|
||||
"-000000-10-31T17:45+01:00",
|
||||
"-000000-10-31T17:45+00:00[UTC]",
|
||||
];
|
||||
|
||||
invalidStrings.forEach((arg) => {
|
||||
assert.throws(
|
||||
RangeError,
|
||||
() => Temporal.PlainYearMonth.from(arg),
|
||||
"reject minus zero as extended year"
|
||||
);
|
||||
});
|
|
@ -8,15 +8,17 @@ features: [Temporal, arrow-function]
|
|||
---*/
|
||||
|
||||
const invalidStrings = [
|
||||
'-000000-06',
|
||||
'-000000-06-24',
|
||||
'-000000-06-24T15:43:27',
|
||||
'-000000-06-24T15:43:27+01:00[UTC]'
|
||||
"-000000-06",
|
||||
"-000000-06-24",
|
||||
"-000000-06-24T15:43:27",
|
||||
"-000000-06-24T15:43:27+01:00",
|
||||
"-000000-06-24T15:43:27+00:00[UTC]",
|
||||
];
|
||||
|
||||
invalidStrings.forEach((arg) => {
|
||||
assert.throws(
|
||||
RangeError,
|
||||
() => { Temporal.PlainYearMonth.from(arg); },
|
||||
() => Temporal.PlainYearMonth.from(arg),
|
||||
"reject minus zero as extended year"
|
||||
);
|
||||
});
|
||||
|
|
|
@ -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.plainyearmonth.prototype.equals
|
||||
description: Negative zero, as an extended year, is rejected
|
||||
features: [Temporal, arrow-function]
|
||||
---*/
|
||||
|
||||
const invalidStrings = [
|
||||
"-000000-10-31",
|
||||
"-000000-10-31T17:45",
|
||||
"-000000-10-31T17:45Z",
|
||||
"-000000-10-31T17:45+01:00",
|
||||
"-000000-10-31T17:45+00:00[UTC]",
|
||||
];
|
||||
const instance = new Temporal.PlainYearMonth(2000, 5);
|
||||
invalidStrings.forEach((arg) => {
|
||||
assert.throws(
|
||||
RangeError,
|
||||
() => instance.equals(arg),
|
||||
"reject minus zero as extended year"
|
||||
);
|
||||
});
|
|
@ -3,15 +3,16 @@
|
|||
|
||||
/*---
|
||||
esid: sec-temporal.plainyearmonth.prototype.equals
|
||||
description: RangeError thrown if a string with UTC designator is used as a PlainYearMonth
|
||||
description: Negative zero, as an extended year, is rejected
|
||||
features: [Temporal, arrow-function]
|
||||
---*/
|
||||
|
||||
const invalidStrings = [
|
||||
'-000000-06',
|
||||
'-000000-06-24',
|
||||
'-000000-06-24T15:43:27',
|
||||
'-000000-06-24T15:43:27+01:00[UTC]'
|
||||
"-000000-06",
|
||||
"-000000-06-24",
|
||||
"-000000-06-24T15:43:27",
|
||||
"-000000-06-24T15:43:27+01:00",
|
||||
"-000000-06-24T15:43:27+00:00[UTC]",
|
||||
];
|
||||
const instance = new Temporal.PlainYearMonth(2000, 5);
|
||||
invalidStrings.forEach((arg) => {
|
||||
|
|
|
@ -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.plainyearmonth.prototype.since
|
||||
description: Negative zero, as an extended year, is rejected
|
||||
features: [Temporal, arrow-function]
|
||||
---*/
|
||||
|
||||
const invalidStrings = [
|
||||
"-000000-10-31",
|
||||
"-000000-10-31T17:45",
|
||||
"-000000-10-31T17:45Z",
|
||||
"-000000-10-31T17:45+01:00",
|
||||
"-000000-10-31T17:45+00:00[UTC]",
|
||||
];
|
||||
const instance = new Temporal.PlainYearMonth(2000, 5);
|
||||
invalidStrings.forEach((arg) => {
|
||||
assert.throws(
|
||||
RangeError,
|
||||
() => instance.since(arg),
|
||||
"reject minus zero as extended year"
|
||||
);
|
||||
});
|
|
@ -3,15 +3,16 @@
|
|||
|
||||
/*---
|
||||
esid: sec-temporal.plainyearmonth.prototype.since
|
||||
description: RangeError thrown if a string with UTC designator is used as a PlainYearMonth
|
||||
description: Negative zero, as an extended year, is rejected
|
||||
features: [Temporal, arrow-function]
|
||||
---*/
|
||||
|
||||
const invalidStrings = [
|
||||
'-000000-06',
|
||||
'-000000-06-24',
|
||||
'-000000-06-24T15:43:27',
|
||||
'-000000-06-24T15:43:27+01:00[UTC]'
|
||||
"-000000-06",
|
||||
"-000000-06-24",
|
||||
"-000000-06-24T15:43:27",
|
||||
"-000000-06-24T15:43:27+01:00",
|
||||
"-000000-06-24T15:43:27+00:00[UTC]",
|
||||
];
|
||||
const instance = new Temporal.PlainYearMonth(2000, 5);
|
||||
invalidStrings.forEach((arg) => {
|
||||
|
|
|
@ -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.plainyearmonth.prototype.until
|
||||
description: Negative zero, as an extended year, is rejected
|
||||
features: [Temporal, arrow-function]
|
||||
---*/
|
||||
|
||||
const invalidStrings = [
|
||||
"-000000-10-31",
|
||||
"-000000-10-31T17:45",
|
||||
"-000000-10-31T17:45Z",
|
||||
"-000000-10-31T17:45+01:00",
|
||||
"-000000-10-31T17:45+00:00[UTC]",
|
||||
];
|
||||
const instance = new Temporal.PlainYearMonth(2000, 5);
|
||||
invalidStrings.forEach((arg) => {
|
||||
assert.throws(
|
||||
RangeError,
|
||||
() => instance.until(arg),
|
||||
"reject minus zero as extended year"
|
||||
);
|
||||
});
|
|
@ -3,15 +3,16 @@
|
|||
|
||||
/*---
|
||||
esid: sec-temporal.plainyearmonth.prototype.until
|
||||
description: RangeError thrown if a string with UTC designator is used as a PlainYearMonth
|
||||
description: Negative zero, as an extended year, is rejected
|
||||
features: [Temporal, arrow-function]
|
||||
---*/
|
||||
|
||||
const invalidStrings = [
|
||||
'-000000-06',
|
||||
'-000000-06-24',
|
||||
'-000000-06-24T15:43:27',
|
||||
'-000000-06-24T15:43:27+01:00[UTC]'
|
||||
"-000000-06",
|
||||
"-000000-06-24",
|
||||
"-000000-06-24T15:43:27",
|
||||
"-000000-06-24T15:43:27+01:00",
|
||||
"-000000-06-24T15:43:27+00:00[UTC]",
|
||||
];
|
||||
const instance = new Temporal.PlainYearMonth(2000, 5);
|
||||
invalidStrings.forEach((arg) => {
|
||||
|
|
|
@ -0,0 +1,25 @@
|
|||
// 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.timezone.from
|
||||
description: Negative zero, as an extended year, is rejected
|
||||
features: [Temporal, arrow-function]
|
||||
---*/
|
||||
|
||||
const invalidStrings = [
|
||||
"-000000-10-31T17:45Z",
|
||||
"-000000-10-31T17:45+00:00[UTC]",
|
||||
];
|
||||
invalidStrings.forEach((timeZone) => {
|
||||
assert.throws(
|
||||
RangeError,
|
||||
() => Temporal.TimeZone.from(timeZone),
|
||||
"reject minus zero as extended year"
|
||||
);
|
||||
assert.throws(
|
||||
RangeError,
|
||||
() => Temporal.TimeZone.from({ timeZone }),
|
||||
"reject minus zero as extended year (nested property)"
|
||||
);
|
||||
});
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue