Commit Graph

5977 Commits

Author SHA1 Message Date
Frank Yung-Fong Tang 9215420dee Fix limit test
The doAsserts is not correct for case like "P100000000000000000000000000Y"
If we test "P100000000000000000000000000Y" because the filed in Duration is only required to 
"A float64-representable integer is an integer that is exactly representable as a Number value. That is, for a float64-representable integer x, it must hold that ℝ(𝔽(x)) = x." per 
https://tc39.es/proposal-temporal/#sec-properties-of-temporal-duration-instances

The duration it hold may produce string such as
"P99999999999999987584860160Y" 

even the test only test the first 10 digits ( log(10^10)/log(2) = 33 bits)
Change the test to test 

"P100000000000001000000000000Y" instead, so a negative numerical error will not change the start of the string 
from "P1000000000" to "P9999999999"
2022-09-16 11:38:26 -07:00
Philip Chimento 58a9cdc426 Temporal: Test new limits for user code return from getOffsetNanosecondsFor
This tests the normative change from
https://github.com/tc39/proposal-temporal/pull/2260
which achieved consensus in the July 2022 TC39 meeting.

The return value from a userland getOffsetNanosecondsFor method is no
longer allowed to be exactly one 24-hour day.
2022-09-16 13:41:08 +02:00
Philip Chimento 31ad95d34e Temporal: Add more getOffsetNanosecondsFor validation tests
This adds tests that validate a user-callable getOffsetNanosecondsFor to
several APIs that didn't test this yet: ZonedDateTime.since/until, and
Calendar.era/eraYear.
2022-09-16 13:41:08 +02:00
Philip Chimento 65b51e0769 Temporal: Override getPossibleInstantsFor to narrow down exception
In order for some tests to ensure that they are testing the right
exception, we need to make sure we are in the path where there are no
possible instants for a particular date-time. Override this method in some
tests.
2022-09-16 13:41:08 +02:00
Frank Yung-Fong Tang aa3afd1c28 Remove "15Z" to for PlainTime.from test
"15Z" will throw RangeError because Z match 
UTCDesignator => 
TimeZoneUTCOffset => 
TimeZoneUTCOffset TimeZoneBracketedAnnotationopt => 
TimeZoneopt 

and "15" match
1 DecimalDigit =>
Hour =>
TimeHour  =>
TimeSpec 

so "15Z" match
TimeSpec TimeZoneopt =>
TimeSpecWithOptionalTimeZoneNotAmbiguous =>
TimeSpecWithOptionalTimeZoneNotAmbiguous Calendaropt =>
CalendarTime  =>
TemporalTimeString 

Therefore 
13.37 ParseTemporalTimeString ( isoString )

https://tc39.es/proposal-temporal/#sec-temporal-parsetemporaltimestring
will succeess in 2. If parseResult is a List of errors, throw a RangeError exception.
but the in step 3
3. If parseResult contains a UTCDesignator Parse Node, throw a RangeError exception.

the "Z" is UTCDesignator so it will throw RangeError.
2022-09-15 11:23:41 -07:00
Philip Chimento ce2061eccd Temporal: Adjust order of operations in Calendar.___fromFields
This implements the normative change in
https://github.com/tc39/proposal-temporal/pull/2377 which reached
consensus at the September 2022 TC39 meeting.

It changes the order in which observable operations are performed on the
values passed to the ___fromFields methods of Calendar.
2022-09-15 11:04:37 +02:00
Frank Yung-Fong Tang 4569e73420
Fix DurationFormat default tests (#3640)
1. add the test for "seconds"
2. since the default value for "style" is "long", baseStyle for GetDurationUnitOptions is "long" and therefore the 
last argument in testOption should be "long"
3. the valid values for "days" does not contains  "numeric", and "2-digit". remove them. 
4. the valid values for "milliseconds", "microseconds" and "nanoseconds" does not contains "2-digit". remove it.

See https://tc39.es/proposal-intl-duration-format/#table-duration-components about the valid value
notice the last colum is for "Digital Default" while the baseStyle is "digital" but the set up does not set it that way, the default value for "style" is "long" as in
```
13. Let style be ? GetOption(options, "style", "string", « "long", "short", "narrow", "digital" », "long").
```
of https://tc39.es/proposal-intl-duration-format/#sec-Intl.DurationFormat

* Sync to PR 121

Change default from "long" to "short"
2022-09-14 12:51:40 -07:00
Frank Yung-Fong Tang 03cff7fcba Remove undefined to sync to PR 113
undefined is no longer value output for resolvedOptions().fractionalDigits
2022-09-14 12:42:53 -07:00
Jordan Harband 8f19bb4a45
Fix features in tests from #3354 and #3353 2022-09-14 11:30:22 -07:00
Justin Ridgewell 9592077530 Update groupToMap tests 2022-09-14 11:38:07 -07:00
polsevev ce511219e8 add tests for array.prototype.groupByToMap 2022-09-14 11:38:07 -07:00
Justin Ridgewell e7af14502e Test callback throwing 2022-09-14 11:02:48 -07:00
Justin Ridgewell 95f869ce0d Test non-property key throws 2022-09-14 11:02:48 -07:00
Justin Ridgewell 457185507e Add test for get access throwing 2022-09-14 11:02:48 -07:00
Justin Ridgewell 6cdb375d8c Add test for length conversion 2022-09-14 11:02:48 -07:00
Justin Ridgewell 22fe1b44b2 Update group tests 2022-09-14 11:02:48 -07:00
polsevev 5bd6844df5 added tests for groupBy 2022-09-14 11:02:48 -07:00
Philip Chimento 0bc0ca189d Temporal: Fix test that depends on pre-1970 time zone data
Due to the TZDB's recent merging of time zones whose pre-1970 data was
different but post-1970 have been the same, this test is going to start
failing on implementations with up-to-date time zone data (because the
Europe/Amsterdam time zone was absorbed into Europe/Brussels in the latest
update.)

It's on our to-do list to remove all dependencies on IANA time zones from
the Temporal tests in staging/,
(see https://github.com/tc39/test262/issues/3649#issuecomment-1232326175)
but this one is more urgent.
2022-09-14 18:06:40 +02:00
Philip Chimento e391176717 Apply suggestions from code review 2022-09-13 11:32:16 -07:00
Aditi c6b62110f9 Added intl tests for timezone and calendar case insensitivity 2022-09-13 11:32:16 -07:00
Aditi d7181a5866 Add timezone case insensitive tests 2022-09-13 11:32:16 -07:00
Aditi cf51de578f Add calendar case insensitive tests 2022-09-13 11:32:16 -07:00
Philip Chimento dc1dc28aa4 Add tests for proposal-resizable-arraybuffer to staging
These are tests for the Resizable ArrayBuffer proposal:
https://tc39.es/proposal-resizablearraybuffer/

These tests were automatically converted from V8's tests for the
proposal:
https://source.chromium.org/chromium/chromium/src/+/main:v8/test/mjsunit/typedarray-resizablearraybuffer.js
and subsequently edited by hand to fix things that couldn't be converted
automatically.
2022-09-08 11:49:06 -07:00
Kevin Gibbons 746197355c
Implement changes for "avoid mostly-redundant `await` in async `yield*`" (#3619) 2022-09-06 13:21:50 +02:00
Romulo Cintra f1870753fa Update Tests accoring with spec changes 2022-09-05 11:05:44 +02:00
Philip Chimento 051631f58b Temporal: Start moving collections of valid/invalid strings into TemporalHelpers
This adds an object, TemporalHelpers.ISO, which has methods that return
arrays of various ISO strings. The idea is to deduplicate more string
tests into methods on this object.
2022-08-31 08:59:33 -07:00
Philip Chimento ddef61a106 Temporal: Deduplicate strings-with-calendar from strings-without-calendar
The strings with calendar annotations in these tests don't need to be
listed separately, they can be derived from the original strings.
2022-08-31 08:59:33 -07:00
Philip Chimento 409d6dc71a Temporal: Add tests for PlainTime string disambiguation with calendar
This implements the normative change in
https://github.com/tc39/proposal-temporal/pull/2287 which reached
consensus at the July 2022 TC39 meeting.

It adds tests that ensure that PlainTime strings which require a T
designator for disambiguation, are not disambiguated by adding a calendar
annotation.
2022-08-31 08:59:33 -07:00
Philip Chimento d8e8529e8d Temporal: Add tests for PlainTime string disambiguation with time zone
This implements the normative change in
https://github.com/tc39/proposal-temporal/pull/2284 which reached
consensus at the July 2022 TC39 meeting.

It adds tests that ensure strings like HHMM-UU[TZ] and HHMMSS[TZ] do not
require a disambiguating T separator, even if HHMM-UU and HHMMSS would by
themselves.
2022-08-31 08:59:33 -07:00
Aditi 8dcc0e1955 Add calendar strings to instant string tests 2022-08-25 10:14:30 -07:00
Aditi 747bed2e8a Add intl in staging directory 2022-08-11 15:41:01 -07:00
Philip Chimento c4daf3ef74 Temporal: Add test for rounding Duration relative to Feb 1 in a leap year
This implements the normative change in
https://github.com/tc39/proposal-temporal/pull/2344 which reached
consensus at the July 2022 TC39 meeting.

It adds a test that catches a corner case in Duration.prototype.round().
2022-08-11 12:57:37 -07:00
Kevin Gibbons adba7dfd9c fix order 2022-08-09 12:15:49 -07:00
Kevin Gibbons 418419a345 add non-matching example 2022-08-09 12:15:49 -07:00
Kevin Gibbons 52284ba4bb add tests for proposal-duplicate-named-capturing-groups 2022-08-09 12:15:49 -07:00
Kevin Gibbons b42d184876 update descriptions for existing duplicate-capture-groups tests 2022-08-09 12:15:49 -07:00
Philip Chimento d45766bef3 Add cases to RegExp.prototype flags brand checking tests
For completeness, as we are doing in newer brand checking tests such as
those of Temporal, call these getters with a function object and a bigint
as the receiver.

Suggested in https://github.com/tc39/test262/pull/3614/files#r929662337
2022-08-09 12:07:36 -07:00
Richard Gibson 9e51a9d855 Update RegExp.prototype.{match,replace} tests to expect Get(rx, "flags")
Ref https://github.com/tc39/ecma262/pull/2791
2022-08-09 12:02:45 -07:00
Richard Gibson 29c36b0561 Meta: Link to engine262 instructions 2022-08-09 11:55:18 -07:00
Aditi 6a99a28dd8 Add proposal-temporal's old demitasse tests to staging 2022-08-09 11:44:54 -07:00
Jordan Harband 8c64a666e1
Meta: fix codeowners syntax 2022-08-04 16:28:45 -07:00
Ms2ger 66ecafff2b Add proposal-temporal's Temporal.Instant tests to staging
Now that we have a staging directory, we can add the old-style tests from
proposal-temporal and avoid having to sync PRs across two repositories
when we convert them to test262 style.

Ms2ger wrote a script to convert them to be executable with the test262
harness, and this is the result of running that script on the remaining
Temporal.Instant tests in proposal-temporal.

More tests of other Temporal types to follow.
2022-08-04 16:20:26 -07:00
Jordan Harband 033b79fde0 Meta: add CODEOWNERS
This requires @tc39/test262-maintainers approval for everything, but also allows @tc39/test262-staging approval for the `test/staging` directory.
2022-08-04 11:47:38 -07:00
Linus Groh 0f35848794 ShadowRealm: Relax requirements of globalThis available properties test
The intention of this test is to ensure that all built-in properties of
the global object are also exposed on the ShadowRealm's global object,
without penalizing implementations that don't have all of them
implemented.
Notably, SharedArrayBuffer may still not be (re-)enabled in all
circumstances.
2022-08-04 20:37:23 +02:00
Aditi e9f424b6fc Remove duplicate timezone tests 2022-08-04 11:03:46 +02:00
Yusuke Suzuki f74cee5f59 Rename Array#groupBy and Array#groupByToMap to Array#group and Array#groupToMap
TC39 decided to rename them to avoid web-compat issue[1].
This change follows to it.

[1]: https://github.com/tc39/proposal-array-grouping/pull/39
2022-08-03 13:29:11 -07:00
Philip Chimento 10a5c4f784 Temporal: Adjust and expand tests for observable calls to ToString(calendar)
This implements the normative change in
https://github.com/tc39/proposal-temporal/pull/2269 which reached
consensus at the July 2022 TC39 meeting.

There was already a test for PlainDate for this topic, which needs to be
adjusted to accommodate the normative change. Tests for PlainDateTime and
ZonedDateTime did not yet exist, so add new ones based on the PlainDate
test.
2022-08-03 14:23:40 +02:00
Philip Chimento 1587af3936 CI: Bump esvu to 1.2.9
1.2.8 does not install graaljs correctly.
2022-08-03 14:23:04 +02:00
Kevin Gibbons 4c0322569c add tests for "only coerce once in BigInt constructor" 2022-08-02 18:17:20 -07:00
André Bargull d7a10658d9 Replace time zone link name canonicalisation tests
Replace tests with more simple tests that only ensure link names are
accepted.
2022-08-01 14:13:30 -07:00