605 Commits

Author SHA1 Message Date
Philip Chimento
5c07b52242 Temporal: Remove accidental octal literals from a test
These cause the test to fail in strict mode.
2025-11-06 11:32:55 +01:00
Tim Chevalier
aa62607560 Fix indentation 2025-11-04 12:52:31 -08:00
Tim Chevalier
67ccaf966a Avoid creating extra objects 2025-11-04 12:52:31 -08:00
Tim Chevalier
88c06fe752 Update test/built-ins/Temporal/Instant/prototype/toString/negative-instant-rounding.js
Co-authored-by: Ms2ger <Ms2ger@gmail.com>
2025-11-04 12:52:31 -08:00
Tim Chevalier
d50ce09c59 Fix lint errors 2025-11-04 12:52:31 -08:00
Tim Chevalier
f1828f3ebf Add tests that trigger the same bug from Instant.toString and ZonedDateTime.toString 2025-11-04 12:52:31 -08:00
Tim Chevalier
ef55820458 Add tests for PlainDateTime and ZonedDateTime as well 2025-11-04 12:52:31 -08:00
Tim Chevalier
4d9f01fcf4 Temporal: Add a test for rounding negative instants 2025-11-04 12:52:31 -08:00
Philip Chimento
6600ea1042 Temporal: Add coverage for another large-subseconds addition bug
Bug observed in the proposal-temporal reference code, caused by improper
implementation of AddTime
(https://tc39.es/proposal-temporal/#sec-temporal-addtime) where the
advice in Step 2 was not followed correctly.

See https://github.com/tc39/proposal-temporal/pull/3173
2025-11-03 11:35:50 +01:00
Philip Chimento
d8c989cc8a Temporal: Consolidate "large-subseconds" and "large-milliseconds" tests
These (from #4619 and #4625) are very similar and I'm also going to add
more cases to them in the next commit.

Also add similar tests to Instant and PlainTime.
2025-11-03 11:35:50 +01:00
Philip Chimento
a9251b7718 Temporal: Add tests for internal representation of Duration
The spec describes the internal representation of Duration as float64-
representable integers. There are a few tricky ways that it is
observable if an implementation does not do this correctly. Here are
some tests for them.
2025-11-03 10:30:08 +01:00
Tim Chevalier
66bf8b8b52
Temporal: Add coverage for adding durations with large subsecond values to a PlainTime (#4625)
* Temporal: Add coverage for adding durations with large subsecond values to a PlainTime

* Add tests for PlainDateTime and ZonedDateTime
2025-10-31 13:36:32 -07:00
Tim Chevalier
678c434dab Temporal: Add tests for correct rounding of epoch milliseconds in toString() 2025-10-31 11:36:50 +01:00
Philip Chimento
18f6ed2627 Add missing quotation mark in assertion message 2025-10-30 17:51:51 +01:00
Philip Chimento
0e496d5808 Minor updates to text in Temporal calendar-wrong-type tests
These were missed in https://github.com/tc39/test262/pull/4415
2025-10-30 17:51:51 +01:00
Philip Chimento
85ae4c0966 Temporal: Add tests for optional properties in property bags
These tests confirm that Temporal-object-like property bags have the
correct default values for their optional properties.

This provides coverage for a V8 bug:
https://issues.chromium.org/issues/446728405
2025-10-30 17:40:54 +01:00
Philip Chimento
e72321987e Temporal: Add tests for serialization of durations with pairs of units
These check that durations with large and small units are properly
serialized.
2025-10-30 16:27:33 +01:00
Tim Chevalier
61d0eb9167
Temporal: Add an overflow test for date addition with maximum year (#4618)
* Temporal: Add an overflow test for date addition with maximum year

* Add tests for other cases

* Fix minimum dates

* Add cases for adding/subtracting the negated duration to the opposite end of the allowed years
2025-10-29 18:04:05 -07:00
Tim Chevalier
759fe87f1c Temporal: Add coverage for adding large microseconds/nanoseconds values
Add coverage for adding unbalanced durations with large microseconds
or nanoseconds values to a PlainDateTime or ZonedDateTime.
2025-10-29 17:30:09 -07:00
Richard Gibson
687cf880eb
Temporal: Add tests for PlainMonthDay.from with month and invalid monthCode (#4597) 2025-10-15 18:56:49 +00:00
Philip Chimento
af3d908437 Temporal: Add tests covering one operand of ZonedDateTime difference at extreme
These tests cover the case where the ZonedDateTime since() or until()
methods are called with either the receiver or the argument being a
ZonedDateTime instance at either the earliest or latest end of the
supported range.
2025-09-16 10:42:10 +02:00
Philip Chimento
04eaeb9908 Temporal: Coverage for blank durations
Many methods did not test what happened when an input or return value
was a blank (all fields 0) duration. This adds coverage for those code
paths.
2025-08-25 11:56:33 +02:00
Philip Chimento
5048ca6383 Temporal: Add tests for observable order of options get and cast
These tests cover the normative change approved in the July 2025 TC39
plenary. See https://github.com/tc39/proposal-temporal/pull/3130.
All properties of user-passed options objects should be read and cast
before any "algorithmic validation" is done.

This is a lot of tests, that cover every entry point where an options
object is passed in, where subsequently an exception can be thrown or user
code can be called.

However, the normative change only affects 10 of these tests:

- Instant.p.since,until,toString
- PlainDate.p.since,until
- PlainTime.p.since,until
- PlainYearMonth.p.since,until
- ZonedDateTime.p.toString

The other 35 tests simply close a gap in coverage.
2025-08-21 12:01:52 -07:00
Philip Chimento
1588705cc5 Temporal: Add coverage for BubbleRelativeDuration called with time unit
See: tc39/proposal-temporal#3121

A type assertion in the spec was incorrect, but the assertion wasn't hit
in the Firefox implementation in any test262 test. These three tests add
coverage for all the paths that would have hit that assertion.
2025-08-20 18:02:05 +02:00
Linus Groh
dc40377cb4 Fix two leftover uses of Temporal.ZonedDateTime.prototype.timeZone 2025-07-07 14:44:08 +02:00
Ms2ger
68a817d713 Verify that Duration#with() doesn't accept duration strings
Also fix the description and put the string tests together.
2025-07-02 07:57:20 -07:00
Manish Goregaokar
749a6f9509 Move array/function Duration.with tests to the missing-property test 2025-07-01 15:13:52 -07:00
brageh01
443f0d2e7f
Temporal: Reorganize calendar and wrong-type tests (#4415)
Changes made to:

- PlainDate
- PlainYearMonth
- ZonedDateTime
- PlainDateTime
- PlainMonthDay

Merged calendar-number.js and calendar-wrong-type.js, due to no special behaviour of number to be tested.

Extracted string tests to calendar-iso-string.js and renamed the file to calendar-invalid-iso-string.js, due to the contents of the file initially testing invalid ISO strings.

Closes #3873
2025-04-23 16:04:15 -07:00
Philip Chimento
c3c318cf11 Temporal: Add coverage for weird PlainMonthDay leap day constrain case
If you have a leap day, such as February 29, and you get input such as
{ monthCode: "M02", day: 30 }, { overflow: "constrain" }, then you want
the day to be constrained to the leap day February 29, not February 28
as the maximum day would be in a common year. Add tests for this case
for each supported calendar.
2025-04-21 10:06:18 -07:00
Philip Chimento
7708262a21 Update ESIDs of Temporal.*.prototype properties
These ESIDs were updated to use dots instead of dashes, to be more
consistent with the ESIDs of other properties.
2025-03-14 09:26:47 +01:00
Tim Chevalier
0c2144e3e6 Temporal: Fix missing close quotation mark in error message 2025-03-12 15:33:09 -07:00
Tim Chevalier
3f65b0209d Temporal: Fix error message in test 2025-03-10 14:32:17 -07:00
Brage Hogstad
26db872ca7 Moved generic era and eraYear tests from intl402/Temporal to built-ins/Temporal 2025-02-12 11:36:45 -08:00
André Bargull
2ea91c02d0 Temporal: Coverage for Temporal.Duration 2025-01-09 16:33:51 -08:00
André Bargull
4aa9379068 Temporal: Coverage for Temporal.ZonedDateTime 2025-01-09 16:33:51 -08:00
André Bargull
4ceee16fff Temporal: Coverage for Temporal.PlainDateTime 2025-01-09 16:33:51 -08:00
André Bargull
22539853cd Temporal: Coverage for Temporal.PlainDate 2025-01-09 16:33:51 -08:00
André Bargull
934563c6c4 Temporal: Coverage for Temporal.Instant 2025-01-09 16:33:51 -08:00
André Bargull
fef2f1cf61 Temporal: Coverage for Temporal.PlainTime 2025-01-09 16:33:51 -08:00
André Bargull
7bc853660a Temporal: Coverage for Temporal.PlainYearMonth 2025-01-09 16:33:51 -08:00
André Bargull
6d69685a48 Temporal: Coverage for Temporal.PlainMonthDay 2025-01-09 16:33:51 -08:00
Philip Chimento
eefc5cf367 Temporal: Improve coverage of relativeto-string-limits tests
These tests did not fully cover Temporal.Duration.prototype.round and
Temporal.Duration.prototype.total because they called those methods on a
blank duration (all components zero), for which there is an early return
in round() and total().

This meant that we missed an assertion that would be hit after the early
return.

This makes sure to test both blank and non-blank Durations with these
relativeTo strings, and expect some strings to fail at different steps
with the two cases.

See: tc39/proposal-temporal#3015
2024-12-05 15:02:50 +01:00
Tim Chevalier
901dd6e920
Temporal: Add test for balancing up to weeks when year/month are present (#4305)
See tc39/proposal-temporal#2813
2024-12-03 14:08:20 -08:00
André Bargull
fd979d85d4 Fix strict mode error 2024-11-19 17:02:40 +01:00
Tim Chevalier
b2809feedf
Temporal: Add test for Duration/p/toString() with total time units out of range (#4313) 2024-11-06 16:47:58 +01:00
Tim Chevalier
01eb47d4f2 Add tests for adding negative durations to/subtracting durations from the last representable year/month of the ISO calendar
See https://github.com/tc39/proposal-temporal/issues/3029
2024-11-01 12:57:28 -07:00
Tim Chevalier
b7822bb0b8
Temporal: Move tests for ZonedDateTime/p/{since, until} out of staging (#4293)
Co-authored-by: Philip Chimento <philip.chimento@gmail.com>
2024-11-01 11:02:32 -07:00
Tim Chevalier
ccf8977b1c Temporal: Split up ZonedDateTime/old/string-parsing.js and move out of staging 2024-10-31 16:05:30 -07:00
Tim Chevalier
8cc0560713
Temporal: Move all tests out of ZonedDateTime/old/with.js under staging into separate files under test/built-ins (#4297)
Co-authored-by: Philip Chimento <philip.chimento@gmail.com>
2024-10-31 13:34:57 -07:00
Tim Chevalier
0f6b269400 Temporal: Move ZonedDateTime order-of-operations tests out of staging 2024-10-31 13:13:20 -07:00