Commit Graph

6146 Commits

Author SHA1 Message Date
Philip Chimento 0178aa2114 Change Temporal.TimeZone.prototype.toJSON not to call toString
Normative PR: https://github.com/tc39/proposal-temporal/pull/2482
2023-04-07 11:43:31 -07:00
Philip Chimento 8c37094e1f Change Temporal.TimeZone compare semantics to use .id
Compare semantics for custom time zones that _don't_ extend
Temporal.TimeZone (and therefore don't have the internal slot) use the
value of the .id property, instead of calling toString().

Normative PR: https://github.com/tc39/proposal-temporal/pull/2482
2023-04-07 11:43:31 -07:00
Philip Chimento 960070549b Store strings or objects in Temporal.ZonedDateTime [[TimeZone]] slot
Normative PR: https://github.com/tc39/proposal-temporal/pull/2482
2023-04-07 11:43:31 -07:00
Philip Chimento f2871840b8 Replace Temporal.ZonedDateTime.timeZone getter with new API
This is the replacement of the old API with the new API, .timeZoneId and
.getTimeZone(). Semantics will be corrected in the following commit.

Normative PR: https://github.com/tc39/proposal-temporal/pull/2482
2023-04-07 11:43:31 -07:00
Philip Chimento 61d84cc6bc Change Temporal.Calendar.prototype.toJSON not to call toString
Normative PR: https://github.com/tc39/proposal-temporal/pull/2482
2023-04-07 11:43:31 -07:00
Philip Chimento aee3a937dc Change Temporal.Calendar compare semantics to use .id
Compare semantics for custom calendars that _don't_ extend
Temporal.Calendar (and therefore don't have the internal slot) use the
value of the .id property, instead of calling toString().

Normative PR: https://github.com/tc39/proposal-temporal/pull/2482
2023-04-07 11:43:31 -07:00
Philip Chimento 41ffc678b0 Store strings or objects in Temporal objects' [[Calendar]] slot
In several tests involving custom calendars, we need to change the
implementation of dateFromFields/monthDayFromFields/yearMonthFromFields so
that the returned object gets the receiver as its calendar after chaining
up to the builtin implementation.

Normative PR: https://github.com/tc39/proposal-temporal/pull/2482
2023-04-07 11:43:31 -07:00
Philip Chimento a1bf99771c Replace Temporal objects' .calendar getters with .calendarId/.getCalendar
This is the replacement of the old API with the new API. Semantics will be
corrected in the following commit.

Normative PR: https://github.com/tc39/proposal-temporal/pull/2482
2023-04-07 11:43:31 -07:00
Philip Chimento 55fdf60820 Remove calendar slot from Temporal.PlainTime
Has several effects on existing tests:
- Remove PlainTime from various tests that extract a Temporal.Calendar
  instance from another Temporal object.
- Remove Temporal.PlainTime.prototype.calendar property.
- Remove calendar property from object returned from
  Temporal.PlainTime.prototype.getISOFields().
- Ignore calendar annotation when converting ISO string to PlainTime.

Normative PR: https://github.com/tc39/proposal-temporal/pull/2482
2023-04-07 11:43:31 -07:00
Philip Chimento 27d7cdad4e Replace Temporal.Now.timeZone → Temporal.Now.timeZoneId
Now.timeZoneId() returns a string so that it can be used to construct
objects that have the builtin time zone behaviour.

Normative PR: https://github.com/tc39/proposal-temporal/pull/2482
2023-04-07 11:43:31 -07:00
Frank Tang beb4f26eb4 Remove unit of ":" in "digital" style. 2023-04-05 16:39:20 +02:00
Frank Tang 4fda9c4c01 Split DurationFormat style tests
For better parallization and reporting
2023-04-05 16:39:20 +02:00
Philip Chimento 92500bfffb
Array.fromAsync various remaining coverage (#3809)
This contains a few more tests for Array.fromAsync, in addition to what
has already been merged and what is under review at #3791.

This covers the following items from the testing plan at #3725:

- Success cases
  - Creates promise
  - Create new array/arraylike in promise (with length = length property)
- Input
  - Invalid input values
    - nonconforming object (arraylike without length, missing keys)
  - Covered by polyfill tests
    - Result promise rejects if length access fails (non-iterable input)
    - Unaffected by globalThis.Symbol mutation (non-iterable)
- this-value
  - this-value is a constructor
  - this-value is not a constructor
  - If this is a constructor, and items doesn't have a Symbol.iterator,
    returns a new instance of this
  - Iterator closed when property creation on this fails
  - Returned promise rejects when ^
- Other tests
  - Error is thrown for all CreateDataProperty fails
  - Non-writable properties are overwritten by CreateDataProperty
  - Input with missing values

Co-authored-by: Ms2ger <Ms2ger@igalia.com>
2023-04-04 11:20:25 +02:00
Justin Grant daefac0814 Add test to validate fix to proposal-temporal#2537
The Temporal polyfill had a math bug in Calendar.p.dateUntil where
non-ISO calendars would unexpectedly throw when calculating
the number of years between two dates where the year were different,
the month codes were different, but the months were the same because
the earlier date's month was after a leap month.

This test validates the fix to this bug.
2023-04-03 17:27:34 -07:00
Justin Grant aed56d9fa6 Add test to validate fix to proposal-temporal#2383
The Temporal polyfill had an infinite loop for non-ISO calendars
when Calendar.p.dateUntil was called to calculate the duration
between two identical dates. This test validates that PT0S is returned
in that case.
2023-04-03 17:27:34 -07:00
Philip Chimento be0abd93cd Add copies of resizable ArrayBuffer species constructor tests to BigInt folders
This adds copies of the tests added in the previous commit, to the
respective BigInt folders, editing them to use the testBigIntTypedArray
helper instead of the testTypedArray helper.

See: #3723
2023-03-31 16:52:42 -07:00
Aditi 8330bd6567 Add resizable ArrayBuffer tests in %%TypedArray%% 2023-03-31 16:52:42 -07:00
Huáng Jùnliàng ff405fd0df update fixtures 2023-03-29 12:54:37 -07:00
Huáng Jùnliàng a3880a460a update decorator member expr private id test cases 2023-03-29 12:54:37 -07:00
Jordan Harband 6da1d4c82c
Merge pull request #3796 from syg/transfertofixedlength-tests
Add tests for ArrayBuffer.prototype.transferToFixedLength
2023-03-28 00:34:15 -07:00
Shu-yu Guo 4a8135e01e Fix description of new-length-excessive 2023-03-28 00:28:28 -07:00
Shu-yu Guo 6fecc44859 Add tests for ArrayBuffer.prototype.transferToFixedLength
See https://tc39.es/proposal-arraybuffer-transfer/
2023-03-28 00:28:28 -07:00
Shu-yu Guo 9964fa962a
Add V8 tests for JSON.parse with source to staging/ (#3806) 2023-03-27 17:21:29 -07:00
Shu-yu Guo e0d4ca0577 Add JSON.parse with source feature tag 2023-03-27 16:27:51 -04:00
Jordan Harband 910a2764d8 Object.prototype.toString: avoid over-DRYness, and add preconditions 2023-03-27 11:21:34 +02:00
José Julián Espina 4a6439e4a7
Add `Array.prototype.includes` and `exponentiation` features (#3799) 2023-03-23 10:51:08 +01:00
Ms2ger 9704d7f22f
Add tests for the asyncItems argument to Array.fromAsync. (#3754)
Co-authored-by: Philip Chimento <pchimento@igalia.com>
2023-03-10 11:46:59 +01:00
Aditi 53e5ef817e Add Temporal era/eraYear tests 2023-03-07 16:00:10 -08:00
Philip Chimento c4d8f01d3d Array.fromAsync: Tests for mapfn and thisArg arguments
- normal case with synchronous and asynchronous mapfn
- a non-callable value is passed as mapfn
- behaviour of various values of thisArg in strict and sloppy mode
- mapfn result is awaited once per iteration
- iterator is closed when mapfn throws
2023-03-07 11:13:00 +01:00
Philip Chimento ba1e51c8e7 Fix function-valued properties in propertyBagObserver
A property in the property bag we want to observe may be a function, in
which case we don't want to treat it as a primitive and create a
toPrimitiveObserver for it.

(Also handle the null case, in which we should fall through to return a
toPrimitiveObserver.)
2023-03-07 11:13:00 +01:00
Richard Gibson 4f5eb40ee0 Temporal: Test updates for mergeFields output property order
Normative PR: https://github.com/tc39/proposal-temporal/pull/2505
2023-03-06 14:30:35 -08:00
Philip Chimento 5ea8322b08 Clarify feature flags are per proposal
As per discussion in https://github.com/tc39/test262/pull/3773
2023-03-06 17:31:20 +01:00
Philip Chimento 6bfcab1063 Remove unused "Intl.DateTimeFormat-quarter" feature flag
This was a needs-consensus PR that didn't reach consensus. The
corresponding tests were already removed in f7e6656c.

(Note, the link in the removed comment is wrong; it should point to
https://github.com/tc39/ecma402/issues/374)
2023-03-06 17:31:20 +01:00
Philip Chimento 7a5210deaf Clean up feature flags for proposals in published standard
This moves feature flags to the bottom section, for proposals that have
been included in a published revision of the standard (through ES 2022).
2023-03-06 17:31:20 +01:00
Philip Chimento a58ae41ea7 linter: Fix parsing features.txt
Previously, split() would split on whitespace, then the if-condition would
remove `#` - interpreting every word in every comment in the file as a
potential valid feature flag. We want splitlines() here.

Partial-line comments were inadvertently "supported" before, because of
this bug. Instead, support them explicitly by chopping off a `#`
character, anything after it, and any whitespace immediately preceding it.
2023-03-06 17:31:20 +01:00
Philip Chimento 6e1b737357 linter: Use same Python interpreter when executing script in subprocess
If a specific Python interpreter is used (e.g. by invoking the script with
"/path/to/python run.py") then we should use the same Python interpreter
to execute scripts in subprocesses, not the one from the environment.

The path to the running Python interpreter is given by sys.executable.
2023-03-06 17:31:20 +01:00
Cam d216cc1972 asyncHelpers implementation: Apply suggestions from code review
Co-authored-by: Philip Chimento <philip.chimento@gmail.com>
2023-02-21 11:04:09 -08:00
Cam Tenny eb44f67274 asyncHelpers tests: Address code review feedback 2023-02-21 11:04:09 -08:00
Cam Tenny e0d5b780e7 Update CONTRIBUTING.md to suggest using asyncHelpers 2023-02-21 11:04:09 -08:00
Cam Tenny 4fe158d39d Generated tests for refactoring (IIFE/async function).then(\$DONE, \$DONE); to use asyncTest 2023-02-21 11:04:09 -08:00
Cam Tenny 4d9d5c570d Refactor simple cases of (IIFE/async function).then(\$DONE, \$DONE); to use asyncTest 2023-02-21 11:04:09 -08:00
Cam Tenny 1d116b48a9 harness/asyncHelpers.js: Refactor asyncTest to always return undefined instead of a Promise 2023-02-21 11:04:09 -08:00
Cam Tenny d810c684ae harness/asyncHelpers.js: Refactor assert.throwsAsync to only accept a callable 2023-02-21 11:04:09 -08:00
Cam Tenny 4bd0545b29 harness/asyncHelpers.js: Remove dependency on Promise. 2023-02-21 11:04:09 -08:00
Cam Tenny 98952c3c51 harness/asyncHelpers.js: Refactor assert.throwsAsync to be async function 2023-02-21 11:04:09 -08:00
Cam Tenny 0294bea997 Harness tests for asyncHelpers.js' assert.throwsAsync function 2023-02-21 11:04:09 -08:00
Cam Tenny cb9b45ded2 Harness tests for asyncHelpers.js' asyncTest function 2023-02-21 11:04:09 -08:00
Cam Tenny c056d31b9b Adds harness/asyncHelpers.js: functions asyncTest and assert.throwsAsync, per rfcs/async-helpers.md 2023-02-21 11:04:09 -08:00
Philip Chimento 76a14bf659 Temporal: Tests for reference ISO dates
Tests for the process of calculating the reference ISO day for
Temporal.PlainYearMonth and the reference ISO year for
Temporal.PlainMonthDay.

Normative PR: https://github.com/tc39/proposal-temporal/pull/2475
2023-02-17 09:56:13 +01:00
Philip Chimento a29788dd5d Temporal: Tests for calendar-specific mergeFields
In https://github.com/tc39/proposal-temporal/pull/2474, which achieved
consensus at the TC39 plenary meeting of 2023-01-31, the implementation-
defined steps for Temporal.Calendar.prototype.mergeFields had their
language tightened, to better specify what implementations must do.

This adds tests covering the new spec language, and moves one related test
out of staging.
2023-02-16 12:00:30 -08:00