617 Commits

Author SHA1 Message Date
Jesse Alama
285785f988 Add CalendarResolveFields error ordering tests
Tests verify that CalendarResolveFields throws TypeError for missing
required fields before throwing RangeError for invalid field values.
2025-11-25 13:33:34 -08:00
Tim Chevalier
26058a01fd
Temporal: Coverage for wrapping at the end of the month (#4695)
Covers Indian, Hijri, and Persian calendars
2025-11-24 15:10:39 -08:00
Tim Chevalier
a5eaadfb43 Temporal: Add order-of-operations tests for toPlainDate
Add order-of-operations tests for toPlainDate for PlainMonthDay
and PlainYearMonth
2025-11-24 11:25:28 -08:00
Tim Chevalier
29e8305d0f
Temporal: Tests for duration rounding and totaling (#4662)
* Temporal: Tests for duration rounding and totaling

This provides coverage for the bug in https://github.com/tc39/proposal-temporal/issues/3168

* Update test/built-ins/Temporal/Duration/prototype/total/rounding-window.js

---------

Co-authored-by: Philip Chimento <philip.chimento@gmail.com>
2025-11-18 15:15:51 -08:00
Philip Chimento
8d2fba2d16 Temporal: Add ISO8601 PlainDate.p.with leap year test
This was not particularly well covered in the existing tests.
2025-11-17 10:55:58 +01:00
Philip Chimento
d12966d207 Temporal: Add ISO8601 PlainDate.p.with days constraining test
This was not particularly well covered in the existing tests.
2025-11-17 10:55:58 +01:00
Philip Chimento
f4367bc315 Temporal: Expand ISO8601 PlainDate.p.with tests
Move coverage of plural units to a separate file, and add some more
coverage for the overflow option.
2025-11-17 10:55:58 +01:00
Philip Chimento
2f0cc98718 Temporal: Add ISO8601 PlainDate.p.add days constraining test
This was not particularly well covered in the existing tests.
2025-11-17 10:55:58 +01:00
Philip Chimento
5d4feb344e Temporal: Expand ISO8601 PlainDate.p.add arithmetic tests
These were missing negative durations, as well as a test for ≥2 whole
years.
2025-11-17 10:55:58 +01:00
Philip Chimento
79bc9083fe Temporal: Reorganize ISO8601 PlainDate.p.until
Reorganize the PlainDate.p.until tests by topic ("basic arithmetic",
"leap years") to make them easier to adapt for non-ISO calendars.
2025-11-17 10:55:58 +01:00
Philip Chimento
b529669873 Temporal: Reorganize ISO8601 PlainDate.p.add tests
Reorganize the PlainDate.p.add tests by topic ("basic arithmetic", "leap
years") to make them easier to adapt for non-ISO calendars. A third
topic would be "constraining days" but it turns out that is barely
tested!
2025-11-17 10:55:58 +01:00
Tim Chevalier
0186d50ba0 Temporal: Test both "use" and "ignore" offsets
This test was previously only testing the "use" offset option
when testing valid strings.
2025-11-13 11:35:24 +01:00
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