mirror of https://github.com/tc39/test262.git
Test rejection of "Z" UTC designators in Plain strings
Tests for the normative changes made to Temporal in https://github.com/tc39/proposal-temporal/pull/1874
This commit is contained in:
parent
6d5975defc
commit
0184842b09
21
test/built-ins/Temporal/Calendar/prototype/dateAdd/argument-string-with-utc-designator.js
vendored
Normal file
21
test/built-ins/Temporal/Calendar/prototype/dateAdd/argument-string-with-utc-designator.js
vendored
Normal file
|
@ -0,0 +1,21 @@
|
|||
// Copyright (C) 2021 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: RangeError thrown if a string with UTC designator is used as a PlainDate
|
||||
features: [Temporal, arrow-function]
|
||||
---*/
|
||||
|
||||
const invalidStrings = [
|
||||
"2019-10-01T09:00:00Z",
|
||||
"2019-10-01T09:00:00Z[UTC]",
|
||||
];
|
||||
const instance = new Temporal.Calendar("iso8601");
|
||||
invalidStrings.forEach((arg) => {
|
||||
assert.throws(
|
||||
RangeError,
|
||||
() => instance.dateAdd(arg),
|
||||
"String with UTC designator should not be valid as a PlainDate"
|
||||
);
|
||||
});
|
27
test/built-ins/Temporal/Calendar/prototype/dateUntil/argument-string-with-utc-designator.js
vendored
Normal file
27
test/built-ins/Temporal/Calendar/prototype/dateUntil/argument-string-with-utc-designator.js
vendored
Normal file
|
@ -0,0 +1,27 @@
|
|||
// Copyright (C) 2021 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: RangeError thrown if a string with UTC designator is used as a PlainDate
|
||||
features: [Temporal, arrow-function]
|
||||
---*/
|
||||
|
||||
const invalidStrings = [
|
||||
"2019-10-01T09:00:00Z",
|
||||
"2019-10-01T09:00:00Z[UTC]",
|
||||
];
|
||||
const instance = new Temporal.Calendar("iso8601");
|
||||
const plainDate = new Temporal.PlainDate(2000, 5, 2);
|
||||
invalidStrings.forEach((arg) => {
|
||||
assert.throws(
|
||||
RangeError,
|
||||
() => instance.dateUntil(arg, plainDate),
|
||||
"String with UTC designator should not be valid as a PlainDate (first argument)"
|
||||
);
|
||||
assert.throws(
|
||||
RangeError,
|
||||
() => instance.dateUntil(plainDate, arg),
|
||||
"String with UTC designator should not be valid as a PlainDate (second argument)"
|
||||
);
|
||||
});
|
21
test/built-ins/Temporal/Calendar/prototype/day/argument-string-with-utc-designator.js
vendored
Normal file
21
test/built-ins/Temporal/Calendar/prototype/day/argument-string-with-utc-designator.js
vendored
Normal file
|
@ -0,0 +1,21 @@
|
|||
// Copyright (C) 2021 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: RangeError thrown if a string with UTC designator is used as a PlainDate
|
||||
features: [Temporal, arrow-function]
|
||||
---*/
|
||||
|
||||
const invalidStrings = [
|
||||
"2019-10-01T09:00:00Z",
|
||||
"2019-10-01T09:00:00Z[UTC]",
|
||||
];
|
||||
const instance = new Temporal.Calendar("iso8601");
|
||||
invalidStrings.forEach((arg) => {
|
||||
assert.throws(
|
||||
RangeError,
|
||||
() => instance.day(arg),
|
||||
"String with UTC designator should not be valid as a PlainDate"
|
||||
);
|
||||
});
|
21
test/built-ins/Temporal/Calendar/prototype/dayOfWeek/argument-string-with-utc-designator.js
vendored
Normal file
21
test/built-ins/Temporal/Calendar/prototype/dayOfWeek/argument-string-with-utc-designator.js
vendored
Normal file
|
@ -0,0 +1,21 @@
|
|||
// Copyright (C) 2021 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: RangeError thrown if a string with UTC designator is used as a PlainDate
|
||||
features: [Temporal, arrow-function]
|
||||
---*/
|
||||
|
||||
const invalidStrings = [
|
||||
"2019-10-01T09:00:00Z",
|
||||
"2019-10-01T09:00:00Z[UTC]",
|
||||
];
|
||||
const instance = new Temporal.Calendar("iso8601");
|
||||
invalidStrings.forEach((arg) => {
|
||||
assert.throws(
|
||||
RangeError,
|
||||
() => instance.dayOfWeek(arg),
|
||||
"String with UTC designator should not be valid as a PlainDate"
|
||||
);
|
||||
});
|
21
test/built-ins/Temporal/Calendar/prototype/dayOfYear/argument-string-with-utc-designator.js
vendored
Normal file
21
test/built-ins/Temporal/Calendar/prototype/dayOfYear/argument-string-with-utc-designator.js
vendored
Normal file
|
@ -0,0 +1,21 @@
|
|||
// Copyright (C) 2021 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: RangeError thrown if a string with UTC designator is used as a PlainDate
|
||||
features: [Temporal, arrow-function]
|
||||
---*/
|
||||
|
||||
const invalidStrings = [
|
||||
"2019-10-01T09:00:00Z",
|
||||
"2019-10-01T09:00:00Z[UTC]",
|
||||
];
|
||||
const instance = new Temporal.Calendar("iso8601");
|
||||
invalidStrings.forEach((arg) => {
|
||||
assert.throws(
|
||||
RangeError,
|
||||
() => instance.dayOfYear(arg),
|
||||
"String with UTC designator should not be valid as a PlainDate"
|
||||
);
|
||||
});
|
21
test/built-ins/Temporal/Calendar/prototype/daysInMonth/argument-string-with-utc-designator.js
vendored
Normal file
21
test/built-ins/Temporal/Calendar/prototype/daysInMonth/argument-string-with-utc-designator.js
vendored
Normal file
|
@ -0,0 +1,21 @@
|
|||
// Copyright (C) 2021 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: RangeError thrown if a string with UTC designator is used as a PlainDate
|
||||
features: [Temporal, arrow-function]
|
||||
---*/
|
||||
|
||||
const invalidStrings = [
|
||||
"2019-10-01T09:00:00Z",
|
||||
"2019-10-01T09:00:00Z[UTC]",
|
||||
];
|
||||
const instance = new Temporal.Calendar("iso8601");
|
||||
invalidStrings.forEach((arg) => {
|
||||
assert.throws(
|
||||
RangeError,
|
||||
() => instance.daysInMonth(arg),
|
||||
"String with UTC designator should not be valid as a PlainDate"
|
||||
);
|
||||
});
|
21
test/built-ins/Temporal/Calendar/prototype/daysInWeek/argument-string-with-utc-designator.js
vendored
Normal file
21
test/built-ins/Temporal/Calendar/prototype/daysInWeek/argument-string-with-utc-designator.js
vendored
Normal file
|
@ -0,0 +1,21 @@
|
|||
// Copyright (C) 2021 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: RangeError thrown if a string with UTC designator is used as a PlainDate
|
||||
features: [Temporal, arrow-function]
|
||||
---*/
|
||||
|
||||
const invalidStrings = [
|
||||
"2019-10-01T09:00:00Z",
|
||||
"2019-10-01T09:00:00Z[UTC]",
|
||||
];
|
||||
const instance = new Temporal.Calendar("iso8601");
|
||||
invalidStrings.forEach((arg) => {
|
||||
assert.throws(
|
||||
RangeError,
|
||||
() => instance.daysInWeek(arg),
|
||||
"String with UTC designator should not be valid as a PlainDate"
|
||||
);
|
||||
});
|
21
test/built-ins/Temporal/Calendar/prototype/daysInYear/argument-string-with-utc-designator.js
vendored
Normal file
21
test/built-ins/Temporal/Calendar/prototype/daysInYear/argument-string-with-utc-designator.js
vendored
Normal file
|
@ -0,0 +1,21 @@
|
|||
// Copyright (C) 2021 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: RangeError thrown if a string with UTC designator is used as a PlainDate
|
||||
features: [Temporal, arrow-function]
|
||||
---*/
|
||||
|
||||
const invalidStrings = [
|
||||
"2019-10-01T09:00:00Z",
|
||||
"2019-10-01T09:00:00Z[UTC]",
|
||||
];
|
||||
const instance = new Temporal.Calendar("iso8601");
|
||||
invalidStrings.forEach((arg) => {
|
||||
assert.throws(
|
||||
RangeError,
|
||||
() => instance.daysInYear(arg),
|
||||
"String with UTC designator should not be valid as a PlainDate"
|
||||
);
|
||||
});
|
21
test/built-ins/Temporal/Calendar/prototype/inLeapYear/argument-string-with-utc-designator.js
vendored
Normal file
21
test/built-ins/Temporal/Calendar/prototype/inLeapYear/argument-string-with-utc-designator.js
vendored
Normal file
|
@ -0,0 +1,21 @@
|
|||
// Copyright (C) 2021 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: RangeError thrown if a string with UTC designator is used as a PlainDate
|
||||
features: [Temporal, arrow-function]
|
||||
---*/
|
||||
|
||||
const invalidStrings = [
|
||||
"2019-10-01T09:00:00Z",
|
||||
"2019-10-01T09:00:00Z[UTC]",
|
||||
];
|
||||
const instance = new Temporal.Calendar("iso8601");
|
||||
invalidStrings.forEach((arg) => {
|
||||
assert.throws(
|
||||
RangeError,
|
||||
() => instance.inLeapYear(arg),
|
||||
"String with UTC designator should not be valid as a PlainDate"
|
||||
);
|
||||
});
|
21
test/built-ins/Temporal/Calendar/prototype/month/argument-string-with-utc-designator.js
vendored
Normal file
21
test/built-ins/Temporal/Calendar/prototype/month/argument-string-with-utc-designator.js
vendored
Normal file
|
@ -0,0 +1,21 @@
|
|||
// Copyright (C) 2021 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: RangeError thrown if a string with UTC designator is used as a PlainDate
|
||||
features: [Temporal, arrow-function]
|
||||
---*/
|
||||
|
||||
const invalidStrings = [
|
||||
"2019-10-01T09:00:00Z",
|
||||
"2019-10-01T09:00:00Z[UTC]",
|
||||
];
|
||||
const instance = new Temporal.Calendar("iso8601");
|
||||
invalidStrings.forEach((arg) => {
|
||||
assert.throws(
|
||||
RangeError,
|
||||
() => instance.month(arg),
|
||||
"String with UTC designator should not be valid as a PlainDate"
|
||||
);
|
||||
});
|
21
test/built-ins/Temporal/Calendar/prototype/monthCode/argument-string-with-utc-designator.js
vendored
Normal file
21
test/built-ins/Temporal/Calendar/prototype/monthCode/argument-string-with-utc-designator.js
vendored
Normal file
|
@ -0,0 +1,21 @@
|
|||
// Copyright (C) 2021 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: RangeError thrown if a string with UTC designator is used as a PlainDate
|
||||
features: [Temporal, arrow-function]
|
||||
---*/
|
||||
|
||||
const invalidStrings = [
|
||||
"2019-10-01T09:00:00Z",
|
||||
"2019-10-01T09:00:00Z[UTC]",
|
||||
];
|
||||
const instance = new Temporal.Calendar("iso8601");
|
||||
invalidStrings.forEach((arg) => {
|
||||
assert.throws(
|
||||
RangeError,
|
||||
() => instance.monthCode(arg),
|
||||
"String with UTC designator should not be valid as a PlainDate"
|
||||
);
|
||||
});
|
21
test/built-ins/Temporal/Calendar/prototype/monthsInYear/argument-string-with-utc-designator.js
vendored
Normal file
21
test/built-ins/Temporal/Calendar/prototype/monthsInYear/argument-string-with-utc-designator.js
vendored
Normal file
|
@ -0,0 +1,21 @@
|
|||
// Copyright (C) 2021 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: RangeError thrown if a string with UTC designator is used as a PlainDate
|
||||
features: [Temporal, arrow-function]
|
||||
---*/
|
||||
|
||||
const invalidStrings = [
|
||||
"2019-10-01T09:00:00Z",
|
||||
"2019-10-01T09:00:00Z[UTC]",
|
||||
];
|
||||
const instance = new Temporal.Calendar("iso8601");
|
||||
invalidStrings.forEach((arg) => {
|
||||
assert.throws(
|
||||
RangeError,
|
||||
() => instance.monthsInYear(arg),
|
||||
"String with UTC designator should not be valid as a PlainDate"
|
||||
);
|
||||
});
|
21
test/built-ins/Temporal/Calendar/prototype/weekOfYear/argument-string-with-utc-designator.js
vendored
Normal file
21
test/built-ins/Temporal/Calendar/prototype/weekOfYear/argument-string-with-utc-designator.js
vendored
Normal file
|
@ -0,0 +1,21 @@
|
|||
// Copyright (C) 2021 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: RangeError thrown if a string with UTC designator is used as a PlainDate
|
||||
features: [Temporal, arrow-function]
|
||||
---*/
|
||||
|
||||
const invalidStrings = [
|
||||
"2019-10-01T09:00:00Z",
|
||||
"2019-10-01T09:00:00Z[UTC]",
|
||||
];
|
||||
const instance = new Temporal.Calendar("iso8601");
|
||||
invalidStrings.forEach((arg) => {
|
||||
assert.throws(
|
||||
RangeError,
|
||||
() => instance.weekOfYear(arg),
|
||||
"String with UTC designator should not be valid as a PlainDate"
|
||||
);
|
||||
});
|
21
test/built-ins/Temporal/Calendar/prototype/year/argument-string-with-utc-designator.js
vendored
Normal file
21
test/built-ins/Temporal/Calendar/prototype/year/argument-string-with-utc-designator.js
vendored
Normal file
|
@ -0,0 +1,21 @@
|
|||
// Copyright (C) 2021 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: RangeError thrown if a string with UTC designator is used as a PlainDate
|
||||
features: [Temporal, arrow-function]
|
||||
---*/
|
||||
|
||||
const invalidStrings = [
|
||||
"2019-10-01T09:00:00Z",
|
||||
"2019-10-01T09:00:00Z[UTC]",
|
||||
];
|
||||
const instance = new Temporal.Calendar("iso8601");
|
||||
invalidStrings.forEach((arg) => {
|
||||
assert.throws(
|
||||
RangeError,
|
||||
() => instance.year(arg),
|
||||
"String with UTC designator should not be valid as a PlainDate"
|
||||
);
|
||||
});
|
|
@ -0,0 +1,26 @@
|
|||
// Copyright (C) 2021 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: RangeError thrown if a string with UTC designator is used as a PlainDate
|
||||
features: [Temporal, arrow-function]
|
||||
---*/
|
||||
|
||||
const invalidStrings = [
|
||||
"2019-10-01T09:00:00Z",
|
||||
"2019-10-01T09:00:00Z[UTC]",
|
||||
];
|
||||
const plainDate = new Temporal.PlainDate(2000, 5, 2);
|
||||
invalidStrings.forEach((arg) => {
|
||||
assert.throws(
|
||||
RangeError,
|
||||
() => Temporal.PlainDate.compare(arg, plainDate),
|
||||
"String with UTC designator should not be valid as a PlainDate (first argument)"
|
||||
);
|
||||
assert.throws(
|
||||
RangeError,
|
||||
() => Temporal.PlainDate.compare(plainDate, arg),
|
||||
"String with UTC designator should not be valid as a PlainDate (second argument)"
|
||||
);
|
||||
});
|
|
@ -0,0 +1,20 @@
|
|||
// Copyright (C) 2021 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: RangeError thrown if a string with UTC designator is used as a PlainDate
|
||||
features: [Temporal, arrow-function]
|
||||
---*/
|
||||
|
||||
const invalidStrings = [
|
||||
"2019-10-01T09:00:00Z",
|
||||
"2019-10-01T09:00:00Z[UTC]",
|
||||
];
|
||||
invalidStrings.forEach((arg) => {
|
||||
assert.throws(
|
||||
RangeError,
|
||||
() => Temporal.PlainDate.from(arg),
|
||||
"String with UTC designator should not be valid as a PlainDate"
|
||||
);
|
||||
});
|
21
test/built-ins/Temporal/PlainDate/prototype/equals/argument-string-with-utc-designator.js
vendored
Normal file
21
test/built-ins/Temporal/PlainDate/prototype/equals/argument-string-with-utc-designator.js
vendored
Normal file
|
@ -0,0 +1,21 @@
|
|||
// Copyright (C) 2021 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: RangeError thrown if a string with UTC designator is used as a PlainDate
|
||||
features: [Temporal, arrow-function]
|
||||
---*/
|
||||
|
||||
const invalidStrings = [
|
||||
"2019-10-01T09:00:00Z",
|
||||
"2019-10-01T09:00:00Z[UTC]",
|
||||
];
|
||||
const instance = new Temporal.PlainDate(2000, 5, 2);
|
||||
invalidStrings.forEach((arg) => {
|
||||
assert.throws(
|
||||
RangeError,
|
||||
() => instance.equals(arg),
|
||||
"String with UTC designator should not be valid as a PlainDate"
|
||||
);
|
||||
});
|
21
test/built-ins/Temporal/PlainDate/prototype/since/argument-string-with-utc-designator.js
vendored
Normal file
21
test/built-ins/Temporal/PlainDate/prototype/since/argument-string-with-utc-designator.js
vendored
Normal file
|
@ -0,0 +1,21 @@
|
|||
// Copyright (C) 2021 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: RangeError thrown if a string with UTC designator is used as a PlainDate
|
||||
features: [Temporal, arrow-function]
|
||||
---*/
|
||||
|
||||
const invalidStrings = [
|
||||
"2019-10-01T09:00:00Z",
|
||||
"2019-10-01T09:00:00Z[UTC]",
|
||||
];
|
||||
const instance = new Temporal.PlainDate(2000, 5, 2);
|
||||
invalidStrings.forEach((arg) => {
|
||||
assert.throws(
|
||||
RangeError,
|
||||
() => instance.since(arg),
|
||||
"String with UTC designator should not be valid as a PlainDate"
|
||||
);
|
||||
});
|
|
@ -0,0 +1,21 @@
|
|||
// Copyright (C) 2021 Igalia, S.L. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
esid: sec-temporal.plaindate.prototype.toplaindatetime
|
||||
description: RangeError thrown if a string with UTC designator is used as a PlainTime
|
||||
features: [Temporal, arrow-function]
|
||||
---*/
|
||||
|
||||
const invalidStrings = [
|
||||
"2019-10-01T09:00:00Z",
|
||||
"2019-10-01T09:00:00Z[UTC]",
|
||||
];
|
||||
const instance = new Temporal.PlainDate(2000, 5, 2);
|
||||
invalidStrings.forEach((arg) => {
|
||||
assert.throws(
|
||||
RangeError,
|
||||
() => instance.toPlainDateTime(arg),
|
||||
"String with UTC designator should not be valid as a PlainTime"
|
||||
);
|
||||
});
|
|
@ -0,0 +1,21 @@
|
|||
// Copyright (C) 2021 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: RangeError thrown if a string with UTC designator is used as a PlainTime
|
||||
features: [Temporal, arrow-function]
|
||||
---*/
|
||||
|
||||
const invalidStrings = [
|
||||
"2019-10-01T09:00:00Z",
|
||||
"2019-10-01T09:00:00Z[UTC]",
|
||||
];
|
||||
const instance = new Temporal.PlainDate(2000, 5, 2);
|
||||
invalidStrings.forEach((arg) => {
|
||||
assert.throws(
|
||||
RangeError,
|
||||
() => instance.toZonedDateTime({ plainTime: arg, timeZone: "UTC" }),
|
||||
"String with UTC designator should not be valid as a PlainTime"
|
||||
);
|
||||
});
|
21
test/built-ins/Temporal/PlainDate/prototype/until/argument-string-with-utc-designator.js
vendored
Normal file
21
test/built-ins/Temporal/PlainDate/prototype/until/argument-string-with-utc-designator.js
vendored
Normal file
|
@ -0,0 +1,21 @@
|
|||
// Copyright (C) 2021 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: RangeError thrown if a string with UTC designator is used as a PlainDate
|
||||
features: [Temporal, arrow-function]
|
||||
---*/
|
||||
|
||||
const invalidStrings = [
|
||||
"2019-10-01T09:00:00Z",
|
||||
"2019-10-01T09:00:00Z[UTC]",
|
||||
];
|
||||
const instance = new Temporal.PlainDate(2000, 5, 2);
|
||||
invalidStrings.forEach((arg) => {
|
||||
assert.throws(
|
||||
RangeError,
|
||||
() => instance.until(arg),
|
||||
"String with UTC designator should not be valid as a PlainDate"
|
||||
);
|
||||
});
|
|
@ -0,0 +1,26 @@
|
|||
// Copyright (C) 2021 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: RangeError thrown if a string with UTC designator is used as a PlainDateTime
|
||||
features: [Temporal, arrow-function]
|
||||
---*/
|
||||
|
||||
const invalidStrings = [
|
||||
"2019-10-01T09:00:00Z",
|
||||
"2019-10-01T09:00:00Z[UTC]",
|
||||
];
|
||||
const dateTime = new Temporal.PlainDateTime(2000, 5, 2);
|
||||
invalidStrings.forEach((arg) => {
|
||||
assert.throws(
|
||||
RangeError,
|
||||
() => Temporal.PlainDateTime.compare(arg, dateTime),
|
||||
"String with UTC designator should not be valid as a PlainDateTime (first argument)"
|
||||
);
|
||||
assert.throws(
|
||||
RangeError,
|
||||
() => Temporal.PlainDateTime.compare(arg, dateTime),
|
||||
"String with UTC designator should not be valid as a PlainDateTime (second argument)"
|
||||
);
|
||||
});
|
|
@ -0,0 +1,20 @@
|
|||
// Copyright (C) 2021 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: RangeError thrown if a string with UTC designator is used as a PlainDateTime
|
||||
features: [Temporal, arrow-function]
|
||||
---*/
|
||||
|
||||
const invalidStrings = [
|
||||
"2019-10-01T09:00:00Z",
|
||||
"2019-10-01T09:00:00Z[UTC]",
|
||||
];
|
||||
invalidStrings.forEach((arg) => {
|
||||
assert.throws(
|
||||
RangeError,
|
||||
() => Temporal.PlainDateTime.from(arg),
|
||||
"String with UTC designator should not be valid as a PlainDateTime"
|
||||
);
|
||||
});
|
21
test/built-ins/Temporal/PlainDateTime/prototype/equals/argument-string-with-utc-designator.js
vendored
Normal file
21
test/built-ins/Temporal/PlainDateTime/prototype/equals/argument-string-with-utc-designator.js
vendored
Normal file
|
@ -0,0 +1,21 @@
|
|||
// Copyright (C) 2021 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: RangeError thrown if a string with UTC designator is used as a PlainDateTime
|
||||
features: [Temporal, arrow-function]
|
||||
---*/
|
||||
|
||||
const invalidStrings = [
|
||||
"2019-10-01T09:00:00Z",
|
||||
"2019-10-01T09:00:00Z[UTC]",
|
||||
];
|
||||
const instance = new Temporal.PlainDateTime(2000, 5, 2, 12, 34, 56, 987, 654, 321);
|
||||
invalidStrings.forEach((arg) => {
|
||||
assert.throws(
|
||||
RangeError,
|
||||
() => instance.equals(arg),
|
||||
"String with UTC designator should not be valid as a PlainDateTime"
|
||||
);
|
||||
});
|
21
test/built-ins/Temporal/PlainDateTime/prototype/since/argument-string-with-utc-designator.js
vendored
Normal file
21
test/built-ins/Temporal/PlainDateTime/prototype/since/argument-string-with-utc-designator.js
vendored
Normal file
|
@ -0,0 +1,21 @@
|
|||
// Copyright (C) 2021 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: RangeError thrown if a string with UTC designator is used as a PlainDateTime
|
||||
features: [Temporal, arrow-function]
|
||||
---*/
|
||||
|
||||
const invalidStrings = [
|
||||
"2019-10-01T09:00:00Z",
|
||||
"2019-10-01T09:00:00Z[UTC]",
|
||||
];
|
||||
const instance = new Temporal.PlainDateTime(2000, 5, 2, 12, 34, 56, 987, 654, 321);
|
||||
invalidStrings.forEach((arg) => {
|
||||
assert.throws(
|
||||
RangeError,
|
||||
() => instance.since(arg),
|
||||
"String with UTC designator should not be valid as a PlainDateTime"
|
||||
);
|
||||
});
|
21
test/built-ins/Temporal/PlainDateTime/prototype/until/argument-string-with-utc-designator.js
vendored
Normal file
21
test/built-ins/Temporal/PlainDateTime/prototype/until/argument-string-with-utc-designator.js
vendored
Normal file
|
@ -0,0 +1,21 @@
|
|||
// Copyright (C) 2021 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: RangeError thrown if a string with UTC designator is used as a PlainDateTime
|
||||
features: [Temporal, arrow-function]
|
||||
---*/
|
||||
|
||||
const invalidStrings = [
|
||||
"2019-10-01T09:00:00Z",
|
||||
"2019-10-01T09:00:00Z[UTC]",
|
||||
];
|
||||
const instance = new Temporal.PlainDateTime(2000, 5, 2, 12, 34, 56, 987, 654, 321);
|
||||
invalidStrings.forEach((arg) => {
|
||||
assert.throws(
|
||||
RangeError,
|
||||
() => instance.until(arg),
|
||||
"String with UTC designator should not be valid as a PlainDateTime"
|
||||
);
|
||||
});
|
|
@ -0,0 +1,21 @@
|
|||
// Copyright (C) 2021 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: RangeError thrown if a string with UTC designator is used as a PlainDate
|
||||
features: [Temporal, arrow-function]
|
||||
---*/
|
||||
|
||||
const invalidStrings = [
|
||||
"2019-10-01T09:00:00Z",
|
||||
"2019-10-01T09:00:00Z[UTC]",
|
||||
];
|
||||
const instance = new Temporal.PlainDateTime(2000, 5, 2, 12, 34, 56, 987, 654, 321);
|
||||
invalidStrings.forEach((arg) => {
|
||||
assert.throws(
|
||||
RangeError,
|
||||
() => instance.withPlainDate(arg),
|
||||
"String with UTC designator should not be valid as a PlainDate"
|
||||
);
|
||||
});
|
|
@ -0,0 +1,21 @@
|
|||
// Copyright (C) 2021 Igalia, S.L. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
esid: sec-temporal.plaindatetime.prototype.withplaintime
|
||||
description: RangeError thrown if a string with UTC designator is used as a PlainTime
|
||||
features: [Temporal, arrow-function]
|
||||
---*/
|
||||
|
||||
const invalidStrings = [
|
||||
"2019-10-01T09:00:00Z",
|
||||
"2019-10-01T09:00:00Z[UTC]",
|
||||
];
|
||||
const instance = new Temporal.PlainDateTime(2000, 5, 2, 12, 34, 56, 987, 654, 321);
|
||||
invalidStrings.forEach((arg) => {
|
||||
assert.throws(
|
||||
RangeError,
|
||||
() => instance.withPlainTime(arg),
|
||||
"String with UTC designator should not be valid as a PlainTime"
|
||||
);
|
||||
});
|
|
@ -0,0 +1,20 @@
|
|||
// Copyright (C) 2021 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: RangeError thrown if a string with UTC designator is used as a PlainMonthDay
|
||||
features: [Temporal, arrow-function]
|
||||
---*/
|
||||
|
||||
const invalidStrings = [
|
||||
"2019-10-01T09:00:00Z",
|
||||
"2019-10-01T09:00:00Z[UTC]",
|
||||
];
|
||||
invalidStrings.forEach((arg) => {
|
||||
assert.throws(
|
||||
RangeError,
|
||||
() => Temporal.PlainMonthDay.from(arg),
|
||||
"String with UTC designator should not be valid as a PlainMonthDay"
|
||||
);
|
||||
});
|
|
@ -12,8 +12,6 @@ const tests = [
|
|||
"10-01",
|
||||
"1001",
|
||||
"1965-10-01",
|
||||
"2019-10-01T09:00:00Z",
|
||||
"2019-10-01T00:00:00Z",
|
||||
"1976-10-01T152330.1+00:00",
|
||||
"19761001T15:23:30.1+00:00",
|
||||
"1976-10-01T15:23:30.1+0000",
|
||||
|
@ -28,6 +26,7 @@ const tests = [
|
|||
"+0019761001T15:23:30.1+0000",
|
||||
"+0019761001T152330.1+00:00",
|
||||
"+0019761001T152330.1+0000",
|
||||
"1976-10-01T15:23:00",
|
||||
"1976-10-01T15:23",
|
||||
"1976-10-01T15",
|
||||
"1976-10-01",
|
||||
|
|
21
test/built-ins/Temporal/PlainMonthDay/prototype/equals/argument-string-with-utc-designator.js
vendored
Normal file
21
test/built-ins/Temporal/PlainMonthDay/prototype/equals/argument-string-with-utc-designator.js
vendored
Normal file
|
@ -0,0 +1,21 @@
|
|||
// Copyright (C) 2021 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: RangeError thrown if a string with UTC designator is used as a PlainMonthDay
|
||||
features: [Temporal, arrow-function]
|
||||
---*/
|
||||
|
||||
const invalidStrings = [
|
||||
"2019-10-01T09:00:00Z",
|
||||
"2019-10-01T09:00:00Z[UTC]",
|
||||
];
|
||||
const instance = new Temporal.PlainMonthDay(5, 2);
|
||||
invalidStrings.forEach((arg) => {
|
||||
assert.throws(
|
||||
RangeError,
|
||||
() => instance.equals(arg),
|
||||
"String with UTC designator should not be valid as a PlainMonthDay"
|
||||
);
|
||||
});
|
|
@ -0,0 +1,26 @@
|
|||
// Copyright (C) 2021 Igalia, S.L. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
esid: sec-temporal.plaintime.compare
|
||||
description: RangeError thrown if a string with UTC designator is used as a PlainTime
|
||||
features: [Temporal, arrow-function]
|
||||
---*/
|
||||
|
||||
const invalidStrings = [
|
||||
"2019-10-01T09:00:00Z",
|
||||
"2019-10-01T09:00:00Z[UTC]",
|
||||
];
|
||||
const plainTime = new Temporal.PlainTime();
|
||||
invalidStrings.forEach((arg) => {
|
||||
assert.throws(
|
||||
RangeError,
|
||||
() => Temporal.PlainTime.compare(arg, plainTime),
|
||||
"String with UTC designator should not be valid as a PlainTime (first argument)"
|
||||
);
|
||||
assert.throws(
|
||||
RangeError,
|
||||
() => Temporal.PlainTime.compare(plainTime, arg),
|
||||
"String with UTC designator should not be valid as a PlainTime (second argument)"
|
||||
);
|
||||
});
|
|
@ -0,0 +1,20 @@
|
|||
// Copyright (C) 2021 Igalia, S.L. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
esid: sec-temporal.plaintime.from
|
||||
description: RangeError thrown if a string with UTC designator is used as a PlainTime
|
||||
features: [Temporal, arrow-function]
|
||||
---*/
|
||||
|
||||
const invalidStrings = [
|
||||
"2019-10-01T09:00:00Z",
|
||||
"2019-10-01T09:00:00Z[UTC]",
|
||||
];
|
||||
invalidStrings.forEach((arg) => {
|
||||
assert.throws(
|
||||
RangeError,
|
||||
() => Temporal.PlainTime.from(arg),
|
||||
"String with UTC designator should not be valid as a PlainTime"
|
||||
);
|
||||
});
|
21
test/built-ins/Temporal/PlainTime/prototype/equals/argument-string-with-utc-designator.js
vendored
Normal file
21
test/built-ins/Temporal/PlainTime/prototype/equals/argument-string-with-utc-designator.js
vendored
Normal file
|
@ -0,0 +1,21 @@
|
|||
// Copyright (C) 2021 Igalia, S.L. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
esid: sec-temporal.plaintime.prototype.equals
|
||||
description: RangeError thrown if a string with UTC designator is used as a PlainTime
|
||||
features: [Temporal, arrow-function]
|
||||
---*/
|
||||
|
||||
const invalidStrings = [
|
||||
"2019-10-01T09:00:00Z",
|
||||
"2019-10-01T09:00:00Z[UTC]",
|
||||
];
|
||||
const instance = new Temporal.PlainTime(12, 34, 56, 987, 654, 321);
|
||||
invalidStrings.forEach((arg) => {
|
||||
assert.throws(
|
||||
RangeError,
|
||||
() => instance.equals(arg),
|
||||
"String with UTC designator should not be valid as a PlainTime"
|
||||
);
|
||||
});
|
21
test/built-ins/Temporal/PlainTime/prototype/since/argument-string-with-utc-designator.js
vendored
Normal file
21
test/built-ins/Temporal/PlainTime/prototype/since/argument-string-with-utc-designator.js
vendored
Normal file
|
@ -0,0 +1,21 @@
|
|||
// Copyright (C) 2021 Igalia, S.L. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
esid: sec-temporal.plaintime.prototype.since
|
||||
description: RangeError thrown if a string with UTC designator is used as a PlainTime
|
||||
features: [Temporal, arrow-function]
|
||||
---*/
|
||||
|
||||
const invalidStrings = [
|
||||
"2019-10-01T09:00:00Z",
|
||||
"2019-10-01T09:00:00Z[UTC]",
|
||||
];
|
||||
const instance = new Temporal.PlainTime(12, 34, 56, 987, 654, 321);
|
||||
invalidStrings.forEach((arg) => {
|
||||
assert.throws(
|
||||
RangeError,
|
||||
() => instance.since(arg),
|
||||
"String with UTC designator should not be valid as a PlainTime"
|
||||
);
|
||||
});
|
|
@ -0,0 +1,21 @@
|
|||
// Copyright (C) 2021 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: RangeError thrown if a string with UTC designator is used as a PlainDate
|
||||
features: [Temporal, arrow-function]
|
||||
---*/
|
||||
|
||||
const invalidStrings = [
|
||||
"2019-10-01T09:00:00Z",
|
||||
"2019-10-01T09:00:00Z[UTC]",
|
||||
];
|
||||
const instance = new Temporal.PlainTime(12, 34, 56, 987, 654, 321);
|
||||
invalidStrings.forEach((arg) => {
|
||||
assert.throws(
|
||||
RangeError,
|
||||
() => instance.toPlainDateTime(arg),
|
||||
"String with UTC designator should not be valid as a PlainDate"
|
||||
);
|
||||
});
|
|
@ -0,0 +1,21 @@
|
|||
// Copyright (C) 2021 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: RangeError thrown if a string with UTC designator is used as a PlainDate
|
||||
features: [Temporal, arrow-function]
|
||||
---*/
|
||||
|
||||
const invalidStrings = [
|
||||
"2019-10-01T09:00:00Z",
|
||||
"2019-10-01T09:00:00Z[UTC]",
|
||||
];
|
||||
const instance = new Temporal.PlainTime(12, 34, 56, 987, 654, 321);
|
||||
invalidStrings.forEach((arg) => {
|
||||
assert.throws(
|
||||
RangeError,
|
||||
() => instance.toZonedDateTime({ plainDate: arg }),
|
||||
"String with UTC designator should not be valid as a PlainDate"
|
||||
);
|
||||
});
|
21
test/built-ins/Temporal/PlainTime/prototype/until/argument-string-with-utc-designator.js
vendored
Normal file
21
test/built-ins/Temporal/PlainTime/prototype/until/argument-string-with-utc-designator.js
vendored
Normal file
|
@ -0,0 +1,21 @@
|
|||
// Copyright (C) 2021 Igalia, S.L. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
esid: sec-temporal.plaintime.prototype.until
|
||||
description: RangeError thrown if a string with UTC designator is used as a PlainTime
|
||||
features: [Temporal, arrow-function]
|
||||
---*/
|
||||
|
||||
const invalidStrings = [
|
||||
"2019-10-01T09:00:00Z",
|
||||
"2019-10-01T09:00:00Z[UTC]",
|
||||
];
|
||||
const instance = new Temporal.PlainTime(12, 34, 56, 987, 654, 321);
|
||||
invalidStrings.forEach((arg) => {
|
||||
assert.throws(
|
||||
RangeError,
|
||||
() => instance.until(arg),
|
||||
"String with UTC designator should not be valid as a PlainTime"
|
||||
);
|
||||
});
|
|
@ -0,0 +1,26 @@
|
|||
// Copyright (C) 2021 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: RangeError thrown if a string with UTC designator is used as a PlainYearMonth
|
||||
features: [Temporal, arrow-function]
|
||||
---*/
|
||||
|
||||
const invalidStrings = [
|
||||
"2019-10-01T09:00:00Z",
|
||||
"2019-10-01T09:00:00Z[UTC]",
|
||||
];
|
||||
const yearMonth = new Temporal.PlainYearMonth(2000, 5);
|
||||
invalidStrings.forEach((arg) => {
|
||||
assert.throws(
|
||||
RangeError,
|
||||
() => Temporal.PlainYearMonth.compare(arg, yearMonth),
|
||||
"String with UTC designator should not be valid as a PlainYearMonth (first argument)"
|
||||
);
|
||||
assert.throws(
|
||||
RangeError,
|
||||
() => Temporal.PlainYearMonth.compare(yearMonth, arg),
|
||||
"String with UTC designator should not be valid as a PlainYearMonth (second argument)"
|
||||
);
|
||||
});
|
|
@ -0,0 +1,20 @@
|
|||
// Copyright (C) 2021 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: RangeError thrown if a string with UTC designator is used as a PlainYearMonth
|
||||
features: [Temporal, arrow-function]
|
||||
---*/
|
||||
|
||||
const invalidStrings = [
|
||||
"2019-10-01T09:00:00Z",
|
||||
"2019-10-01T09:00:00Z[UTC]",
|
||||
];
|
||||
invalidStrings.forEach((arg) => {
|
||||
assert.throws(
|
||||
RangeError,
|
||||
() => Temporal.PlainYearMonth.from(arg),
|
||||
"String with UTC designator should not be valid as a PlainYearMonth"
|
||||
);
|
||||
});
|
21
test/built-ins/Temporal/PlainYearMonth/prototype/equals/argument-string-with-utc-designator.js
vendored
Normal file
21
test/built-ins/Temporal/PlainYearMonth/prototype/equals/argument-string-with-utc-designator.js
vendored
Normal file
|
@ -0,0 +1,21 @@
|
|||
// Copyright (C) 2021 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: RangeError thrown if a string with UTC designator is used as a PlainYearMonth
|
||||
features: [Temporal, arrow-function]
|
||||
---*/
|
||||
|
||||
const invalidStrings = [
|
||||
"2019-10-01T09:00:00Z",
|
||||
"2019-10-01T09:00:00Z[UTC]",
|
||||
];
|
||||
const instance = new Temporal.PlainYearMonth(2000, 5);
|
||||
invalidStrings.forEach((arg) => {
|
||||
assert.throws(
|
||||
RangeError,
|
||||
() => instance.equals(arg),
|
||||
"String with UTC designator should not be valid as a PlainYearMonth"
|
||||
);
|
||||
});
|
21
test/built-ins/Temporal/PlainYearMonth/prototype/since/argument-string-with-utc-designator.js
vendored
Normal file
21
test/built-ins/Temporal/PlainYearMonth/prototype/since/argument-string-with-utc-designator.js
vendored
Normal file
|
@ -0,0 +1,21 @@
|
|||
// Copyright (C) 2021 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: RangeError thrown if a string with UTC designator is used as a PlainYearMonth
|
||||
features: [Temporal, arrow-function]
|
||||
---*/
|
||||
|
||||
const invalidStrings = [
|
||||
"2019-10-01T09:00:00Z",
|
||||
"2019-10-01T09:00:00Z[UTC]",
|
||||
];
|
||||
const instance = new Temporal.PlainYearMonth(2000, 5);
|
||||
invalidStrings.forEach((arg) => {
|
||||
assert.throws(
|
||||
RangeError,
|
||||
() => instance.since(arg),
|
||||
"String with UTC designator should not be valid as a PlainYearMonth"
|
||||
);
|
||||
});
|
21
test/built-ins/Temporal/PlainYearMonth/prototype/until/argument-string-with-utc-designator.js
vendored
Normal file
21
test/built-ins/Temporal/PlainYearMonth/prototype/until/argument-string-with-utc-designator.js
vendored
Normal file
|
@ -0,0 +1,21 @@
|
|||
// Copyright (C) 2021 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: RangeError thrown if a string with UTC designator is used as a PlainYearMonth
|
||||
features: [Temporal, arrow-function]
|
||||
---*/
|
||||
|
||||
const invalidStrings = [
|
||||
"2019-10-01T09:00:00Z",
|
||||
"2019-10-01T09:00:00Z[UTC]",
|
||||
];
|
||||
const instance = new Temporal.PlainYearMonth(2000, 5);
|
||||
invalidStrings.forEach((arg) => {
|
||||
assert.throws(
|
||||
RangeError,
|
||||
() => instance.until(arg),
|
||||
"String with UTC designator should not be valid as a PlainYearMonth"
|
||||
);
|
||||
});
|
21
test/built-ins/Temporal/TimeZone/prototype/getInstantFor/argument-string-with-utc-designator.js
vendored
Normal file
21
test/built-ins/Temporal/TimeZone/prototype/getInstantFor/argument-string-with-utc-designator.js
vendored
Normal file
|
@ -0,0 +1,21 @@
|
|||
// Copyright (C) 2021 Igalia, S.L. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
esid: sec-temporal.timezone.prototype.getinstantfor
|
||||
description: RangeError thrown if a string with UTC designator is used as a PlainDateTime
|
||||
features: [Temporal, arrow-function]
|
||||
---*/
|
||||
|
||||
const invalidStrings = [
|
||||
"2019-10-01T09:00:00Z",
|
||||
"2019-10-01T09:00:00Z[UTC]",
|
||||
];
|
||||
const instance = new Temporal.TimeZone("UTC");
|
||||
invalidStrings.forEach((arg) => {
|
||||
assert.throws(
|
||||
RangeError,
|
||||
() => instance.getInstantFor(arg),
|
||||
"String with UTC designator should not be valid as a PlainDateTime"
|
||||
);
|
||||
});
|
|
@ -0,0 +1,21 @@
|
|||
// Copyright (C) 2021 Igalia, S.L. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
esid: sec-temporal.timezone.prototype.getpossibleinstantsfor
|
||||
description: RangeError thrown if a string with UTC designator is used as a PlainDateTime
|
||||
features: [Temporal, arrow-function]
|
||||
---*/
|
||||
|
||||
const invalidStrings = [
|
||||
"2019-10-01T09:00:00Z",
|
||||
"2019-10-01T09:00:00Z[UTC]",
|
||||
];
|
||||
const instance = new Temporal.TimeZone("UTC");
|
||||
invalidStrings.forEach((arg) => {
|
||||
assert.throws(
|
||||
RangeError,
|
||||
() => instance.getPossibleInstantsFor(arg),
|
||||
"String with UTC designator should not be valid as a PlainDateTime"
|
||||
);
|
||||
});
|
|
@ -0,0 +1,21 @@
|
|||
// Copyright (C) 2021 Igalia, S.L. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
esid: sec-temporal.zoneddatetime.prototype.withplaindate
|
||||
description: RangeError thrown if a string with UTC designator is used as a PlainDate
|
||||
features: [Temporal, arrow-function]
|
||||
---*/
|
||||
|
||||
const invalidStrings = [
|
||||
"2019-10-01T09:00:00Z",
|
||||
"2019-10-01T09:00:00Z[UTC]",
|
||||
];
|
||||
const instance = new Temporal.ZonedDateTime(1_000_000_000_000_000_000n, "UTC");
|
||||
invalidStrings.forEach((arg) => {
|
||||
assert.throws(
|
||||
RangeError,
|
||||
() => instance.withPlainDate(arg),
|
||||
"String with UTC designator should not be valid as a PlainDate"
|
||||
);
|
||||
});
|
|
@ -0,0 +1,21 @@
|
|||
// Copyright (C) 2021 Igalia, S.L. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
esid: sec-temporal.zoneddatetime.prototype.withplaintime
|
||||
description: RangeError thrown if a string with UTC designator is used as a PlainTime
|
||||
features: [Temporal, arrow-function]
|
||||
---*/
|
||||
|
||||
const invalidStrings = [
|
||||
"2019-10-01T09:00:00Z",
|
||||
"2019-10-01T09:00:00Z[UTC]",
|
||||
];
|
||||
const instance = new Temporal.ZonedDateTime(1_000_000_000_000_000_000n, "UTC");
|
||||
invalidStrings.forEach((arg) => {
|
||||
assert.throws(
|
||||
RangeError,
|
||||
() => instance.withPlainTime(arg),
|
||||
"String with UTC designator should not be valid as a PlainTime"
|
||||
);
|
||||
});
|
21
test/intl402/Temporal/Calendar/prototype/era/argument-string-with-utc-designator.js
vendored
Normal file
21
test/intl402/Temporal/Calendar/prototype/era/argument-string-with-utc-designator.js
vendored
Normal file
|
@ -0,0 +1,21 @@
|
|||
// Copyright (C) 2021 Igalia, S.L. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
esid: sec-temporal.calendar.prototype.era
|
||||
description: RangeError thrown if a string with UTC designator is used as a PlainDate
|
||||
features: [Temporal, arrow-function]
|
||||
---*/
|
||||
|
||||
const invalidStrings = [
|
||||
"2019-10-01T09:00:00Z",
|
||||
"2019-10-01T09:00:00Z[UTC]",
|
||||
];
|
||||
const instance = new Temporal.Calendar("iso8601");
|
||||
invalidStrings.forEach((arg) => {
|
||||
assert.throws(
|
||||
RangeError,
|
||||
() => instance.era(arg),
|
||||
"String with UTC designator should not be valid as a PlainDate"
|
||||
);
|
||||
});
|
21
test/intl402/Temporal/Calendar/prototype/eraYear/argument-string-with-utc-designator.js
vendored
Normal file
21
test/intl402/Temporal/Calendar/prototype/eraYear/argument-string-with-utc-designator.js
vendored
Normal file
|
@ -0,0 +1,21 @@
|
|||
// Copyright (C) 2021 Igalia, S.L. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
esid: sec-temporal.calendar.prototype.erayear
|
||||
description: RangeError thrown if a string with UTC designator is used as a PlainDate
|
||||
features: [Temporal, arrow-function]
|
||||
---*/
|
||||
|
||||
const invalidStrings = [
|
||||
"2019-10-01T09:00:00Z",
|
||||
"2019-10-01T09:00:00Z[UTC]",
|
||||
];
|
||||
const instance = new Temporal.Calendar("iso8601");
|
||||
invalidStrings.forEach((arg) => {
|
||||
assert.throws(
|
||||
RangeError,
|
||||
() => instance.eraYear(arg),
|
||||
"String with UTC designator should not be valid as a PlainDate"
|
||||
);
|
||||
});
|
Loading…
Reference in New Issue