mirror of https://github.com/tc39/test262.git
Temporal: Override getPossibleInstantsFor to narrow down exception
In order for some tests to ensure that they are testing the right exception, we need to make sure we are in the path where there are no possible instants for a particular date-time. Override this method in some tests.
This commit is contained in:
parent
aa3afd1c28
commit
65b51e0769
|
@ -12,5 +12,8 @@ includes: [temporalHelpers.js]
|
|||
const timeZone = TemporalHelpers.specificOffsetTimeZone(wrongOffset);
|
||||
const date = new Temporal.PlainDate(2000, 5, 2);
|
||||
const plainTime = new Temporal.PlainTime(12, 34, 56, 987, 654, 321);
|
||||
timeZone.getPossibleInstantsFor = function () {
|
||||
return [];
|
||||
};
|
||||
assert.throws(RangeError, () => date.toZonedDateTime({ plainTime, timeZone }));
|
||||
});
|
||||
|
|
|
@ -12,5 +12,8 @@ includes: [temporalHelpers.js]
|
|||
const timeZone = TemporalHelpers.specificOffsetTimeZone(wrongOffset);
|
||||
const date = new Temporal.PlainDate(2000, 5, 2);
|
||||
const plainTime = new Temporal.PlainTime(12, 34, 56, 987, 654, 321);
|
||||
timeZone.getPossibleInstantsFor = function () {
|
||||
return [];
|
||||
};
|
||||
assert.throws(RangeError, () => date.toZonedDateTime({ plainTime, timeZone }));
|
||||
});
|
||||
|
|
|
@ -21,5 +21,8 @@ includes: [temporalHelpers.js]
|
|||
const timeZone = TemporalHelpers.specificOffsetTimeZone(wrongOffset);
|
||||
const date = new Temporal.PlainDate(2000, 5, 2);
|
||||
const plainTime = new Temporal.PlainTime(12, 34, 56, 987, 654, 321);
|
||||
timeZone.getPossibleInstantsFor = function () {
|
||||
return [];
|
||||
};
|
||||
assert.throws(TypeError, () => date.toZonedDateTime({ plainTime, timeZone }));
|
||||
});
|
||||
|
|
|
@ -11,5 +11,8 @@ includes: [temporalHelpers.js]
|
|||
[3600_000_000_000.5, NaN, -Infinity, Infinity].forEach((wrongOffset) => {
|
||||
const timeZone = TemporalHelpers.specificOffsetTimeZone(wrongOffset);
|
||||
const datetime = new Temporal.PlainDateTime(2000, 5, 2, 12, 34, 56, 987, 654, 321);
|
||||
timeZone.getPossibleInstantsFor = function () {
|
||||
return [];
|
||||
};
|
||||
assert.throws(RangeError, () => datetime.toZonedDateTime(timeZone));
|
||||
});
|
||||
|
|
|
@ -11,5 +11,8 @@ includes: [temporalHelpers.js]
|
|||
[-86400_000_000_001, 86400_000_000_001].forEach((wrongOffset) => {
|
||||
const timeZone = TemporalHelpers.specificOffsetTimeZone(wrongOffset);
|
||||
const datetime = new Temporal.PlainDateTime(2000, 5, 2, 12, 34, 56, 987, 654, 321);
|
||||
timeZone.getPossibleInstantsFor = function () {
|
||||
return [];
|
||||
};
|
||||
assert.throws(RangeError, () => datetime.toZonedDateTime(timeZone));
|
||||
});
|
||||
|
|
|
@ -20,5 +20,8 @@ includes: [temporalHelpers.js]
|
|||
].forEach((wrongOffset) => {
|
||||
const timeZone = TemporalHelpers.specificOffsetTimeZone(wrongOffset);
|
||||
const datetime = new Temporal.PlainDateTime(2000, 5, 2, 12, 34, 56, 987, 654, 321);
|
||||
timeZone.getPossibleInstantsFor = function () {
|
||||
return [];
|
||||
};
|
||||
assert.throws(TypeError, () => datetime.toZonedDateTime(timeZone));
|
||||
});
|
||||
|
|
|
@ -12,5 +12,8 @@ includes: [temporalHelpers.js]
|
|||
const timeZone = TemporalHelpers.specificOffsetTimeZone(wrongOffset);
|
||||
const time = new Temporal.PlainTime(12, 34, 56, 987, 654, 321);
|
||||
const plainDate = new Temporal.PlainDate(2000, 5, 2);
|
||||
timeZone.getPossibleInstantsFor = function () {
|
||||
return [];
|
||||
};
|
||||
assert.throws(RangeError, () => time.toZonedDateTime({ plainDate, timeZone }));
|
||||
});
|
||||
|
|
|
@ -12,5 +12,8 @@ includes: [temporalHelpers.js]
|
|||
const timeZone = TemporalHelpers.specificOffsetTimeZone(wrongOffset);
|
||||
const time = new Temporal.PlainTime(12, 34, 56, 987, 654, 321);
|
||||
const plainDate = new Temporal.PlainDate(2000, 5, 2);
|
||||
timeZone.getPossibleInstantsFor = function () {
|
||||
return [];
|
||||
};
|
||||
assert.throws(RangeError, () => time.toZonedDateTime({ plainDate, timeZone }));
|
||||
});
|
||||
|
|
|
@ -21,5 +21,8 @@ includes: [temporalHelpers.js]
|
|||
const timeZone = TemporalHelpers.specificOffsetTimeZone(wrongOffset);
|
||||
const time = new Temporal.PlainTime(12, 34, 56, 987, 654, 321);
|
||||
const plainDate = new Temporal.PlainDate(2000, 5, 2);
|
||||
timeZone.getPossibleInstantsFor = function () {
|
||||
return [];
|
||||
};
|
||||
assert.throws(TypeError, () => time.toZonedDateTime({ plainDate, timeZone }));
|
||||
});
|
||||
|
|
|
@ -11,5 +11,8 @@ includes: [temporalHelpers.js]
|
|||
[3600_000_000_000.5, NaN, -Infinity, Infinity].forEach((wrongOffset) => {
|
||||
const timeZone = TemporalHelpers.specificOffsetTimeZone(wrongOffset);
|
||||
const datetime = new Temporal.ZonedDateTime(1_000_000_000_987_654_321n, "UTC");
|
||||
timeZone.getPossibleInstantsFor = function () {
|
||||
return [];
|
||||
};
|
||||
assert.throws(RangeError, () => datetime.equals({ year: 2000, month: 5, day: 2, hour: 12, timeZone }));
|
||||
});
|
||||
|
|
|
@ -11,5 +11,8 @@ includes: [temporalHelpers.js]
|
|||
[-86400_000_000_001, 86400_000_000_001].forEach((wrongOffset) => {
|
||||
const timeZone = TemporalHelpers.specificOffsetTimeZone(wrongOffset);
|
||||
const datetime = new Temporal.ZonedDateTime(1_000_000_000_987_654_321n, "UTC");
|
||||
timeZone.getPossibleInstantsFor = function () {
|
||||
return [];
|
||||
};
|
||||
assert.throws(RangeError, () => datetime.equals({ year: 2000, month: 5, day: 2, hour: 12, timeZone }));
|
||||
});
|
||||
|
|
|
@ -20,5 +20,8 @@ includes: [temporalHelpers.js]
|
|||
].forEach((wrongOffset) => {
|
||||
const timeZone = TemporalHelpers.specificOffsetTimeZone(wrongOffset);
|
||||
const datetime = new Temporal.ZonedDateTime(1_000_000_000_987_654_321n, "UTC");
|
||||
timeZone.getPossibleInstantsFor = function () {
|
||||
return [];
|
||||
};
|
||||
assert.throws(TypeError, () => datetime.equals({ year: 2000, month: 5, day: 2, hour: 12, timeZone }));
|
||||
});
|
||||
|
|
Loading…
Reference in New Issue