Commit Graph

5198 Commits

Author SHA1 Message Date
Philip Chimento 837def66ac Apply suggestions from code review
Co-authored-by: Ioanna M Dimitriou H <9728696+ioannad@users.noreply.github.com>
2024-03-27 17:49:35 -07:00
André Bargull 71f95c29bd Add tests for resizable array buffer views
Covers spec compliance issues in at least one of JSC, V8, or SM.
2024-03-27 17:49:35 -07:00
Ben Allen 634933a489 DurationFormat: test formatting for units using combinations of "long", "short", and "narrow" styles 2024-03-27 09:49:09 -07:00
Ben Allen 86b6eee25b Correct Intl.DateTimeFormat and Intl.DisplayNames metadata incorrectly identifying tests for 'en' locale as tests for 'en-US' 2024-03-26 09:13:11 -07:00
Ben Allen 39168e26c8 DurationFormat: changed metadata to list 'en' instead of 'en-US' as locale for tests that actually test 'en' rather than 'en-US' 2024-03-25 15:36:57 -07:00
Kevin Gibbons decf9f2526 re-run rewrite scripts 2024-03-25 15:22:57 -07:00
Kevin Gibbons 927a70d4df fix typo in test name 2024-03-25 15:22:57 -07:00
Kevin Gibbons 4f7a43afbd add tests for get/setFloat16 2024-03-25 15:22:57 -07:00
Kevin Gibbons 435dcc9f6e tests for Math.f16round 2024-03-25 15:22:57 -07:00
Rezvan Mahdavi Hezaveh db7c0d1499 [explicit-resource-management] Add using in bytecode generator
This CL adds `using` to bytecode generator. This CL does not include exception handling and JSDisposableStack methods.
Also, since `using` and `const` have the same behavior (except for disposing resources), we add required checks to the existing code.

Bug: v8:13559
Change-Id: I1d169859cc2a3e16c7cc9078219d5e4a466f4560
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/5270855
Commit-Queue: Rezvan Mahdavi Hezaveh <rezvan@chromium.org>
Reviewed-by: Leszek Swirski <leszeks@chromium.org>
Cr-Commit-Position: refs/heads/main@{#93014}
2024-03-25 19:18:58 +01:00
Kevin Gibbons 961480ac61 remove some auto-generated error messages in "assert.throws" tests 2024-03-25 12:09:10 +01:00
Kevin Gibbons 5424d7e834 rewrite tests to use verifyProperty 2024-03-25 12:05:06 +01:00
Ben Allen 0b1abd5ee7
Two tests previously assumed 'en' as locale for DurationFormat, assumption now made explicit (#4019) 2024-03-15 09:35:47 +01:00
Ben Allen af3890a10a update to reflect numeric minutes handling after https://github.com/tc39/proposal-intl-duration-format/pull/180 2024-03-13 12:00:37 +01:00
André Bargull 263ed65292 Remove locales with explicit u-hc Unicode extension
The tests are passing an explicit `hour12` option, which disables any
`hourCycle` option and any `u-hc` Unicode extension. Therefore passing
input locales with `u-hc` is invalid.

```js
let locale = "en-u-hc-h24";
let hcDefault = new Intl.DateTimeFormat(locale, { hour: "numeric" }).resolvedOptions().hourCycle;

assert.sameValue(hcDefault, "h24", "hour-cycle through Unicode extension");

let hc24 = new Intl.DateTimeFormat(locale, { hour: "numeric", hour12: false }).resolvedOptions().hourCycle;

// Incorrect assertion, because |hc24| uses |hour12|, which disables any
// hour-cycle option and the hour-cycle is determined from the locale "en".
// That means |hc24| will be "h23".
assert.sameValue(hc24, hcDefault);
```
2024-03-08 16:15:08 -08:00
Ron Buckton 46fc281430 Add tests for RegExp modifiers 2024-03-07 10:45:31 -08:00
Ioanna M. Dimitriou H 9e03c403e7 Test parsing error when using unicode escape sequences to express i, m, s
As suggested in https://github.com/tc39/test262/pull/3960#issuecomment-1966827213
2024-03-05 12:56:48 -08:00
Guillaume Emont 229a27bcbc Added new generated tests with uppercase I
Co-Authored-By: Ioanna M. Dimitriou H <idimitriou@igalia.com>
2024-03-05 12:56:48 -08:00
Cam Tenny 49a58a4716 Adds syntax tests for the RegExp modifiers proposal
Based on PR #3807 which had generated these tests from templates,
but was stuck due to issue #3808.

Co-Authored-By: Guillaume Emont <guijemont@igalia.com>
Co-Authored-By: Ioanna M. Dimitriou H <idimitriou@igalia.com>
2024-03-05 12:56:48 -08:00
André Bargull 62626e083b Update tests in built-ins/Object/defineProperty to use verifyProperty 2024-02-28 17:01:01 -08:00
André Bargull 03a0375267 Update built-ins/Object to use verifyProperty 2024-02-28 17:01:01 -08:00
André Bargull e108e876cd Update built-ins/Object/{create,freeze,seal} to use verifyProperty 2024-02-28 17:01:01 -08:00
André Bargull e3ba8cea11 Update built-ins/Object/defineProperties to use verifyProperty 2024-02-28 17:01:01 -08:00
André Bargull 3499832c3c Update built-ins/Object/defineProperty to use verifyProperty 2024-02-28 17:01:01 -08:00
Frank Yung-Fong Tang a2597599bc Add test for ECMA402 PR846
the calenar name should be canonicalized
Spec change https://github.com/tc39/ecma402/pull/846
2024-02-23 15:53:00 -08:00
Aditi 0fd1675f7e Temporal: Add weekOfYear() and yearOfWeek() tests for custom calendars 2024-02-21 10:40:18 -08:00
Aditi ae8fe25b5a Temporal: Tests for week-numbering algorithm 2024-02-21 10:40:18 -08:00
Nicolò Ribaudo c0e8eef81b
Add test for async module not blocking sync siblings (#3955) 2024-02-21 14:53:10 +01:00
Rezvan Mahdavi Hezaveh 45e740928f [test262] Add staging test for RegExp named groups (search)
This CL adds a staging test for testing test262 bot.

Bug: v8:13173
Change-Id: Id8982a3d18bca219133f672736064e4d57d6da59
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/5294455
Reviewed-by: Liviu Rau <liviurau@chromium.org>
Commit-Queue: Liviu Rau <liviurau@chromium.org>
Cr-Commit-Position: refs/heads/main@{#92372}
2024-02-16 18:21:13 +01:00
Rezvan Mahdavi Hezaveh 903f7fc74d [test262] Add staging test for RegExp named groups (replace)
This CL adds a staging test for testing test262 bot.

Bug: v8:13173
Change-Id: Id24a5b5665bbc491acd59c16ede80d6780bbd4b2
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/5293730
Commit-Queue: Liviu Rau <liviurau@google.com>
Reviewed-by: Liviu Rau <liviurau@chromium.org>
Cr-Commit-Position: refs/heads/main@{#92363}
2024-02-16 16:18:20 +01:00
Rezvan Mahdavi Hezaveh 6f7ae1f311 [test262] Add new staging test for RegExp named groups
This CL adds a staging test for testing test262 bot.

Bug: v8:13173
Change-Id: I7f3d3aa3fbcf30b08cf3ebf2c61a683b7d2cf7c6
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/5281634
Reviewed-by: Shu-yu Guo <syg@chromium.org>
Commit-Queue: Liviu Rau <liviurau@google.com>
Cr-Commit-Position: refs/heads/main@{#92345}
2024-02-15 16:48:14 +01:00
André Bargull e98ff6c984 (Shared)ArrayBuffer constructor validation happens in correct order
Add tests to ensure that:
1. First `byteLength` isn't larger than `maxByteLength`.
2. Then `OrdinaryCreateFromConstructor` is called.
3. And finally `Create{Shared}ByteDataBlock` is called.
2024-02-12 14:18:33 +01:00
André Bargull 53984cf8c5
Add test with non-IANA time zone names (#4005)
Time zone identifiers supported by ICU, but which aren't valid IANA
identifiers.

Implementations not supporting ECMA-402 are theoretically allowed to
support these identifiers, so the tests have to go into the "intl402"
directory.
2024-02-12 12:06:04 +01:00
Lucas Mirelmann 403ee414ab
Fix comment in allow-nlt-before-with.js (#4001)
The proposed syntax allows a line terminator before the `WithClause`.
2024-02-09 16:36:41 -08:00
Nicolò Ribaudo 866d24deb2 Improve test robustness 2024-02-09 16:28:05 -08:00
Nicolò Ribaudo 98938f4c0a Add tests for `-->` in the first line 2024-02-09 16:28:05 -08:00
Philip Chimento 49e56acc67 Temporal: Tests for date difference algorithm
This adds tests specifically for every kind of case that changes due to
the tweak to the date difference algorithm: differences from a longer
month to a shorter month, when the months are adjacent, in the same year
but not adjacent, and in different years.

Also adds tests for a case that does *not* change, but would trip on an
incorrectly implemented algorithm: when the intermediate months value
falls at the end of February.

There was incidental coverage of the change to the date difference
algorithm in other tests. Those are adjusted, as well.

Normative change: https://github.com/tc39/proposal-temporal/pull/2759
Consensus in February 2024
2024-02-09 16:03:33 -08:00
Igor Sheludko f742eb092d [test262] Add a new staging test for Array.p.flatMap
Bug: v8:14306
Change-Id: Ibc7a04288a0c31bfcf601aa864e02b6c067045c2
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/5259306
Reviewed-by: Shu-yu Guo <syg@chromium.org>
Commit-Queue: Igor Sheludko <ishell@chromium.org>
Cr-Commit-Position: refs/heads/main@{#92174}
2024-02-05 15:05:01 +01:00
Philip Chimento 3e7938c1f5 Temporal: Prevent arbitrary loops in NormalizedTimeDurationToDays
Adapts the tests that checked arbitrarily long loops, to now check that an
exception is thrown if the loop would happen.

Adds tests that exercise the newly added checks on return values of
getPossibleInstantsFor and getOffsetNanosecondsFor that limit UTC offset
shifts to 24 hours or less.

Also updates some step numbers in related tests.
2024-02-02 08:43:11 -08:00
Nicolò Ribaudo 584048ed08 Add additional tests for out-of-range date-times
- https://github.com/tc39/proposal-temporal/pull/2727#discussion_r1414066610
- https://github.com/tc39/proposal-temporal/pull/2727#discussion_r1414065876
- https://github.com/tc39/proposal-temporal/pull/2727#discussion_r1414067272
2024-01-31 08:22:05 -08:00
André Bargull 0de91996e7 Add tests for precise results in Duration.p.total and ZonedDateTime.p.hoursInDay
The existing tests didn't cover some edge cases where implementations
have to compute the exact result of `numerator / denominator`, where at
least one of `numerator` and `denominator` can't be exactly represented
by an IEEE-754 double precision floating point value.

"precision-exact-mathematical-values-5.js" gets added in #3961, so the
new tests from this commit start at "precision-exact-mathematical-values-6.js".
2024-01-31 08:22:05 -08:00
Philip Chimento 99d5bc8c1b Temporal: Limit duration years, months, and weeks to <2³² each 2024-01-31 08:22:05 -08:00
Philip Chimento 01ec9938bb Temporal: Limit day length calculations to safe integers
NormalizedTimeDurationToDays can no longer loop indefinitely, because at
a certain point we will hit the upper bound of MAX_SAFE_INTEGER, so rename
the test to reflect that it can loop an arbitrary but limited number of
times.

Add a test for the RangeError condition in NormalizedTimeDurationToDays
when the time zone calculates a day length that is not a safe integer
number of nanoseconds.

While editing these tests, rename them to match the current name of the AO
and make sure the step numbers are up to date. (Normally I wouldn't care
so much about that, but these tests can be pretty confusing so it's good
to be able to refer to the spec text.)
2024-01-31 08:22:05 -08:00
Philip Chimento 092337c8d0 Temporal: Adapt tests to upper bound on time portion of durations
Adapts or removes tests that relied on creating durations that are now out
of range. Adds new tests for maximum in-range and minimum out-of-range
durations.
2024-01-31 08:22:05 -08:00
Michael Ficarra e4f91b6381
fix broken Iterator.prototype constructor/Symbol.toStringTag tests (#3996)
* fix broken Iterator.prototype constructor/Symbol.toStringTag tests

* fix lint: unused includes
2024-01-24 17:37:28 -08:00
Ioanna M. Dimitriou H fed13c1915 Tests using yield*, also to test codepath via .throw()
This includes the test case mentioned in ecma262 issue comment:
https://github.com/tc39/ecma262/issues/1849#issuecomment-576912421

Also using yield* we can test the changes to AsyncFromSyncIteratorContinuation
when called via .throw().
2024-01-23 13:31:50 -08:00
Ioanna M. Dimitriou H 2e44b8f13f Test that the sync iterator called via for-await-of closes
when a rejected promise is returned normally by the iterator.

These tests correspond to this normative changes example:
https://docs.google.com/presentation/d/1W9EJoWOvi6jU1A2bwyixzOceoP_ASAeaOYER3Zy9P00/edit#slide=id.g10c9207737d_0_31
2024-01-23 13:31:50 -08:00
Ioanna M Dimitriou H 1f380f3750
Test closing async-from-sync iterator when resolving result promise abrupt completes. (#3977)
* Test closing async-from-sync iterator when resolving result promise abrupt completes.

These test new steps 6-6.a of AsyncFromSyncIteratorContinuation
as per normative changes of ecma626 PR 2600
https://github.com/tc39/ecma262/pull/2600

* Apply suggestions from code review

Co-authored-by: Kevin Gibbons <bakkot@gmail.com>

* Apply suggestions from code review

Co-authored-by: Nicolò Ribaudo <hello@nicr.dev>

* Refactoring tests to use the Async Helpers.

---------

Co-authored-by: Kevin Gibbons <bakkot@gmail.com>
Co-authored-by: Nicolò Ribaudo <hello@nicr.dev>
2024-01-23 13:26:02 -08:00
Ioanna M Dimitriou H 2c58671789
Async-from-sync test the iterator closes when .throw() is undefined (#3976)
* Adjust existing tests to match new spec for async-from-sync iterators

Testing normative changes of ecma626 PR 2600

* Test that async-from-sync iterator closes when throw is undefined.

These test paths from newly added call to IteratorClose in step 7.c of
 %AsyncFromSyncIteratorPrototype%.throw
as per normative changes of ecma626 PR 2600

* Apply suggestions from code review

Co-authored-by: Jordan Harband <ljharb@gmail.com>

* Refactoring tests to use the Async Helpers.

Addresses review comments
- https://github.com/tc39/test262/pull/3976/files#r1451071569
- https://github.com/tc39/test262/pull/3976/files#r1451075479

---------

Co-authored-by: Jordan Harband <ljharb@gmail.com>
2024-01-23 13:16:58 -08:00
Michael Ficarra 17ba9aea47
update constructor and Symbol.toStringTag properties on Iterator.prototype (#3970)
* update constructor and toStringTag properties on Iterator.prototype

* includes cannot be empty for some reason

* update description

* add esid

* updates

* freeze Iterator.prototype

* don't try to use real GeneratorPrototype for these tests
2024-01-15 15:40:01 -08:00
Nicolò Ribaudo bebce4a5ee Make sure that the test always throws a SyntaxError 2024-01-15 15:16:53 -08:00
Nicolò Ribaudo 8b1bd25b49 Do not expect specific error type in import-attributes/allow-nlt-before-with.js
Hosts are free to throw whatever error they want during module loading: there is no guarantee that the error thrown due to the import with `type: "foo"` is a SyntaxError.
2024-01-15 15:16:53 -08:00
Justin Grant a1ba783ca3 Add 402 staging tests: Islamic & Persian calendars
Tests the changes in https://github.com/tc39/proposal-temporal/pull/2743
2024-01-12 16:42:31 -08:00
Kevin Gibbons 9c4e0fd902
introduce nonClampedIntArrayConstructors (#3984) 2024-01-11 11:35:28 +01:00
Rezvan Mahdavi Hezaveh 080f11f2ad The difference between two sets is `[1]`. 2024-01-11 00:23:14 +00:00
Kevin Gibbons c8cd136888
More set methods tests (#3966)
* add tests for difference, intersection, symmetricDifference

* add tests for predicates

* more tests for ordering of calls

* fix copyrights

* add missed -0 test

* pass argument to methods, not just this

* assert methods return new objects

* typo in filename

* fix parens

* Update test/built-ins/Set/prototype/difference/add-not-called.js

Co-authored-by: Jordan Harband <ljharb@gmail.com>

* fix isSupersetOf/set-like-array.js

* add tests for negative zero with isDisjointFrom and isSupersetOf

* fix message in isSupersetOf/converts-negative-zero.js

* address comments from review

---------

Co-authored-by: Jordan Harband <ljharb@gmail.com>
2024-01-10 12:52:41 -08:00
Ben Allen 80590ce79a Added tests to verify that use of "long", "short", or "narrow" styles for units following units using "numeric" or "2-digit" styles throws 2024-01-10 14:50:08 +01:00
Kevin Gibbons 67a5153cf5
add Float16Array to all generic TypedArray tests (#3849) 2024-01-10 14:07:57 +01:00
Kevin Gibbons 5a263f5b19 add the TypedArray feature flag to some tests which were missing it 2024-01-08 17:21:46 -08:00
Michael Dyck 816b6b14d8 Delete trailing space from "info: |" lines 2024-01-08 16:04:41 +01:00
Michael Dyck c194ad6936 Delete extra slash in Copyright section 2024-01-08 16:04:41 +01:00
Jordan Harband 4393acd575 Array length: add test ensuring RangeError is thrown 2024-01-08 15:41:52 +01:00
Lucas Mirelmann b628e4b054 Update single-line-html-close.js
Fix comment with the description of the syntax
2023-12-18 09:42:42 -05:00
Philip Chimento 6cbb6da947 Temporal: Change overflow behaviour of PYM/PMD.toPlainDate
These tests cover the proposed normative change:
https://github.com/tc39/proposal-temporal/issues/2706
2023-12-04 14:59:58 -08:00
Linus Groh 32540f3034 Fix property name in Atomics.isLockFree() descriptor test 2023-12-04 13:48:06 +01:00
Rezvan Mahdavi Hezaveh 467a0fe68f [test262] Add staging tests for isSubsetOf set method
This CL adds three tests to staging directory of test262.

Bug: v8:13556
Change-Id: Id6e468a0fa29528350a10c94e9dd19c2835788e8
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/5055866
Reviewed-by: Liviu Rau <liviurau@chromium.org>
Commit-Queue: Liviu Rau <liviurau@google.com>
Cr-Commit-Position: refs/heads/main@{#91139}
2023-11-27 18:49:17 +01:00
Richard Gibson 2060494f28 Test for assignment with target wrapped in two sets of parentheses 2023-11-21 09:51:03 -05:00
Kevin Gibbons 718aa71683 Consolidate set methods features 2023-11-20 09:17:29 +01:00
Philip Chimento 27a7501893 Temporal: Limit year, month, and week length calculations to nonzero
Tests with conditions that would trip a division by zero in
implementations if they didn't carefully implement the spec.
2023-11-16 11:08:42 -08:00
Philip Chimento bcb409148d Temporal: Remove loops in RoundDuration 2023-11-16 11:08:42 -08:00
Philip Chimento e43e20a885 Temporal: Remove BigInt arithmetic and loops in BalanceDurationRelative
A few results change because the algorithm previously used for rounding
didn't always add duration units to dates in RFC 5545 order, and we also
introduce a special case for rounding with largestUnit years or months and
smallestUnit weeks.
2023-11-16 11:08:42 -08:00
Philip Chimento 50abc12d97 Temporal: Remove BigInt arithmetic and loops in UnbalanceDurationRelative 2023-11-16 11:08:42 -08:00
Anthony Frehner 60310b70bc
Add Set.prototype.union tests (#3816)
* Beginning of adding Set.prototype.union tests

* Fix description

* Add tests for GetSetRecord

Which also allows Set-like objects

* Add title to test descriptions

* Add test for ensuring values are appended

* Add tests for properties of union

Also: tests for RequireInternalSlot, Constructor, BuiltIns.

Added a test to ensure that -0F is converted to +0F

* Ensure Set.prototype.add is not called as part of .union

* fix lint issues

* Set subclassing and Symbol.species tests

* Set.prototype.union tests for arrays and subclass methods

* Add the Set-methods frontmatter feature flag

* Add additional Set.prototype.union test for edge cases

* Update test/built-ins/Set/GetSetRecord/keys-is-callable.js

Co-authored-by: Kevin Gibbons <bakkot@gmail.com>

* Use compareArray() for assertions

* Remove class field syntax

* Remove unused args

* Update test/built-ins/Set/prototype/union/subclass-receiver-methods.js

Co-authored-by: Jordan Harband <ljharb@gmail.com>

* Return original 'add'

* address comments

* add one more mutation in the evil mutating iterator test

* address further comments

---------

Co-authored-by: Kevin Gibbons <bakkot@gmail.com>
Co-authored-by: Jordan Harband <ljharb@gmail.com>
Co-authored-by: Ms2ger <Ms2ger@igalia.com>
2023-11-15 17:55:47 +01:00
Philip Chimento 5962be6d66 Temporal: Combine expected relativeTo operations for readability in Duration.compare
Code review suggestion from Richard.
2023-11-14 11:44:00 -08:00
Philip Chimento dc1c787cc8 Temporal: Make calendar method lookups unconditional
See https://github.com/tc39/proposal-temporal/issues/2724
2023-11-14 11:44:00 -08:00
Philip Chimento 3e23610431 Temporal: Make time zone method lookups unconditional
See https://github.com/tc39/proposal-temporal/issues/2724
2023-11-14 11:44:00 -08:00
Philip Chimento 7c41695f78 Adjustments to tests for added invocations of BalanceDurationRelative
In order to fix tc39/proposal-temporal#2563, we added invocations of
BalanceDurationRelative after some invocations of RoundDuration. These
cause observable calendar calls, which must be accounted for in some
existing tests.
2023-11-14 10:03:45 -08:00
Philip Chimento 93304c7571 Tests for Duration rounding bug when rounding crosses a unit boundary
See https://github.com/tc39/proposal-temporal/issues/2563

The old behaviour was encoded in one test in staging, but the behaviour of
largestUnit in duration rounding has changed since that test was written.
Therefore I'm assuming that toString() should've been updated when that
happened.
2023-11-14 10:03:45 -08:00
Frank Tang 96727cae1c Add test for firstDayOfWeek in LocaleInfo PR 70
Test for enhancement in
https://github.com/tc39/proposal-intl-locale-info/pull/70
2023-11-10 18:11:03 -08:00
André Bargull 873f260478 Update likely subtags tests for CLDR 44 2023-11-08 13:48:33 +01:00
André Bargull 4d44acbc03 Update case folding tests for Unicode 15.1
Unicode 15.1 added the following "simple" case-folding entries:
```
1FD3; S; 0390; # GREEK SMALL LETTER IOTA WITH DIALYTIKA AND OXIA
1FE3; S; 03B0; # GREEK SMALL LETTER UPSILON WITH DIALYTIKA AND OXIA
FB05; S; FB06; # LATIN SMALL LIGATURE LONG S T
```
2023-11-08 13:43:44 +01:00
Ben Allen 99ac701b43
Test invalid region tags in Intl.DisplayNames.prototype.of() (#3900) 2023-11-07 15:09:53 +01:00
Philip Chimento 2a804d6c33 Temporal: Avoid extra Zoned→Plain conversion in AddDuration
Two more test cases for a fast path that previously wasn't tested.
2023-11-06 14:46:36 -08:00
Philip Chimento c5dd01f7c0 Temporal: Look up calendar methods only once 2023-11-06 14:46:36 -08:00
Philip Chimento 911fe9612e Temporal: Look up time zone methods only once 2023-11-06 14:46:36 -08:00
Veera c1281dba45 Test for Unicode Escape in Literals 2023-10-31 16:57:41 -07:00
Liviu Rau 8162f8c58f [test262] Add set method tests to staging
Reland https://crrev.com/c/4913993

This CL adds three tests from test methods tests to staging
directory with correct format.

Bug: v8:13556
Change-Id: I93817eb84e077436071dbae98bc800dd58851f91
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/4983674
Reviewed-by: Michael Achenbach <machenbach@chromium.org>
Commit-Queue: Liviu Rau <liviurau@google.com>
Cr-Commit-Position: refs/heads/main@{#90645}
2023-10-27 19:28:54 +02:00
Nicolò Ribaudo 0a6dabf1e2 Add readmes 2023-10-26 18:21:19 -07:00
Nicolò Ribaudo 41515e87e5 Use import-attributes flag in new generated tests 2023-10-26 18:21:19 -07:00
Nicolò Ribaudo 3ddb9e5e95 Update import attributes tests to use the `with` keyword 2023-10-26 18:21:19 -07:00
Nicolò Ribaudo 06f6ae960a Copy all import assertions tests as a basis for import attributes tests 2023-10-26 18:21:19 -07:00
Philip Chimento 892a5dccd2 Temporal: Use propertyBagObserver in monthDayFromFields test 2023-10-26 12:37:43 -04:00
Philip Chimento f4377a7cf0 Temporal: Fix test to check for TypeError with only one of era/eraYear
These tests were incorrect, in checking for a RangeError when only one of
the era/eraYear fields were given. From CalendarResolveFields:

"The operation throws a *TypeError* exception if the properties of
_fields_ are internally inconsistent within the calendar or insufficient
to identify a unique instance of _type_ in the calendar."
2023-10-26 12:37:43 -04:00
Philip Chimento dab8ccc5df Temporal: Add more coverage for non-ISO PlainMonthDay underspecification
Built-in non-ISO calendars require either monthCode/day, or month/day plus
some form of year specification.

This adds test coverage for each of the categories listed in
https://github.com/tc39/proposal-temporal/issues/2664, of which some must
currently reside in the test/intl402/ folders.
2023-10-26 12:37:43 -04:00
Philip Chimento 8bc3dbb234 Temporal: Move non-ISO calendar tests to intl402/
We'll do this for now, then separately work on migrating all of the tests
that require a non-ISO8601 calendar but aren't dependent on it being any
particular calendar.
2023-10-26 12:37:43 -04:00
Richard Gibson 5c629683f2 Temporal: Update PlainMonthDay-related tests
As of https://github.com/tc39/proposal-temporal/pull/2500 ,
year is always optional for the ISO 8601 calendar.
2023-10-26 12:37:43 -04:00
Philip Chimento 96bc38f5d9 Temporal: Exhaustive coverage for compare() methods
This adds coverage for each possible outcome of compare(), where each unit
is greater, lesser, or equal.
2023-10-18 09:27:24 -07:00
Philip Chimento 1f0fc4e0ad Temporal: Tests for PlainDateTime exposed in DisambiguatePossibleInstants
In the AO DisambiguatePossibleInstants, a PlainDateTime instance is passed
to user code. This instance should have the built-in ISO 8601 calendar.
Here are some tests that ensure it does.

See tc39/proposal-temporal#2671.
2023-10-18 09:27:24 -07:00
Philip Chimento 70c36b6584 Temporal: Tests for dates out-of-range when finding end of month
In PlainYearMonth arithmetic, we need to find the end of the month when
adding a negative duration or subtracting a positive one. This end of the
month can be out of range.

Test case based on one provided by Anba. See issue:
https://github.com/tc39/proposal-temporal/issues/2700
2023-10-18 09:27:24 -07:00
Philip Chimento 0b75d626b9 Temporal: Tests for durations out-of-range when added to relativeTo
Test case based on one provided by Anba. See issue:
https://github.com/tc39/proposal-temporal/issues/2697
2023-10-18 09:27:24 -07:00
André Bargull f0c16faee2 Fix symbol-tag-generators-builtin.js
Two issues:
1. There was a typo, the first `gen` should have been `genFn`.
2. And the last `toString` result should be `'[object Generator]'`,
   because `Object.getPrototypeOf(gen) == genFn.prototype`. And the
   `@@toStringTag` property of `genFn.prototype` is inherited from
   `Generator.prototype[@@toStringTag]`.

That also means the "iterator-helpers" flag isn't needed for this test.
2023-10-10 15:44:17 +02:00
Jordan Harband e0436fc52d Object.prototype.toString: improve coverage 2023-10-05 12:15:27 -07:00
Jordan Harband 45d52b90ee Object.prototype.toString: split Symbol.toStringTag tests into separate files
See https://github.com/tc39/test262/pull/3855#issuecomment-1593543655
2023-10-05 12:15:27 -07:00
Daniel Minor 55e8cceb80 Revert "Revert "Fixup class names in class decorator private identifier tests.""
This reverts commit 31f703cbe69ec2e0fd4b94de2fdf505fb722b552.

The changes are needed to both the templates and the generated files.
2023-10-05 10:23:12 -07:00
Daniel Minor 3ef0777c04 Revert "Fixup class names in class decorator private identifier tests."
This changed the test files, not the templates used to generate the tests.
2023-10-05 10:23:12 -07:00
Daniel Minor 581de2d0f8 Fixup class names in class decorator private identifier tests.
For the statement level test, the inner class name is not initialized
at the time the decorators evaluate, resulting in a ReferenceError
that the declaration can not be accessed prior to initialization.

Similar, non-decorator code, like:
    class C {
        static dec() {}
        static {
            this.x = C.dec();
            class C {}
        }
    }
also results in a ReferenceError.

For the expression level test, the var C is undefined at the time the
decorators are evaluated, resulting in TypeError while trying to access
a member of undefined.

Similar, non-decorator code, like:
    var C = class {
        static f() {};
        static {
            this.x = C.f();
        }
    }
also results in a TypeError.
2023-10-05 10:23:12 -07:00
Philip Chimento dceb204259 Temporal: Tests for absolute value bug in duration rounding no-op conditions
Repeat all the existing tests for no-op duration rounding operations, but
with negative durations.
2023-10-04 15:35:39 -07:00
Philip Chimento c04b417f66 Temporal: Precalculate PlainDateTime from ZonedDateTime in more places 2023-10-04 15:35:39 -07:00
Philip Chimento 3a57a424e0 Temporal: Look up getOffsetNanosecondsFor only once when resolving ambiguous datetime 2023-10-04 15:35:39 -07:00
Philip Chimento 9b8d9cf66c Temporal: Fast-path dateUntil() when difference largest unit is days
This removes several loopholes where it was possible to return particular
values from user calls that would cause infinite loops, or calculate
zero-length days.
2023-10-04 15:35:39 -07:00
Philip Chimento 7a3944c0cc Temporal: Fast-path differences between identical objects 2023-10-04 15:35:39 -07:00
Philip Chimento 34ce4bd53a Temporal: Fast-path dateAdd() when adding only days 2023-10-04 15:35:39 -07:00
Philip Chimento da3dd8802f Temporal: Avoid calendar operations when adding days-only duration to PlainDate 2023-10-04 15:35:39 -07:00
Philip Chimento b5a5b283a3 Temporal: Fast-path AddDaysToZonedDateTime in AddZonedDateTime 2023-10-04 15:35:39 -07:00
Philip Chimento 8040379076 Temporal: Avoid calendar operations when adding days-only duration to ZDT
This allows removing several tests, as calendar.dateAdd() is no longer
called in several places, and it's no longer possible to create a
situation where BigInt arithmetic is observable in NanosecondsToDays.
2023-10-04 15:35:39 -07:00
Ben Allen d2a6e21ff9 added missing features: line to metadata for two tests 2023-10-04 15:06:25 -07:00
Ben Allen 47eb8dd685
Update to reflect normative change in formatting when Intl.DurationFormat's fractionalDigits option is undefined (#3890) 2023-10-03 13:32:13 +02:00
Ben Allen 5e6f25bb4f added clarifying comments on hourCycle-dateStyle.js 2023-10-02 14:39:52 -07:00
Ben Allen 5606c3012e corrected hourCycle-default.js to handle language tags with -u-hc-h24 extension 2023-10-02 14:39:52 -07:00
Ben Allen 800d136d96 updated hourCycle-default.js to reflect new behaviour of hourCycle, which now associates h12 with h23 rather than h24. see https://github.com/tc39/ecma402/pull/758. 2023-10-02 14:39:52 -07:00
Ben Allen 63456adb38 created type-language-invalid.js for DisplayNames.prototype.of()
Co-authored-by: Richard Gibson <richard.gibson@gmail.com>
2023-10-02 14:01:04 -07:00
André Bargull 9f5938bc15 Fix harness tests for verifyProperty 2023-10-02 11:27:59 +02:00
Alexey Shvayka be53234590
Test that `HasVarDeclaration` accounts for bindings created via `eval()` (#3914)
Co-authored-by: Alexey Shvayka <ashvayka@apple.com>
2023-09-28 18:16:33 +02:00
Frank Yung-Fong Tang 6789b50cce
Add test for ECMA402 PR 788 (#3917)
* Add test for ECMA402 PR 788

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

* Fix misunderstanding about "+00:00"

* Fix lint

* Swap actual, expected position

* Update test/intl402/DateTimeFormat/prototype/resolvedOptions/offset-timezone-change.js

Co-authored-by: Richard Gibson <richard.gibson@gmail.com>

* Update test/intl402/DateTimeFormat/prototype/resolvedOptions/offset-timezone-basic.js

Co-authored-by: Richard Gibson <richard.gibson@gmail.com>

* Update test/intl402/DateTimeFormat/prototype/formatToParts/offset-timezone-correct.js

Co-authored-by: Richard Gibson <richard.gibson@gmail.com>

* Update test/intl402/DateTimeFormat/constructor-invalid-offset-timezone.js

Co-authored-by: Richard Gibson <richard.gibson@gmail.com>

* Update test/intl402/DateTimeFormat/constructor-invalid-offset-timezone.js

Co-authored-by: Richard Gibson <richard.gibson@gmail.com>

* Update test/intl402/DateTimeFormat/prototype/resolvedOptions/offset-timezone-change.js

Co-authored-by: Richard Gibson <richard.gibson@gmail.com>

* Update test/intl402/DateTimeFormat/constructor-invalid-offset-timezone.js

Co-authored-by: Richard Gibson <richard.gibson@gmail.com>

* Update test/intl402/DateTimeFormat/prototype/format/offset-timezone-gmt-same.js

Co-authored-by: Richard Gibson <richard.gibson@gmail.com>

* Update test/intl402/DateTimeFormat/prototype/format/offset-timezone-gmt-same.js

Co-authored-by: Richard Gibson <richard.gibson@gmail.com>

* Update test/intl402/DateTimeFormat/prototype/formatToParts/offset-timezone-correct.js

Co-authored-by: Richard Gibson <richard.gibson@gmail.com>

---------

Co-authored-by: Richard Gibson <richard.gibson@gmail.com>
2023-09-26 09:22:50 -07:00
Frank Yung-Fong Tang b5fd799fa0
Add Tests for ECMA402 PR811 (#3911)
* Add Tests for ECMA402 PR811

Add tests to check the order of option readings and output
keys in resolvedOptions of Intl.NumberFormat and PluralRules.

* Address reveiw feedback

Hard code the list of property to be inspect for GetOption
Use compareArray

* Update test/intl402/NumberFormat/constructor-option-read-order.js

Co-authored-by: Richard Gibson <richard.gibson@gmail.com>

* Update test/intl402/NumberFormat/constructor-option-read-order.js

Co-authored-by: Richard Gibson <richard.gibson@gmail.com>

* Update test/intl402/NumberFormat/prototype/resolvedOptions/return-keys-order-default.js

Co-authored-by: Richard Gibson <richard.gibson@gmail.com>

* Update test/intl402/PluralRules/constructor-option-read-order.js

Co-authored-by: Richard Gibson <richard.gibson@gmail.com>

* Update test/intl402/PluralRules/constructor-option-read-order.js

Co-authored-by: Richard Gibson <richard.gibson@gmail.com>

* Fix intl402/PluralRules/prototype/resolvedOptions/return-keys-order-default.js

To test all options

* Add more tests

---------

Co-authored-by: Richard Gibson <richard.gibson@gmail.com>
2023-09-26 08:58:27 -07:00
André Bargull 989377d62d Fix import assertions tests
- Correct file paths in "ensure-linking-error_FIXTURE.js"
- Remove no longer valid assertion in "import-assertion-empty.js".

See also #3919.
2023-09-25 08:33:51 -07:00
André Bargull 16fc2e5e18 Use correct variables in time zone case insensitive test
Also remove `US/Pacific-New` which has been removed from tz data since
release 2020b.
2023-09-22 09:02:08 -07:00
Shu-yu Guo dd30d83e9e Fix 'wrtiable' typos 2023-09-19 17:09:33 -07:00
Rezvan Mahdavi Hezaveh 79f087814f
Update two constructor tests of Array.fromAsync (#3926)
* Update two constructor tests of Array.fromAsync

* Remove extra comment

---------

Co-authored-by: Rezvan Mahdavi Hezaveh <rezvan@chromium.org>
2023-09-18 17:45:49 -07:00
Mathias Bynens 59bad89898
Add Unicode v15.1.0-sensitive `IdentifierPart` tests (#3833)
Ref. https://github.com/tc39/ecma262/issues/3073
2023-09-15 12:27:42 +02:00
Frank Yung-Fong Tang 3c9b3913b2
Add Collator test for ignorePunctuation (#3913)
Test the explicit setting of ignorePunctuation in the option bag
reflect to the value in resolvedOptions() under Thai and
other locales. (Thai is a special case)

Test the behavior of the compare sync with the value of
resolvedOptions().ignorePunctuation
2023-09-13 17:48:22 +02:00
André Bargull 1bd99bf069 Remove excess leading whitespace 2023-09-13 16:05:40 +02:00
André Bargull c140af3cb3 Update other test/language tests to use verifyProperty 2023-09-13 16:05:40 +02:00
André Bargull a7ee7473b7 Use verifyProperty in language/arguments-object tests 2023-09-13 16:05:40 +02:00
André Bargull f2275d23f4 Use verifyProperty in language/literals tests 2023-09-13 16:05:40 +02:00
André Bargull e6f1feb04d Use verifyProperty in language/global-code tests 2023-09-13 16:05:40 +02:00
André Bargull 8ff30c73ce Use verifyProperty in language/eval-code tests 2023-09-13 16:05:40 +02:00
André Bargull 08a7b9d4b6 Use verifyProperty in language/expressions tests 2023-09-13 16:05:40 +02:00
André Bargull ff81dccfc3 Use verifyProperty in language/statements tests 2023-09-13 16:05:40 +02:00
André Bargull 99096762ca Use verifyProperty in remaining test/intl402 tests 2023-09-13 16:05:40 +02:00
André Bargull f32dc36f3e Use verifyProperty in test/intl402/PluralRules tests 2023-09-13 16:05:40 +02:00
André Bargull ad3f1a6ade Use verifyProperty in test/intl402/NumberFormat tests 2023-09-13 16:05:40 +02:00
André Bargull fe2c17bf4b Use verifyProperty in test/intl402/DateTimeFormat tests 2023-09-13 16:05:40 +02:00
André Bargull 967b16500a Use verifyProperty in test/intl402/Collator tests 2023-09-13 16:05:40 +02:00
André Bargull 534decc36d Fix typos in calls to verifyProperty
And update verifyProperty to catch misspelled descriptor fields.
2023-09-13 16:05:40 +02:00
Frank Tang bba19d51ae Sync Intl Locale API tests w/ PR67
https://github.com/tc39/proposal-intl-locale-info/pull/67
2023-09-13 16:01:07 +02:00
Nicolò Ribaudo 1bb53aee3e
Update import attributes `assert` tests to current semantics (#3919)
Co-authored-by: Jordan Harband <ljharb@gmail.com>
2023-09-13 11:35:06 +02:00
Philip Chimento e98bfb332e Temporal: Do away with CalculateOffsetShift in Duration.compare 2023-09-13 10:57:43 +02:00
Philip Chimento 5972c16b07 Temporal: Return early from Duration.compare if internal slots equal 2023-09-13 10:57:43 +02:00
Philip Chimento 80958c3267 Temporal: Avoid reconverting Zoned- to PlainDateTime in AddZonedDateTime 2023-09-13 10:57:43 +02:00
Philip Chimento a74fbada42 Temporal: Don't observably iterate array in built-in calendar's fields()
Note the monkeypatch of getPossibleInstantsFor in test/built-ins/Temporal/
TimeZone/prototype/getInstantFor/argument-builtin-calendar-no-array-
iteration.js.

Other than that, all the tests are basically identical.
2023-09-13 10:57:43 +02:00
Philip Chimento fdd44e2ea5 Temporal: Separate zoned and plain operations in RoundDuration
Adds new tests to order-of-operations.js in Duration.round and
Duration.total, to exercise the code path where previous to this normative
change, relativeTo would have been converted to PlainDate 3x and 2x,
respectively.
2023-09-13 10:57:43 +02:00
Philip Chimento 008b97932b Temporal: Don't convert relativeTo to PlainDate twice in Duration.compare 2023-09-13 10:57:43 +02:00
Philip Chimento 0a6341de65 Temporal: Call user code on relativeTo only when necessary in RoundDuration 2023-09-13 10:57:43 +02:00
Philip Chimento f44bbe4035 Temporal: Avoid calling user code in no-op round operations
This shortcut path now exists in all round(), since(), and until()
operations.
In Instant, PlainDate, PlainDateTime, and PlainTime, the change isn't
observable, so no tests could be added. This adds test coverage for

- Duration.p.round()
- PlainYearMonth.p.since()
- PlainYearMonth.p.until()
- ZonedDateTime.p.round()
- ZonedDateTime.p.since()
- ZonedDateTime.p.until()

As well as a few cases where we are testing that certain calendar methods
get called during a round operation, but previously were doing so with
options that now become a no-op and no longer call those calendar methods.
In those cases, round to 2 ns, rather than 1 ns.
2023-09-13 10:57:43 +02:00
Peter Klecha 1db9a49eb9 address comments 2023-09-08 16:31:50 -07:00
Peter Klecha 2a4c458002 Update test/built-ins/Promise/withResolvers/ctx-ctor.js
Co-authored-by: Linus Groh <mail@linusgroh.de>
2023-09-08 16:31:50 -07:00
Peter Klecha 998f811e58 Update test/built-ins/Promise/withResolvers/ctx-non-ctor.js
Co-authored-by: Ms2ger <Ms2ger@gmail.com>
2023-09-08 16:31:50 -07:00
Peter Klecha 15e0933cb5 Update test/built-ins/Promise/withResolvers/result.js
Co-authored-by: Jordan Harband <ljharb@gmail.com>
2023-09-08 16:31:50 -07:00
Peter Klecha 8f8aa971d8 Update test/built-ins/Promise/withResolvers/result.js
Co-authored-by: Jordan Harband <ljharb@gmail.com>
2023-09-08 16:31:50 -07:00
Peter Klecha ab0d665192 Update test/built-ins/Promise/withResolvers/result.js
Co-authored-by: Jordan Harband <ljharb@gmail.com>
2023-09-08 16:31:50 -07:00
Peter Klecha d2ac342089 include esids 2023-09-08 16:31:50 -07:00
Peter Klecha 81ba258677 add tests for Promise.withResolvers proposal 2023-09-08 16:31:50 -07:00
Philip Chimento e04e1c1a39 Temporal: Fix front matter of Temporal/ZonedDateTime/p/round/order-of-operations.js 2023-09-08 09:38:14 -07:00
Philip Chimento 6371be8338 Temporal Helpers: Add harness tests for DST sample time zone
Just to make sure the time zone arithmetic matches the actual time zone
that it is based on.
2023-09-08 09:38:14 -07:00
Philip Chimento d03ed25a21 Temporal Helpers: Refactor sample time zone tests in harness tests
These two can be combined into one test, since they are very similar. This
will allow testing the sample DST time zone as well, which is not yet
tested.
2023-09-08 09:38:14 -07:00
Philip Chimento d4f49b84ab Temporal: Update outdated test descriptions 2023-09-08 09:38:14 -07:00
Philip Chimento 6c16577f34 Temporal: Remove unused variables
These are also leftovers from the recent refactor, I think.
2023-09-08 09:38:14 -07:00
Philip Chimento ce92940645 Temporal: Improve various assertion messages
Some of these were overlooked in a recent big refactor.
2023-09-08 09:38:14 -07:00
Mathias Bynens 1a0b9d23f2 Add tests ensuring the latest Unicode Emoji standard is being followed
The behavior of `/\p{RGI_Emoji}/v` and other properties of strings depends on the Unicode & Emoji version being used in the JavaScript engine. This patch adds tests verifying new additions to `RGI_Emoji` for each release of the Unicode Emoji standard are correctly matched.
2023-08-28 16:31:57 +02:00
André Bargull e27c9f690c Add DurationFormat test for negative durations 2023-08-28 16:18:47 +02:00
André Bargull fa3581986f Add test for numeric hours with zero minutes and non-zero seconds 2023-08-28 16:18:47 +02:00
André Bargull c9548956f9 Test exact precision for DurationFormat
`Intl.DurationFormat` is currently spec'ed to use unlimited precision.

See: https://github.com/tc39/proposal-intl-duration-format/issues/157
2023-08-28 16:18:47 +02:00
André Bargull 71091f1541 Use simplified PartitionDurationFormatPattern to computed expected results 2023-08-28 16:18:47 +02:00
André Bargull 4da0b8f005 Remove test which duplicates 'style-default-en.js' 2023-08-28 16:18:47 +02:00
Jordan Harband eb613f6891 use proper isConstructor check for recently added ArrayBuffer/SharedArrayBuffer tests 2023-08-25 15:31:27 +02:00
Michael Ficarra 9efb4f8e53 update iterator helpers tests that passed even in noncompliant impls 2023-08-24 13:09:05 -07:00
André Bargull e273cd470a Add tests for recursively calling IteratorHelper generators 2023-08-24 12:44:04 -07:00
Kevin Gibbons 8a7b686502 add test for regexp matching with zero-length quantified matches 2023-08-24 10:47:01 +02:00
Yusuke Suzuki 04a84fc5fd Fix test/intl402/DurationFormat/prototype/format/style-digital-en.js
The expected output is not aligned: it is missing comma. This change fixes it.
2023-08-21 15:37:04 -07:00
Aditi bdddd9e2d2 Update test for monthDayFromFields() 2023-08-21 09:14:43 -07:00
Philip Chimento c30aff08af Temporal: Copy options object in Plain{Date,MonthDay,YearMonth}.{from,p.with} 2023-08-16 14:49:15 -07:00
Philip Chimento 5ecb902a0a Temporal: Copy options object in {Plain,Zoned}DateTime.{from,p.with} 2023-08-16 14:49:15 -07:00
Philip Chimento 01a49502f6 Temporal: Get receiver fields from a PlainDateTime in ZonedDateTime.with() 2023-08-16 14:49:15 -07:00
Philip Chimento 4155594804 Temporal: Get receiver's time units from internal slots in with() 2023-08-16 14:49:15 -07:00
Philip Chimento 4b4de778d4 Temporal: Limit allowed values for Calendar.fields to date units 2023-08-16 14:49:15 -07:00
Philip Chimento c372de0bbe Temporal: Avoid recalculating offset ns after GetPlainDateTimeFor 2023-08-16 14:49:15 -07:00
Justin Grant 0c87a86b58 Disallow sub-minute annotations in Instant strings
Adds tests that verify that Instant strings cannot include offset time
zone annotations with sub-minute units.

Also removes a few staging test cases that, due to a polyfill bug, were
incorrectly passing.
2023-08-10 15:45:34 +02:00
Justin Grant 2e4e0e6b8e Test ISO sub-minute offsets, incl. trailing zeroes
Plugs a test hole where we were not fully testing ISO strings with
sub-minute offsets, in particular those with trailing zeroes.
2023-08-10 10:13:27 +02:00
Ben Allen 1499c2c62b updated to contain ES5 version of RGN suggestion 2023-08-09 12:18:42 -07:00
Justin Grant 66f3959c14 Remove a sub-minute offset test
There was one remaining Temporal test that was parsing an ISO string
with a sub-minute offset into a Temporal.TimeZone. A polyfill bug was
allowing this test case to pass, even though after
tc39/proposal-temporal#2607 it should have failed.

This commit removes the bad test case.
2023-08-09 11:37:39 -07:00
Justin Grant 2e1d7a72ff Test rejecting ISO strings with subminute offsets
This commit verifies that ISO strings with sub-minute offsets cannot
be parsed into time zone identifiers. This was a change introduced in
the recently-merged tc39/proposal-temporal#2607, but tests for this case
were missing from #3862 (the tests for that PR).

I noticed in codecov results on an unrelated PR that this case wasn't
being tested, so fixing that mistake now.
2023-08-09 11:37:39 -07:00
Justin Grant 29dde1ce0e Tests for new API Temporal.TimeZone.p.equals 2023-08-07 15:01:16 -07:00
Justin Grant 90f5cac987 Add Intl.DTF tests for proposal-canonical-tz 2023-08-07 15:01:16 -07:00
Justin Grant a53f190e1f Add ZonedDateTime tests for proposal-canonical-tz 2023-08-07 15:01:16 -07:00
Justin Grant 3032242269 Test Temporal.TimeZone ID case normalization 2023-08-07 15:01:16 -07:00
Justin Grant 5d261f3641 Fix existing tests broken by proposal-canonical-tz 2023-08-07 15:01:16 -07:00
Ben Allen a5e2cf2433
Update InitializeDateTimeFormat references to new CreateDateTimeFormat to reflect recent editorial change (#3889) 2023-08-07 17:01:48 +02:00
Ben Allen 5d9dc53a19
Test invalid Intl.DateTimeFormat options when dateStyle/timeStyle is set (#3886)
Co-authored-by: Ms2ger <Ms2ger@gmail.com>
2023-08-07 16:32:44 +02:00
André Bargull 21c3097f92 Update tests for PR "Read date-time options only once when creating DateTimeFormat objects"
Update tests for PR tc39/ecma402#709.
2023-07-27 21:08:25 +02:00
Justin Grant 425716345f Test Temporal.Instant w/ trailing zeroes in offset
I noticed a small test hole in codecov: we weren't testing
Temporal.Instant parsing with trailing zeroes in the offset.
I also didn't see fractional offset testing, so added that too.
2023-07-27 12:52:25 +02:00
Justin Grant c84752415d Test PlainTime without full ISO strings
Codecov showed that PlainTime strings like "09:00:00Z[UTC]" or
"09:00:00Z" were not being tested. This commit fills that gap.

It'd probably be good to make similar changes for other Plain* types,
but Codecov didn't complain about them so they may be covered
via other tests so it was less urgent.
2023-07-25 09:36:18 +02:00
Justin Grant e8bbfe704f Ensure that non-string TimeZone IDs will throw
This commit fills a test hole found by Codecov: we weren't checking for
the case of a custom time zone whose `id` property returns a non-string
value.

Note that the `id` property is only read in a few places, all on the
ZonedDateTime prototype: `until`, `since`, `equals`, `toString`,
`toLocaleString`, `toJSON`, and `timeZoneId`.
2023-07-25 09:30:37 +02:00
Frank Yung-Fong Tang 92a9eca159
Add tests for ECMA402 PR 786 (#3875)
https://github.com/tc39/ecma402/pull/786

This ECMA402 PR 786 reached TC39 consensus in the July 2023 meeting
2023-07-24 17:47:19 +02:00
Justin Grant 6f146e6f30 Limit offset time zones to minute precision
Modify/add tests for https://github.com/tc39/proposal-temporal/pull/2607
2023-07-18 17:44:19 +02:00
Justin Grant 60e475248d Tests for Temporal PR #2574
Edits Temporal tests to account for changes in
https://github.com/tc39/proposal-temporal/pull/2574.

This PR stops coercing non-string primitive inputs to strings
in Temporal methods, to avoid cases where numbers
are coerced to syntactically valid but often unexpected
string results.
2023-07-18 17:09:04 +02:00
Guillaume Emont 016e4bf8e8
Temporal Issue 2532 (#3858)
* Add tests for the new PrepareTemporalFields behavior for all direct callers

See https://github.com/tc39/proposal-temporal/pull/2570

* Add tests for the new PrepareTemporalFields behavior for indirect callers through ToTemporalDate

* Add tests for the new PrepareTemporalFields behavior for indirect callers through ToTemporalDateTime

* Add tests for the new PrepareTemporalFields behavior for indirect callers through ToTemporalZonedDateTime

* Add tests for the new PrepareTemporalFields behavior for indirect callers through ToTemporalYearMonth

* Add tests for the new PrepareTemporalFields behavior for indirect callers through ToTemporalMonthDay

* Add tests for the new PrepareTemporalFields behavior for indirect callers through ToRelativeTemporalObject

* Add tests for the new PrepareTemporalFields behavior for indirect callers through AddDurationToOrSubtractDurationFromPlainYearMonth
2023-07-17 07:55:34 -07:00
Nicolò Ribaudo 7ef1833109 Move all tests using import assertions to files named as such 2023-07-17 16:32:25 +02:00
Frank Tang 9d7eb8018e Correct DurationFormat test
The expectation values for the formatToParts are incorrect.

A. The listFormat is consturcted with
  6. Perform ! CreateDataPropertyOrThrow(lfOpts, "type", "unit").
  so it should not have " and " in the string. Comparing with
  (new Intl.ListFormat("en", {type: "unit"})).formatToParts(["a", "b",
  "c"]) and
  value in the format d and the expected values in the
  DurationFormat/prototype/format directory
B. The localized unit values for "short" (and therefore default)
   are incorrect. Comparing with the expected values in the
  DurationFormat/prototype/format directory
2023-07-14 19:13:30 +02:00
Michael Ficarra 550c11163e
add tests for tc39/proposal-iterator-helpers#281 (#3869)
Co-authored-by: Ms2ger <Ms2ger@igalia.com>
2023-07-13 16:04:33 +02:00
André Bargull 8ce9864511 Add copy of transfer/transferToFixedLength tests with resizable-arraybuffer features removed 2023-07-03 15:10:04 +02:00
André Bargull 9ac846e0b9 Remove "resizable-arraybuffer" from ArrayBuffer transfer tests
Also adds missing "arraybuffer-transfer" feature flags.
2023-07-03 15:10:04 +02:00
Michael Dyck f5c932144a Delete trailing space after `|`
I'm not sure if YAML disallows it,
but test262 avoids it.
2023-06-29 14:08:47 +02:00
Shu-yu Guo 2f0193d4cf Add missing iterator-helpers feature flag 2023-06-15 20:18:14 +02:00
Rick Waldron dfc7ce4c28
Iterator Helpers (#2818)
drop:

property descriptor
name
length
[[Prototype]]
is a function
is not constructible
result instanceof Iterator
limit is given a non-primitive that needs to be converted to a number
  through valueOf
  through toString (array)
limit coercion to number throws
limit converts to NaN
  same as limit not supplied
limit behaves properly
  limit < number of values
  limit = number of values
  limit > number of values
gets the next method from the underlying iterator only once
underlying iterator has throwing next getter
underlying iterator next throws when advancing past dropped items
underlying iterator is advanced after calling drop
underlying iterator is closed after calling drop
underlying iterator is already closed
underlying iterator next returns non-object
underlying iterator next returns object with throwing done/value getters
underlying iterator return is never called when result iterator is closed

every:

property descriptor
name
length
[[Prototype]]
is a function
is callable
is not constructible
result is a Boolean
predicate is non-callable
iterator already exhausted
called on non-object
called on object with "next" method
called on object with non-callable "next" method
predicate returns non-Boolean
predicate returns truthy for all iterated values
  returns true
predicate returns truthy for some iterated values but then falsey for at least one iterated value
  returns false
  iteration stops
  iterator is closed
predicate returns falsey immediately
  returns false
  iteration stops
  iterator is closed
predicate throws
  every throws
  iterator is closed
predicate throws then iterator close also throws
predicate this value is undefined
predicate is passed the yielded value as the first parameter and a counter as second parameter
gets the next method from the iterator only once
iterator has throwing next getter
iterator has throwing return getter
iterator next throws
iterator return throws
iterator next returns non-object
iterator next returns object with throwing done/value getters

Co-authored-by: Michael Ficarra <mficarra@shapesecurity.com>
Co-authored-by: Jordan Harband <ljharb@gmail.com>
2023-06-15 17:07:41 +02:00
Shu-yu Guo e337fc9506 Remove old Array group tests 2023-06-15 10:23:02 +02:00
Jordan Harband c5b24c64c3
groupBy: fix throwing iterator tests
Fixes #3852
2023-06-13 19:56:17 -07:00
Justin Grant 55658a4fa2 Work around Node 20 / ICU 73.1 calendar bug
These tests accompany a Temporal PR that works around a bug in
ICU 73.1 (which ships with Node 20). These test changes enable
tests to pass in both the buggy state and after the bug is eventually
fixed.
2023-06-12 12:39:52 +02:00
José Julián Espina c4642dd714
Fix phase on some module tests (#3832) 2023-06-11 00:12:02 +02:00
André Bargull f4e31fc397 Update expected test results for CLDR 43
intl402/Locale/constructor-non-iana-canon.js
- Likely subtags entry for "hyw" -> "hyw-Armn-AM" was added to supplemental/likelySubtags.xml

intl402/Locale/prototype/minimize/removing-likely-subtags-first-adds-likely-subtags.js
- Likely subtags entry for "aae" -> "aae-Latn-IT" was added to supplemental/likelySubtags.xml
- Likely subtags entry for "pap" was changed from "pap_Latn_AW" to "pap_Latn_CW"
2023-05-31 09:26:12 -07:00
Philip Chimento 63e451dc80 Temporal: Tests for malicious time zones with zero-length days
Based on test cases provided by Anba in
https://github.com/tc39/proposal-temporal/issues/2333. (Thanks!)
2023-05-31 09:11:25 -07:00
Jordan Harband feb6f107f8 Convert Array.prototype.groupToMap tests to Map.groupBy tests 2023-05-31 08:32:28 -07:00
Jordan Harband 49237f30de Convert Array.prototype.group tests to Object.groupBy tests 2023-05-31 08:32:28 -07:00
Philip Chimento 3e858ef02d Tests for multiple calendar annotations with at least one critical
As per IETF review, an IXDTF string (ISO 8601 with annotations) is no
longer valid if it contains more than one u-ca annotation and at least one
of the annotations is marked critical.

Removes tests where such a string was assumed to be valid, and adds new
ones with a few variations on invalid strings.
2023-05-24 13:12:40 -07:00
Veera 88a2f0dcd1 Fix copyright 2023-05-18 11:19:31 -07:00
Veera 732cfff666 Fix YAML indentation 2023-05-18 11:19:31 -07:00
Veera bf337727a0 Try to fix CI errors 2023-05-18 11:19:31 -07:00
Veera 377231a1de Add tests for increment and decrement operations on `this` 2023-05-18 11:19:31 -07:00
Mathias Bynens 1010e63caf Add tests for RegExp `v` flag errors that were allowed with `u`
https://github.com/tc39/proposal-regexp-v-flag#how-is-the-v-flag-different-from-the-u-flag

Issue: #3496
Issue: https://github.com/tc39/proposal-regexp-v-flag/issues/52
2023-05-01 23:34:57 -07:00
Guillaume Emont 72c0c5e163 Added new tests to reflect the change that daysInMonth is the count of days in a month
This change affects how PlainYearMonth's add and subtract behave. They
now ignore daysInMonth reimplementations in the calendar, and they call
dateadd() a different number of times.

See https://github.com/tc39/proposal-temporal/issues/1315
2023-04-28 12:16:41 -07:00
Guillaume Emont d7fa398364 Updated tests to reflect that daysInMonth are the count of days in a month
See https://github.com/tc39/proposal-temporal/issues/1315
2023-04-28 12:16:41 -07:00
Philip Chimento 63e0986803 Improve printing of property key names in observer helpers
These should be formatted in the same way that they'd be entered in source
code.
2023-04-24 12:14:18 +02:00
Philip Chimento dd47e4e248 Improve comments and assertion messages 2023-04-24 12:14:18 +02:00
Philip Chimento c03a58ba35 Temporal: More baseline order-of-operations tests
Add order-of-operations tests for:

- Temporal.ZonedDateTime.p.getISOFields()
- Temporal.ZonedDateTime.p.round()
- years with ZonedDateTime relativeTo in Temporal.Duration.p.round()
- years with ZonedDateTime relativeTo in Temporal.Duration.p.total()
- property Gets on receiver in Temporal.PlainDateTime.p.with()
- ZonedDateTime difference methods with largestUnit being a time unit
- Duration.compare with no units higher than hours
2023-04-24 12:14:18 +02:00
Philip Chimento 56fe761577 Temporal: Fix .slice() in test leftover from debugging
I had been using slice() here to cut down the list of operations to
compare during debugging, but accidentally left it in.
2023-04-24 12:14:18 +02:00
Aditi 2df6c7d29a Added test for non-iso calendars for Temporal.PlainMonthDay.from 2023-04-18 12:09:26 -07:00
Philip Chimento 801a5bb8f5 Temporal: Port toLocaleString calendar mismatch tests from staging
I wrote a similar test for Temporal.ZonedDateTime.p.toLocaleString, so
while this was fresh I decided to do the same for the other toLocaleString
calendar mismatch tests that were in staging.
2023-04-11 11:52:40 +02:00
Philip Chimento cd714a9aad Temporal: Rewrite Temporal.ZonedDateTime.p.toLocaleString tests
In https://github.com/tc39/proposal-temporal/pull/2522 which reached
consensus at the March 2023 TC39 meeting, the functionality of
Temporal.ZonedDateTime.p.toLocaleString was changed substantially, to not
directly pass the ZonedDateTime to any Intl.DateTimeFormat methods. This
adds rewrites of all existing tests for toLocaleString, as well as a few
tests to verify that Intl.DateTimeFormat methods no longer support
Temporal.ZonedDateTime arguments.

As we are rewriting the tests anyway, this also ports all of the
Temporal.ZonedDateTime.p.toLocaleString tests that were in staging, to the
correct format for the main tree.
2023-04-11 11:52:40 +02:00
Guillaume Emont da56f5e2b2 Temporal: updates tests for balancing ordering change in Temporal.Duration.prototype.round
Fixes some tests which are observing side effects of round().
2023-04-10 12:50:11 -07:00
Guillaume Emont 13778441ad Temporal: added a test reproducing tc39/proposal-temporal#2508
Before the issue is fixed, rounding a duration such as 'PT2400h' with
months as largest unit fails to balance it properly and gives a result
with days being the largest unit. The test ensures that such rounding
happens properly.
2023-04-10 12:50:11 -07:00
Philip Chimento 6d0978de60 Tweak test descriptions: "Intl time zones" → "IANA time zones"
Suggestion from Justin Grant's code review.
2023-04-10 08:36:08 -07:00
Philip Chimento 33865c5339 Validate required methods of Temporal Calendar protocol
Checking whether an object implements the Calendar protocol is now done by
means of HasProperty operations for each of the required methods unless
the object already has the Calendar brand.

Discussion:
https://github.com/tc39/proposal-temporal/issues/2104#issuecomment-1409549753

Corresponding normative PR:
https://github.com/tc39/proposal-temporal/pull/2485
2023-04-10 08:36:08 -07:00
Philip Chimento d6a24fe906 Validate required methods of Temporal TimeZone protocol
Checking whether an object implements the TimeZone protocol is now done by
means of HasProperty operations for each of the required methods unless
the object already has the TimeZone brand.

Discussion:
https://github.com/tc39/proposal-temporal/issues/2104#issuecomment-1409549753

Corresponding normative PR:
https://github.com/tc39/proposal-temporal/pull/2485
2023-04-10 08:36:08 -07:00
Philip Chimento bc979c51a5 Remove support for nested Temporal calendar property bags
Previously, "nested" calendar property bags were unwrapped up to one
level. That is, this object:
{
  calendar: {
     // ...Temporal.Calendar methods
  }
}
would not be considered to implement the Calendar protocol, but would have
its calendar property used instead, if it were passed to an API that
required a Calendar protocol object.

These nested property bags are no longer supported. Discussion:
https://github.com/tc39/proposal-temporal/issues/2104#issuecomment-1409549753

Corresponding normative PR:
https://github.com/tc39/proposal-temporal/pull/2485
2023-04-10 08:36:08 -07:00
Philip Chimento 24def913ec Remove support for nested Temporal time zone property bags
Previously, "nested" time zone property bags were unwrapped up to one
level. That is, this object:
{
  timeZone: {
     // ...Temporal.TimeZone methods
  }
}
would not be considered to implement the TimeZone protocol, but would have
its timeZone property used instead, if it were passed to an API that
required a TimeZone protocol object.

These nested property bags are no longer supported. Discussion:
https://github.com/tc39/proposal-temporal/issues/2104#issuecomment-1409549753

Corresponding normative PR:
https://github.com/tc39/proposal-temporal/pull/2485
2023-04-10 08:36:08 -07:00
André Bargull 886656756f Round epoch time getters towards negative infinity
Update tests to match <https://github.com/tc39/proposal-temporal/pull/2424>.
2023-04-10 13:20:49 +02:00
Aditi f756ff63c8
Add some Array.from async tests (#3791)
This PR adds some more tests for Array.fromAsync proposal.
It includes most of the tests defined in https://github.com/es-shims/array-from-async/blob/main/test.mjs

See:#3725
2023-04-07 16:47:19 -07:00
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