mirror of
https://github.com/tc39/test262.git
synced 2025-07-23 22:15:24 +02:00
Fix invocations of some Temporal methods
We should make sure that we are providing the correct arguments to these methods even if they are supposed to throw; they should throw for the reason we expect, and not because we provided the wrong arguments.
This commit is contained in:
parent
c82e2782e6
commit
4fdb4ee52f
@ -55,7 +55,7 @@ const instance = new Temporal.Calendar("iso8601");
|
|||||||
for (const arg of invalidStrings) {
|
for (const arg of invalidStrings) {
|
||||||
assert.throws(
|
assert.throws(
|
||||||
RangeError,
|
RangeError,
|
||||||
() => instance.dateAdd(arg),
|
() => instance.dateAdd(arg, new Temporal.Duration()),
|
||||||
`"${arg}" should not be a valid ISO string for a PlainDate`
|
`"${arg}" should not be a valid ISO string for a PlainDate`
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -15,7 +15,7 @@ const instance = new Temporal.Calendar("iso8601");
|
|||||||
invalidStrings.forEach((arg) => {
|
invalidStrings.forEach((arg) => {
|
||||||
assert.throws(
|
assert.throws(
|
||||||
RangeError,
|
RangeError,
|
||||||
() => instance.dateAdd(arg),
|
() => instance.dateAdd(arg, new Temporal.Duration()),
|
||||||
"String with UTC designator should not be valid as a PlainDate"
|
"String with UTC designator should not be valid as a PlainDate"
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
@ -12,6 +12,6 @@ const instance = new Temporal.Calendar("iso8601");
|
|||||||
|
|
||||||
assert.throws(
|
assert.throws(
|
||||||
RangeError,
|
RangeError,
|
||||||
() => { instance.dateAdd(arg); },
|
() => { instance.dateAdd(arg, new Temporal.Duration()); },
|
||||||
"reject minus zero as extended year"
|
"reject minus zero as extended year"
|
||||||
);
|
);
|
||||||
|
@ -55,7 +55,7 @@ const instance = new Temporal.PlainTime(12, 34, 56, 987, 654, 321);
|
|||||||
for (const arg of invalidStrings) {
|
for (const arg of invalidStrings) {
|
||||||
assert.throws(
|
assert.throws(
|
||||||
RangeError,
|
RangeError,
|
||||||
() => instance.toZonedDateTime({ plainDate: arg }),
|
() => instance.toZonedDateTime({ plainDate: arg, timeZone: "UTC" }),
|
||||||
`"${arg}" should not be a valid ISO string for a PlainDate`
|
`"${arg}" should not be a valid ISO string for a PlainDate`
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -15,7 +15,7 @@ const instance = new Temporal.PlainTime(12, 34, 56, 987, 654, 321);
|
|||||||
invalidStrings.forEach((arg) => {
|
invalidStrings.forEach((arg) => {
|
||||||
assert.throws(
|
assert.throws(
|
||||||
RangeError,
|
RangeError,
|
||||||
() => instance.toZonedDateTime({ plainDate: arg }),
|
() => instance.toZonedDateTime({ plainDate: arg, timeZone: "UTC" }),
|
||||||
"String with UTC designator should not be valid as a PlainDate"
|
"String with UTC designator should not be valid as a PlainDate"
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
@ -12,6 +12,6 @@ const instance = new Temporal.PlainTime(12, 34, 56, 987, 654, 321);
|
|||||||
|
|
||||||
assert.throws(
|
assert.throws(
|
||||||
RangeError,
|
RangeError,
|
||||||
() => { instance.toZonedDateTime({ plainDate: arg }); },
|
() => { instance.toZonedDateTime({ plainDate: arg, timeZone: "UTC" }); },
|
||||||
"reject minus zero as extended year"
|
"reject minus zero as extended year"
|
||||||
);
|
);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user