Commit Graph

607 Commits

Author SHA1 Message Date
Romulo Cintra 7b2a9bb441
DurationFormat basic format tests (#3604) 2022-07-21 11:07:40 -07:00
André Bargull a3040a5047 Import SpiderMonkey Temporal tests
Temporal tests written for the SpiderMonkey implementation. Mostly
covers edge cases around mathematical operations and regression tests
for reported spec bugs.
2022-07-19 11:30:43 -07:00
Romulo Cintra 91a61b29ac meta: add missing feature flag 2022-07-13 09:16:05 -07:00
Frank Yung-Fong Tang f541d991f9 Remove comments after PR92
https://github.com/tc39/proposal-intl-numberformat-v3/pull/92/files
2022-07-13 08:20:44 -07:00
Frank Yung-Fong Tang e6b4558ae8 Sync test to PR29 of numberformat-v3
https://github.com/tc39/proposal-intl-numberformat-v3/pull/92/files
2022-07-13 08:20:44 -07:00
Romulo Cintra 6432c9df20
Increase the Intl.DurationFormat Coverage (#3592)
Co-authored-by: Ms2ger <Ms2ger@gmail.com>
2022-07-13 12:23:57 +02:00
Yusuke Suzuki b2b6756044 Fix useGrouping tests based on the latest Intl.NumberFormat v3 change
Based on discussion[1], useGrouping computation in Intl.NumberFormat v3 is updated[2] to keep web compatibility.
This change fixes the existing test which is testing the previous behavior.

[1]: https://github.com/tc39/proposal-intl-numberformat-v3/issues/74
[2]: d13bd63f8f
2022-07-04 11:13:37 -06:00
Romulo Cintra 392f0049d7 test invalid negative durations objects 2022-07-01 09:26:43 +02:00
Philip Chimento f314ecb9f4 Temporal: Test observable calls on fields object from PrepareTemporalFields
As of https://github.com/tc39/proposal-temporal/pull/2219 the object
returned from the PrepareTemporalFields abstract operation should be a
null-prototype object. There are a number of places where this is
observable in one of the calendar's ...FromFields() methods. This adds
tests for this behaviour everywhere it is observable.
2022-06-27 13:51:58 +02:00
Frank Yung-Fong Tang 13c1b3b546 Fix expectation
@romulocintra @sffc
2022-06-17 10:23:20 +02:00
Philip Chimento 0e86baf6f3
Temporal: Add tests for order of observable operations in *FromFields methods (#3568)
This adds tests for https://github.com/tc39/proposal-temporal/pull/2203
which was a normative change that reached consensus in the June 2022 TC39
plenary meeting.

Co-authored-by: Ms2ger <Ms2ger@gmail.com>
2022-06-14 15:46:16 +02:00
Ms2ger 53d6cd6d46 Temporal: Add tests for converting a ZonedDateTime to a PlainDate. 2022-06-02 08:50:05 +02:00
Romulo Cintra 406ec000f2
Tests combinations max-min fractionDigits and Significant digits (#3515)
NumberFormat v3
2022-05-25 10:50:46 -07:00
Philip Chimento 579268ab79 Temporal: Add tests for variant time separators
ISO strings may separate the time from the date with a case-insensitive T,
or a space. This adds tests to all entry points that take ISO strings, to
ensure that they accept an uppercase T, lowercase T, or space as the time
separator.

These tests are based on the one test for Temporal.PlainDateTime.from that
was already present.
2022-05-23 11:47:56 +02:00
Ms2ger 494b678cc5 Temporal: Add tests for ZonedDateTime to PlainDate conversion.
Also rename leap second tests for consistency.
2022-05-18 12:35:07 -07:00
Shane F. Carr 0a48029333
Fix Intl.NumberFormat roundingPriority test to reflect default values for min/max digits (#3506) 2022-05-04 11:31:56 -07:00
Frank Yung-Fong Tang 06fafd794b
Move testing of era/eraYear under intl402 (#3517)
* Move testing of era/eraYear under intl402

* remove era/eraYear from built-in tests.
2022-05-03 11:11:20 -07:00
Romulo Cintra 28455b13f5
Intl.DurationFormat update coverage (#3501)
* constructor tests coverage
* add localeMatcher tests
* add styles and numbering system tests
* re-organize folder and files structure
2022-05-03 08:19:32 -07:00
Philip Chimento 65a7ace1cb Regularize year zero tests
Some of these strings wouldn't have been valid even with a valid year in
them (e.g. strings ending in +01:00[UTC]) so fix up the strings that we
test. While touching these tests, I took the opportunity to regularize
them, and add some missing ones for ISO strings that convert to Calendar
and TimeZone.
2022-05-03 08:18:02 +02:00
Philip Chimento 078f3e22a4 Regularize leap second tests
Everywhere an ISO string is accepted in Temporal, a seconds value of :60
should always be coerced to :59, because of how leap seconds are handled
in ISO strings.

In property bags, a 'seconds: 60' property is not subject to that rule: it
should be handled according to the overflow option if there is one.

These tests existed already for some types; regularize them and add the
ones that didn't exist yet.
2022-05-03 08:18:02 +02:00
Ms2ger b649e6b22a Temporal: Port some Duration.compare tests. 2022-04-29 10:58:05 -07:00
Jesse Alama dcd25e616d Temporal: Port Demitasse tests for `PlainDateTime`'s `toString` 2022-04-28 12:20:22 +02:00
Frank Tang 576c0c0c7f Make minimumFractionDigits = maximumFractionDigits
Make minimumFractionDigits equal to maximumFractionDigits while
roundingIncrement != 1 to sync with latest spec change in
https://github.com/tc39/proposal-intl-numberformat-v3/pull/85
which landed to spec text in Feb 22, 2022
2022-04-25 11:35:24 -04:00
Philip Chimento 78c6ec7f1c Test wrong types in conversions to Temporal types
These tests cover, for every API entry point where a Temporal object is
expected, what happens when a value of a different type is passed in that
can't be converted.

Most entry points can convert a string to the expected Temporal type, and
will do ToString on any non-Object argument, and throw RangeError if the
result isn't a string that's convertible to that Temporal type. ToString
will throw TypeError on a Symbol.

Most entry points also take a property bag, and will throw TypeError if
the property bag doesn't have the required properties.

We also have to test for TimeZone and Calendar what happens if the wrong
type is provided as the value of a 'timeZone' or 'calendar' property in
another property bag, up to one level of nested properties.
2022-04-21 12:14:10 -07:00
Philip Chimento afce1b3fde Test conversion of Number to Temporal objects
Adds tests for conversion of a Number whose corresponding toString() value
is a valid ISO string. For some Temporal types this is possible, with a
number like 20220418.

Especially for Temporal.Calendar, we have to take into account the case
where the number is provided as the value for the 'calendar' property in a
property bag, and the case of up to one level of nested property bag as
well.

Regularizes and expands existing tests for this case.
2022-04-21 12:14:10 -07:00
Ms2ger 84679fd7ed
Temporal: Add a test for PlainDateTime#withPlainDate with intl calendars. (#3483) 2022-04-15 10:47:38 -07:00
Philip Chimento 9f303112bd Repeat Instant.p.toString() test with timeZone parameter for IANA time zones
This adds to the intl402/ tree a copy of
built-ins/Temporal/Instant/prototype/toString/timezone-offset.js but which
uses IANA time zones.
2022-04-13 10:46:20 +02:00
Philip Chimento ac19506a01 Add tests ensuring that observable calls are made with options === undefined
Where possible, observable calls originating from within Temporal, that
require an options argument, should pass `undefined` as that options
argument, rather than `{}` or `Object.create(null)`.

See tc39/proposal-temporal#1685.
2022-04-04 16:24:17 -04:00
Romulo Cintra 926b0960d7
update nfv3 test for roundingIncrement (#3441) 2022-03-31 14:53:20 -07:00
Jesse Alama 4c7c24646a
Check a variety of offset Etc/GMT timezones (#3403)
Tests for normative change https://github.com/tc39/proposal-temporal/pull/2050
2022-03-30 08:33:52 -07:00
Philip Chimento 3eea1a7959 Add tests for various invalid ISO strings for PlainDate
These tests check API entry points that convert strings to
Temporal.PlainDate, with a list of various strings that are all not valid
for that context according to ISO 8601.
2022-03-29 11:26:53 -04:00
Romulo Cintra 81895b1543 use all values max and min fraction and significant digits 2022-03-14 16:52:38 -07:00
Frank Yung-Fong Tang 5fb0f5b6d2 Remove SPACES before features 2022-03-09 15:24:33 -05:00
Frank Yung-Fong Tang bc4af482b0 Fix features by removing leading space 2022-03-09 15:24:33 -05:00
Jesse Alama 131c396b6a Remove number test (yields a different error, not an exception) 2022-02-28 14:37:03 -05:00
Jesse Alama 8ff1e510b9 Add a couple more types 2022-02-28 14:37:03 -05:00
Jesse Alama 9c6e3aff38 Move to more sensible location 2022-02-28 14:37:03 -05:00
Jesse Alama 10f9a69295 Move test to a more sensible location
Also, use a more sensible ID as well. Add another test (for
Date values).
2022-02-28 14:37:03 -05:00
Jesse Alama ecd24faa82 Fix buggy error message 2022-02-28 14:37:03 -05:00
Jesse Alama 918cefcd09 Check `formatRange` on many pairs of invalid arguments 2022-02-28 14:37:03 -05:00
Jesse Alama 7d82f8ac63 Add tests for invalid extended year "-000000"
https://github.com/tc39/proposal-temporal/issues/1753 records the
consensus reached at the October 2021 TC39 meeting to disallow "-000000"
as an extended year, both in Date.parse and Temporal. This adds tests for
the Temporal part of that.
2022-02-01 17:59:02 -05:00
Ms2ger 158d0bf35f Test PlainYearMonth constructor, from. 2022-01-28 13:17:31 -05:00
Romulo Cintra ffae81a3f6 update assert name and length check 2022-01-26 16:32:15 -05:00
Romulo Cintra 034e5dd201 Update test/intl402/DurationFormat/instance/length.js
Thanks

Co-authored-by: Ms2ger <Ms2ger@gmail.com>
2022-01-26 16:32:15 -05:00
Romulo Cintra 95613d4ec8 update DurationFormat tests 2022-01-26 16:32:15 -05:00
Ms2ger d86b913c11 Test Temporal.Now. 2022-01-24 13:36:43 -05:00
Romulo Cintra 66f4071495 update test 2022-01-24 13:28:44 -05:00
Romulo Cintra e687842030 update tests 2022-01-24 13:28:44 -05:00
Romulo Cintra 9f8ac1aace add instance checks 2022-01-24 13:28:44 -05:00
Philip Chimento 631337b261 Remove duplication between built-ins/ and intl402/
There were two cases where tests in intl402/ had some duplication of tests
that are in built-ins/ as well. Remove this duplication, and restrict the
intl402/ tests to testing things that can't be tested on all hosts.
2022-01-19 13:47:43 -05:00
Philip Chimento a6faa8c000 Add tests using Intl time zones to intl402/
For cases in the previous commit that actually removed some functionality
from tests in built-ins/, add corresponding tests in intl402/ to preserve
test coverage of that functionality for hosts that do support Intl.
2022-01-19 13:47:43 -05:00
Yusuke Suzuki 1935e1b410 Fix Intl.NumberFormat useGrouping value tests
After Intl.NumberFormat v3, default useGrouping is "auto".
We also fix test/intl402/NumberFormat/test-option-useGrouping.js. After v3,
it accepts string and boolean.
2022-01-19 13:46:58 -05:00
Frank Yung-Fong Tang 9aedfd146d replace SPACE with NBSP
the " " before the currency symbol and between group are actually nbsp not SPACE.
2022-01-07 13:21:05 -05:00
Frank Yung-Fong Tang 16f3f494d3 fix test
1. "–" => " – "
2. Move the verifyProperty after assert.sameValue because it has side effect of removing that property while it is writable.
2022-01-07 13:20:17 -05:00
Frank Yung-Fong Tang b91167622b add includes: [propertyHelper.js] 2022-01-07 13:20:17 -05:00
Frank Yung-Fong Tang 0b8efb9c0d correct expectation 2022-01-07 13:19:07 -05:00
Frank Yung-Fong Tang a12f375a99 remove extra "Digits" 2022-01-07 13:19:07 -05:00
Frank Yung-Fong Tang fe9f29e4a8 Fix format-rounding-priority-less-precision.js
1. remove extra "Digits" in the spelling
2. fix the setting of minimumSignificantDigits is more precise since both will produce "1.00" w/o change
2022-01-07 13:19:07 -05:00
Frank Yung-Fong Tang a665b5f3a2 fix case for roudingIncrement: 5000 2022-01-07 13:19:07 -05:00
Frank Yung-Fong Tang 4cc44841f6 fix test for roundingIncrement: 500 2022-01-07 13:19:07 -05:00
Frank Yung-Fong Tang 5ee4e0d609 change to minimumFractionDigits:1 2022-01-07 13:19:07 -05:00
Frank Yung-Fong Tang a8e89964b4 set minimumFractionDigits: 1 to testing of 250 2022-01-07 13:19:07 -05:00
Frank Yung-Fong Tang 2d52f74d97 set minimumFractionDigits: 1 2022-01-07 13:19:07 -05:00
Frank Yung-Fong Tang 4719c8c2dd adjuest setting for roundingIncrement: 25 2022-01-07 13:19:07 -05:00
Frank Yung-Fong Tang 9e50891a40 set minimumFractionDigits: 1 in format-rounding-increment-5
We need to set minimumFractionDigits: 1 for the case of {roundingIncrement: 5, maximumFractionDigits: 1} and also adjust the test expectation. 
Otherwise, inside testNumberFormat , it will call   getPatternParts to format 1.1 and -1.1 and cause pattern mismatch (because the result will be "1" instead of "1.1" in that configuration)

https://github.com/tc39/test262/blob/main/harness/testIntl.js#L2369
2022-01-07 13:19:07 -05:00
Frank Yung-Fong Tang 63f2c5b10f Remove 1.1 case which should NOT throw RangeError
roundingIncrement: 1.1 will not throw RangeError because
1.  roundingIncrement is read by calling GetNumberOption 
2. GetNumberOption https://tc39.es/ecma402/#sec-getnumberoption will call DefaultNumberOption https://tc39.es/ecma402/#sec-defaultnumberoption and 
3. DefaultNumberOption will call floor() in step 3.
2022-01-07 13:18:18 -05:00
Frank Yung-Fong Tang 0fe508c5f0 change notation to "standard"
I do not believe this setup is correct if we use notation: "compact". 

in https://tc39.es/proposal-intl-numberformat-v3/out/numberformat/diff.html#sec-setnfdigitoptions
notation is "compact"
mnsd is undefined
mxsd is undefined
mnfd is undefined
mxfd is undefined
hasSd is false
hasFd is false
needSd is false
needFd is false
so step 23 else block will be run
Set intlObj.[[RoundingType]] to morePrecision.
then in step 23 of https://tc39.es/proposal-intl-numberformat-v3/out/numberformat/diff.html#sec-initializenumberformat
```
If roundingIncrement is not 1 and numberFormat.[[RoundingType]] is not fractionDigits, throw a RangeError exception.
```
2022-01-07 13:17:50 -05:00
Mike Pennisi 6c9b4de507 fixup! Add tests for "Intl NumberFormat v3" proposal 2022-01-04 09:35:13 -05:00
Mike Pennisi d071b37f09 Add tests for "Intl NumberFormat v3" proposal
This patch is intended to cover only one aspect of the proposal for
ECMA402: the "new rounding/precision options" feature.
2022-01-04 09:35:13 -05:00
Yusuke Suzuki 6804e59f9f Fix Intl.PluralRules.selectRange test
en-US's Intl.PluralRules.selectRange(102, 201) is "other", not "few".
2022-01-04 09:33:18 -05:00
Romulo Cintra 46f847c2e8
NumberFormat v3 tests (#3283)
* feat: nfv3 plural rules

* test NaN and out of range values

* add NumberFormat v3 proposal features

* add feature to selectrange tests

* add basic test NumberFormat.formatRange

* add basic test NumberFormat.formatRangeToParts

* update Plural Rules tests

* refactor some tests

* update formatRange tests

* update formatRangeToParts tests

* update feature flag

* add locale: [en-US]

* update selectRange tests

* update tests

* update en-US tests and add pt-PT

* update prop-desc check

* validate  1.1.25_4.a

Co-authored-by: Romulo Cintra <romulocintra@gmqil.com>
2021-12-17 14:33:27 -05:00
Philip Chimento 0184842b09 Test rejection of "Z" UTC designators in Plain strings
Tests for the normative changes made to Temporal in
https://github.com/tc39/proposal-temporal/pull/1874
2021-12-14 13:39:19 -05:00
Frank Yung-Fong Tang 29a0a1e253 Simplify the testing
The last five lines below are simply WRONG and not according to the spec. 

```
const durationFormat = new Intl.DurationFormat();

verifyNotEnumerable(durationFormat, Symbol.toStringTag);
verifyNotWritable(durationFormat, Symbol.toStringTag);
verifyConfigurable(durationFormat, Symbol.toStringTag);
```
2021-12-14 13:37:35 -05:00
Frank Yung-Fong Tang b9cac998df Correct set up 2021-12-14 10:39:37 -05:00
Frank Yung-Fong Tang 6fecbe5257 correct test result in NumberFormat/...value-decimal-string.js 2021-12-14 10:39:37 -05:00
Frank Tang c2bd148ac7 restore the wrong copy 2021-12-06 09:12:27 -05:00
Frank Tang 78907d6393 Move toLocaleString testing to intl402
Move part of the test of toLocaleString which depends on
15 Amendments to the ECMAScript® 2021 Internationalization API Specification
to intl402. Keep behavior specified in earlier chapters in built-ins
2021-12-06 09:12:27 -05:00
Nikhil Singhal 1f16a6ad0e docs: update features 2021-12-03 19:53:31 -05:00
Nikhil Singhal f00ea58ae9 test(Intl.DurationFormat.prototype): check prototype attributes 2021-12-03 19:53:31 -05:00
jugglinmike 4d23bbf00a
Add tests for "Intl NumberFormat v3" proposal (#3307)
* Add tests for "Intl NumberFormat v3" proposal

This patch is intended to cover only one aspect of the proposal for
ECMA402: the "interpret strings as decimals" feature.

* fixup! Add tests for "Intl NumberFormat v3" proposal
2021-12-03 19:51:57 -05:00
Frank Yung-Fong Tang a3a31f0316 Move test with IATA TimeZone to intl402 2021-12-02 09:46:33 -05:00
Frank Yung-Fong Tang fdad35e658 Move IATA TimeZone test to intl402 2021-12-02 09:46:33 -05:00
Frank Yung-Fong Tang 00369cfe38 Move test under intl402 2021-12-02 09:46:33 -05:00
Frank Yung-Fong Tang ef697bbc6d fix en-IN expectation 2021-12-02 09:45:59 -05:00
Frank Yung-Fong Tang 54ef0b1bf4 Fix expectation of "compact" notation 2021-12-02 09:45:59 -05:00
Mike Pennisi ae9440df36 fixup! Add tests for "Intl NumberFormat v3" proposal 2021-11-30 14:52:57 -05:00
Mike Pennisi ef78452924 Add tests for "Intl NumberFormat v3" proposal
This patch is intended to cover only one aspect of the proposal for
ECMA402: the "grouping enum" feature. It also includes coverage for the
formatting option as already defined by the latest version of ECMA402.
2021-11-30 14:52:57 -05:00
André Bargull 666d62a27f Correct negative-zero sign display tests
The negative sign is computed after rounding, so when the input `-0.0001` is
rounded to `-0`, the expected result should be `"0"` instead of `"-0"`.
2021-11-30 14:51:22 -05:00
Frank Yung-Fong Tang a171df1c03 rollback changes get into the wrong branch 2021-11-30 14:49:23 -05:00
Frank Yung-Fong Tang 4d831016c3 Fix expectation for "Asia/Ulan_Bator" 2021-11-30 14:49:23 -05:00
Frank Yung-Fong Tang 6216034ed7 remove invalid test 2021-11-30 14:49:23 -05:00
Frank Yung-Fong Tang 3f5c4fce43 Valid values of 'era' is not defined in Temporal 2021-11-30 14:49:23 -05:00
Philip Chimento 58cffd9f57 Remove intl402/Temporal/TimeZone/from/argument-invalid test
Currently, this test is not conformant to the proposal text.
Temporal.TimeZone.from() calls ToTemporalTimeZone. Since the argument is
a string, we next go to ParseTemporalTimeZone, where on a string such as
`1994-11-05T08:15:30-05:00[UTC]` we would return _result_.[[Name]] (which
would be equal to `UTC`) and discard the UTC offset string.
2021-11-30 14:48:08 -05:00
Philip Chimento 1d09acaac1 Fix not-callable getOffsetNansecondsFor tests
Unfortunately, in #3304 I made a last-minute mistake when I added the
uncallable value to the assertion message, and neglected to test it;
Symbols can't be converted to strings like that, so these tests would
fail. This fixes the assertion messages.
2021-11-30 14:36:59 -05:00
Yusuke Suzuki fc6a9169a4 Update Intl.Locale info API test
weekendStart / weekendEnd are merged into one weekend array.
2021-11-30 14:36:01 -05:00
Yusuke Suzuki c124f6c037 Intl.NumberFormat v3's default roundingMode should be "halfExpand"
The test was using "halfExpand (default)".
2021-11-30 14:35:41 -05:00
Philip Chimento ae53326189 Test TypeError is thrown when getOffsetNanosecondsFor is not callable
Tests for the normative changes made to Temporal in
https://github.com/tc39/proposal-temporal/pull/1829
In a previous version of the specification, there was a fallback to the
intrinsic getOffsetNanosecondsFor when it was undefined.
2021-11-16 17:06:06 -05:00
Mike Pennisi 26f1f4567e Add tests for "Intl NumberFormat v3" proposal
This patch is intended to cover only one aspect of the proposal for
ECMA402: the "negative sign display" feature.
2021-11-09 13:28:42 -05:00
Mike Pennisi 396fc064d8 fixup! Add tests for "Intl NumberFormat v3" proposal 2021-11-01 12:50:38 -04:00
Mike Pennisi c0ea82adf1 fixup! Add tests for "Intl NumberFormat v3" proposal 2021-11-01 12:50:38 -04:00