Commit Graph

5935 Commits

Author SHA1 Message Date
Mathias Bynens 3eaa7c9313 Update RegExp `\p{…}` tests per Unicode 15
Upstream commit: 859db0d6df

Issue: https://github.com/tc39/ecma262/issues/2904
2022-09-21 11:19:28 +02:00
Philip Chimento ef59ea225a Temporal: Add TemporalHelpers.propertyBagObserver()
Many existing tests use a Proxy to test the order of observable operations
on a property bag argument that gets passed in to a Temporal API. I am
going to write several more tests that do this, as well. This seems like a
good thing to put into TemporalHelpers, where it can be implemented
consistently so that we don't get discrepancies in which operations are
tracked. (For example, we had some tests which didn't test for an ownKeys
operation that was supposed to be there.)

Updates existing tests to use this helper.
2022-09-21 10:41:14 +02:00
Philip Chimento 38dd3c2823 Temporal: Consistently format property names in call logs
I've occasionally gotten bugs due to Get or Has operations being performed
on symbol-valued properties, and trying to format them inside backtick
strings, which throws. I've been meaning to consolidate this for a while
into a formatting function which nicely formats any kind of property key.
Now that I'm about to write more tests having to do with order of
observable operations, this seems like a good time to do it.

This is a refactor in temporalHelpers.js.
2022-09-21 10:41:14 +02:00
Philip Chimento 8b5dc0b1ef Temporal: Consistently test that calendar is copied in X.from()
We did this inconsistently in PlainDate and ZonedDateTime, and not in the
other calendar-carrying types. Additionally, we don't have to create the
calendar explicitly in PlainDate.
2022-09-21 10:41:14 +02:00
André Bargull c335322537 Add exhaustive test for String.prototype.substr with various number inputs
Also see: https://github.com/tc39/ecma262/pull/2844
2022-09-20 09:57:12 -07:00
Romulo Cintra 1714f231c7 Update:RangeError when useGrouping is string 'undefined' 2022-09-20 09:53:18 -07:00
Frank Yung-Fong Tang e17d44db65
Split withCalendar/calendar-case-insensitive.js to intl402 (#3670) 2022-09-20 10:24:48 +02:00
Shu-yu Guo 465cf4a5c0
Fix resizable ArrayBuffer subarray tests (#3671)
This is from the normative change in
https://github.com/tc39/proposal-resizablearraybuffer/pull/93, which
got consensus in the March 2022 TC39.
2022-09-19 17:45:26 -07:00
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