Commit Graph

764 Commits

Author SHA1 Message Date
André Bargull c4317b0cb5 Ensure ToDateTimeFormattable is called for both arguments 2024-12-18 16:59:26 +01:00
André Bargull d7fa2a1163 Remove "US/Pacific-New" from time zone tests
"US/Pacific-New" was removed in tzdata2020b.
2024-12-16 14:55:12 +01:00
André Bargull d124e1486c Allow alternative era for Chinese calendar
Year 1 in the Chinese calendar corresponds to 2637 BCE in ICU4X.

See <https://docs.rs/icu/latest/icu/calendar/chinese/struct.Chinese.html#year-and-era-codes>.
2024-12-04 11:26:13 -08:00
Ben Allen 4053ff2eaf
Add tests for `Intl.PluralRules.prototype.resolvedOptions().pluralCategories` order (#4275)
Array elements should appear in following order: "zero", "one", "two", "few", "many", "other"

see https://github.com/tc39/ecma402/pull/918/
2024-12-03 13:38:58 +00:00
Ben Allen bf9f54cb9d
Test that Intl.DateTimeFormat canonicalizes the timezones "Etc/GMT", "Etc/UTC", and "GMT" to "UTC" (#4328) 2024-11-18 09:20:01 +00:00
Philip Chimento 80c49657d3 Temporal: Fix name of constructor
I mistakenly committed something slightly different in my code review
suggestion than what I had modified locally.
2024-11-08 11:18:43 +01:00
Tim Chevalier 1128b6fcd2 Temporal: Add test case for rounding up to a non-24-hour ZonedDateTime 2024-11-07 14:13:27 -08:00
Tim Chevalier 81df127d54
Temporal: Add test case for rounding Duration relative to a ZonedDateTime (#4306)
This is the test for the change in tc39/proposal-temporal#3036 and is a variation of the test from tc39/proposal-temporal#2814 .
2024-11-07 12:22:28 -08:00
Tim Chevalier ab69bd4dd8
Temporal: Add test for date with offset transition (#4301)
Co-authored-by: Philip Chimento <philip.chimento@gmail.com>
2024-11-01 13:43:05 -07:00
Tim Chevalier 45f352d37b
Temporal: Add test for setting minimum valid year-month with non-ISO8601 calendar (#2998) (#4300) 2024-11-01 11:14:22 -07:00
Ben Allen 38d2924fb6
402: Replace currency-digits.js Intl.NumberFormat test (#4285)
ISO 4217 no longer normative for currency minor digits. New test verifies that
currency data (from whatever source) is used by verifying that `maximumFractionDigits` and `minimumFractionDigits`
are identical. See https://github.com/tc39/ecma402/pull/922
2024-10-31 11:39:44 -07:00
Ben Allen febf246e05 DurationFormat: Add tests for durations with large hour/minute/second unit values while using digital style
Grouping separators suppressed in this situation. See tc39/proposal-intl-duration-format/pull/198
2024-10-30 16:07:46 -07:00
Ben Allen 455cfa5a66
Add tests to `Intl.DateTimeFormat` and `Intl.RelativeTimeFormat` for various numbering systems (#4276)
* Add tests to `Intl.DateTimeFormat` and `Intl.RelativeTimeFormat` for formatting in various numbering systems

* fixup! Add tests to `Intl.DateTimeFormat` and `Intl.RelativeTimeFormat` for formatting in various numbering systems
2024-10-30 15:03:44 -07:00
Ben Allen 153db6ce33 Intl.NumberFormat Add tests for `Intl.NumberFormat` when using "currency" style and "compact", "engineering", and "scientific" notations.
Related PR: https://github.com/tc39/ecma402/pull/925
2024-10-30 14:51:34 -07:00
André Bargull df910721ba Update time zone mapping for CLDR46 / tzdata 2024b 2024-10-14 11:21:25 -07:00
André Bargull ab809f8f0c Update tests for "Limit valid values for DurationFormats to match upcoming limits in Temporal"
Update tests for
<https://github.com/tc39/proposal-intl-duration-format/pull/173>.
2024-10-09 19:43:12 -07:00
Philip Chimento e2f2f92486 Temporal: Add tests for formatting with no overlap between DTF options and Temporal object
See tc39/proposal-temporal#2795. When attempting to format a Temporal
object, if the DateTimeFormat has options that do not overlap with the
data model of the Temporal object, toLocaleString() and format() are
supposed to throw a TypeError.
2024-10-07 12:02:45 +02:00
Philip Chimento 573234fe7b Temporal: Add tests for toLocaleString with no options
For each Temporal object, add tests for what components are present by
default if no options for date or time components are passed.
2024-10-07 12:02:45 +02:00
Philip Chimento 9e6ab9bb02 Temporal: Add coverage for formatting each Temporal object with only one component
Adds a test for each Temporal object's toLocaleString() method, formatting
them with only one option e.g. { year: 'numeric' } and comparing it with
the corresponding output for legacy Date.

See tc39/proposal-temporal#2796.
2024-10-07 12:02:45 +02:00
Philip Chimento e46b317b18 Temporal: Add test coverage for canonicalizing era codes in from()
There was a coverage gap for converting calendar fields to a date when the
provided era was an alias.

See https://github.com/tc39/proposal-temporal/pull/2940#discussion_r1767508659
2024-09-20 17:04:19 +02:00
Richard Gibson de3a117f02 Temporal: Update tests to account for use of year in ToTemporalMonthDay
Ref https://github.com/tc39/proposal-temporal/issues/2863
Normative PR: https://github.com/tc39/proposal-temporal/pull/2940
2024-09-19 11:27:48 -07:00
Philip Chimento 6f8f6b5261 Temporal: Tests for ignoring era and eraYear in calendars without eras
This tests some of the prose requirements of CalendarResolveFields.

See https://github.com/tc39/proposal-temporal/issues/2870
2024-09-10 09:28:24 -07:00
Philip Chimento d9b10790bc Temporal: Tests for corner case in TZDB involving DST transition in 1919
These tests add coverage for a corner case in the TZDB. In spring 1919,
the America/Toronto time zone switched to DST at 23:30 on March 30th,
skipping an hour ahead to 00:30 on March 31st. This meant that both March
30th and March 31st were 23.5-hour days.

See: https://github.com/tc39/proposal-temporal/issues/2910
2024-09-05 15:19:17 -07:00
Philip Chimento ea11e0e787 Temporal: Further coverage and tweaks for removing Calendar/TimeZone objs
Tweak some tests to provide coverage of new execution paths in the spec,
such as calling GetOptionsObject inside ToTemporal___; add a few new tests
for things that weren't covered before, such as rounding a PlainDateTime
at the edge of the range; and tweak the tests verifying when the
properties of the options bag are read, which I made a mistake in #4119.

See: https://github.com/tc39/proposal-temporal/pull/2925
2024-08-22 14:00:43 -07:00
André Bargull dcaed0523c Allow implementation-defined behaviour for constraining leap months 2024-07-25 11:46:15 -07:00
Frank Tang 12416e0fa9 Add tests for DurationFormat PR 172 and 167
Test the order of resolvedOptions in default setting
Also add test to check the reading order of options based on the
property returned in the default setting resolvedOptions.

https://github.com/tc39/proposal-intl-duration-format/pull/167
https://github.com/tc39/proposal-intl-duration-format/pull/172
https://tc39.es/proposal-intl-duration-format/#sec-Intl.DurationFormat.prototype.resolvedOptions

These two PRs are presenting to TC39 2023-09 meeting

Swap actual/expected order

Update test/intl402/DurationFormat/constructor-option-read-order.js

Co-authored-by: André Bargull <andre.bargull@gmail.com>

Fix per anba suggestion
2024-07-24 15:47:38 -07:00
Timothy Flynn d8aa2e4ef7 Update NumberFormat.prototype.useGrouping test for CLDR 45
In CLDR 45, in the en-IN locale, the compact thousands symbol changed
from 'T' to 'K' after a survey was conducted in India:

b8d4472975
2024-07-24 08:53:41 -07:00
Frank Yung-Fong Tang 753d502e9a Update the expctation of constructor-options-firstDayOfWeek-valid.js
true will be dropped inside UTS35
2024-07-11 15:24:54 -07:00
Frank Tang 7b154389ce Update firstDay test to latest spec after PR 79
Spec Changes merged
https://github.com/tc39/proposal-intl-locale-info/pull/79
2024-07-10 11:20:28 -07:00
André Bargull 16322d384a Allow alternative era names
Temporal doesn't specify concrete era names, so tests shouldn't assert
for example that the era code of the current Gregorian era is `"ce"`. We
still want to validate the era names somehow however, so allow alternative
era names using the era codes from the "Intl era and monthCode" proposal.
2024-07-10 07:59:20 -07:00
Philip Chimento bbfcfd59b0 Temporal: Port staging tests that require non-ISO calendar or non-UTC time zone
As in the previous commit, without custom calendars and time zones, some
functionality cannot be tested on implementations that don't have any
other calendars and time zones than iso8601 and UTC.

Some of the staging tests fall in this category. We take the opportunity
to port these into proper tests, in the intl402/ folder.
2024-07-05 10:43:53 +02:00
Philip Chimento efc7424844 Temporal: Don't use getISOFields() in other tests
Previously getISOFields() was used to get the exact value of the
[[Calendar]] and [[TimeZone]] internal slots, as well as to get the
reference ISO year for PlainMonthDay and reference ISO day for
PlainYearMonth.

Use calendarId and timeZoneId for the former and toString() for the
latter.
2024-07-05 10:43:53 +02:00
Philip Chimento e5ef51ba7e Temporal: Move tests into intl402/ that require non-ISO calendar or non-UTC time zone
Without custom calendars and time zones there are actually a bunch of
things that we now can't test on implementations that don't have non-ISO
calendars or non-UTC time zones. (Alternatively, we can say that these are
functionalities that those implementations don't have to implement.)
2024-07-05 10:43:53 +02:00
Philip Chimento 9671c4a613 Temporal: Test adjustments for removing calendar and time zone objects 2024-07-05 10:43:53 +02:00
Philip Chimento 0a1cb1307f Temporal: Edit test descriptions that refer to Calendar and TimeZone objects 2024-07-05 10:43:53 +02:00
Philip Chimento 7d970fbe4e Temporal: Remove fake West Coast and Samoa time zones from TemporalHelpers
It's no longer possible to fake built-in time zones using custom objects.
So testing DST shifts will have to use real built-in time zones. Replace
TemporalHelpers.springForwardFallBackTimeZone with America/Vancouver (it
was modelled on the DST transitions in 2000) and
TemporalHelpers.crossDateLineTimeZone with Pacific/Apia (it was modelled
on the 2011 switch to the other side of the international date line.)

These tests have to move to the intl402/ folder since non-Intl-aware
implementations are allowed (but not required) to support any built-in
time zones other than UTC.
2024-07-05 10:43:53 +02:00
Philip Chimento c728e6d89e Temporal: Fix tests that unnecessarily create TimeZone or Calendar instances
In many cases we created a TimeZone or Calendar instance from a built-in
time zone or calendar. These tests can be trivially adapted to just use
the string ID.
2024-07-05 10:43:53 +02:00
Philip Chimento ea2268aa43 Temporal: Remove tests directly relating to custom calendar and time zones
These are tests that just won't apply anymore without custom calendars and
time zones.
2024-07-05 10:43:53 +02:00
Philip Chimento 6595838b3d Temporal: Remove TimeZone.p.equals method
Some of the tests can be removed altogether since they deal with what
forms of input can be passed to ToTemporalTimeZoneSlotValue. Those are
tested on every method that takes a TimeZone as input.

Other tests are still relevant, but need to move to ZonedDateTime.p.equals
where the various quirks of time zone equality can still be tested. (Some
of these still will be removed in a following commit because they use
time zone objects.)

See: #2826
2024-07-05 10:43:53 +02:00
Philip Chimento 1213ab17ec Temporal: Remove getCalendar and getTimeZone methods
Temporarily replace them with getISOFields().calendar/timeZone just to
keep the tests running until we remove Calendar and TimeZone objects
altogether.

See: tc39/proposal-temporal#2826
2024-07-05 10:43:53 +02:00
Philip Chimento c22fbc7b45 Temporal: Port staging tests that use next/previousTransition
See: tc39/proposal-temporal#2826
2024-07-05 10:43:53 +02:00
Philip Chimento 71877cde79 Temporal: Move tests for getNext/PreviousTransition into ZonedDateTime
See: tc39/proposal-temporal#2826
2024-07-05 10:43:53 +02:00
Philip Chimento 3f805a1383 Temporal: Test calendar canonicalization in Temporal
Following the upstream ECMA-402 change tested in the previous commit, add
test coverage for the corresponding functionality in Temporal. Fix one
test that was erroneous.
2024-07-04 11:14:16 +02:00
Philip Chimento 31a20380b0 Intl: Test calendar canonicalization in Intl.DateTimeFormat constructor
This ECMA-402 change is already from several years ago, but lacked test
coverage: https://github.com/tc39/ecma402/pull/418
2024-07-04 11:14:16 +02:00
Philip Chimento 6626b60df6 Temporal: Make U+2212 MINUS SIGN invalid in ISO strings
These are the test adjustments corresponding to the normative PR
https://github.com/tc39/ecma262/pull/3334 which reached consensus at the
June 2024 TC39 meeting.
2024-07-03 08:50:57 -07:00
Philip Chimento 7c985a4fd9 Make U+2212 MINUS SIGN an invalid sign character for offset time zone IDs
These are the test adjustments corresponding to the normative PR
https://github.com/tc39/ecma262/pull/3334 which reached consensus at the
June 2024 TC39 meeting.
2024-07-03 08:50:57 -07:00
SUZUKI Sosuke 27b2551c00
Add test to check `nfOptions.roundingMode` for seconds / microseconds / nanoseconds is `"trunc"` (#4115)
* Test that `nfOptions.roundingMode` for seconds / microseconds / nanoseconds is `"trunc"`

* Add license header

* Use `Intl.NumberFormat` instead of `testintl.js` harness

* Use correct harness
2024-06-27 10:08:11 -07:00
Frank Yung-Fong Tang c3a326ace8
Add test for ECMA402 PR833 Allow locale based ignorePunctuation default (#3922)
* Add test for ECMA402 833

https://github.com/tc39/ecma402/pull/833

* Update test/intl402/Collator/prototype/resolvedOptions/ignorePunctuation-default.js

Co-authored-by: André Bargull <andre.bargull@gmail.com>

* Update test/intl402/Collator/prototype/resolvedOptions/ignorePunctuation-default.js

Co-authored-by: André Bargull <andre.bargull@gmail.com>

---------

Co-authored-by: André Bargull <andre.bargull@gmail.com>
2024-06-26 17:40:01 -07:00
Philip Chimento 58df8fb22a Temporal: Remove methods with ISO-named pairs
See tc39/proposal-temporal#2846
2024-06-13 22:04:16 +02:00
Philip Chimento 7184313667 Temporal: Remove PlainTime.toPlainDateTime/toZonedDateTime methods
See tc39/proposal-temporal#2848
2024-06-13 22:04:16 +02:00