You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
2. If unit is "year", "month", or "week", and relativeTo is undefined, then
a. Throw a RangeError exception.
Looking at codecov, the "year" branch of this check is tested but the "month" and "week" branches are not.
For "month" and "week", AFAICT Temporal.Duration.prototype.total and Temporal.Duration.prototype.round are the only callers of RoundDuration which could possibly have relativeTo undefined and could use "month" or "week". And both of those callers will call UnbalanceDateDurationRelative before calling RoundDuration. UnbalanceDateDurationRelative includes the same validation and RangeError-throwing for a missing relativeTo, which explains the codecov result.
Should the test in RoundDuration be an assertion instead for "month" and "week"?
Or should UnbalanceDateDurationRelative validate "year" too and RoundDuration should change to an assertion in all cases, including "year"?
Or is there another caller of RoundDuration that doesn't call UnbalanceDateDurationRelative and which can trigger this RangeError?
The text was updated successfully, but these errors were encountered:
Meeting 2023-08-17: Let's leave this issue open until all the Duration-related outstanding changes are merged, then we can see if this is still unreachable. If it is, then change it to an assertion for "month" and "week" cases.
(That said, we should still look for other coverage gaps using codecov; but it seems like codecov stopped updating 4 months ago. Might be related to #2931.)
RoundDuration currently includes this text:
Looking at codecov, the "year" branch of this check is tested but the "month" and "week" branches are not.
For "month" and "week", AFAICT Temporal.Duration.prototype.total and Temporal.Duration.prototype.round are the only callers of RoundDuration which could possibly have
relativeTo
undefined and could use "month" or "week". And both of those callers will call UnbalanceDateDurationRelative before calling RoundDuration. UnbalanceDateDurationRelative includes the same validation and RangeError-throwing for a missingrelativeTo
, which explains the codecov result.Should the test in RoundDuration be an assertion instead for "month" and "week"?
Or should UnbalanceDateDurationRelative validate "year" too and RoundDuration should change to an assertion in all cases, including "year"?
Or is there another caller of RoundDuration that doesn't call UnbalanceDateDurationRelative and which can trigger this RangeError?
The text was updated successfully, but these errors were encountered: