Commit Graph

5337 Commits

Author SHA1 Message Date
Frank Tang 7b154389ce Update firstDay test to latest spec after PR 79
Spec Changes merged
https://github.com/tc39/proposal-intl-locale-info/pull/79
2024-07-10 11:20:28 -07:00
André Bargull 318df8f01e Delete harness test for removed TemporalHelpers.oneShiftTimeZone function 2024-07-10 10:47:36 -07:00
Rezvan Mahdavi Hezaveh 97e0bef215 [explicit-resource-management] Add await using to the bytecode generator
This CL adds subtypes (SyncJSDisposableStack and AsyncDisposableStack)
to JSDisposableStack as well as `await using` to the bytecode generator.
Currently async generators are broken and the fix is left as a TODO
in this CL. Also, exception handling (promise rejections) will be
completed in a follow up CL.

Bug: 42203814
Change-Id: I303a380b57fb4ab4662e4f55fb4dc9b14d18cd2a
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/5569647
Reviewed-by: Shu-yu Guo <syg@chromium.org>
Commit-Queue: Rezvan Mahdavi Hezaveh <rezvan@chromium.org>
Cr-Commit-Position: refs/heads/main@{#94944}
2024-07-10 10:19:19 -07:00
André Bargull 16322d384a Allow alternative era names
Temporal doesn't specify concrete era names, so tests shouldn't assert
for example that the era code of the current Gregorian era is `"ce"`. We
still want to validate the era names somehow however, so allow alternative
era names using the era codes from the "Intl era and monthCode" proposal.
2024-07-10 07:59:20 -07:00
André Bargull 0ff7881d75 Use explicit relative paths 2024-07-10 16:02:53 +02:00
André Bargull 507c28b3f9 Fix strict mode errors 2024-07-10 13:57:33 +02:00
Kevin Gibbons 08e1aa808a
Tests for later base64 changes (#4133)
Co-authored-by: Jordan Harband <ljharb@gmail.com>
2024-07-10 11:35:22 +02:00
Ioanna M Dimitriou H 41958b6a90
RAB: Integrate staging tests for the .forEach method (#4134)
* Import relevant files from #3888

* Removing parts in resizableArrayBufferUtils.js and adding it in includes,
while adjusting usage of CollectValuesAndResize and applying review changes
from PRs for previously tested methods.

* Added missing 'shrink' tests for Array.prototype.forEach and removed forgotten lines

Also renames ResizeBufferMidIteration to ResizeMidIteration

* Forgotten by copy paste
2024-07-09 18:07:33 -07:00
Kevin Gibbons 5132804523
add TypedArray feature to all new tests 2024-03-11 22:59:56 -07:00
Kevin Gibbons 080c5490a2
assert on the length of the backing buffer of the result 2024-03-11 22:56:22 -07:00
Kevin Gibbons 44803f799c
add test for excess padding 2024-03-11 22:51:35 -07:00
Kevin Gibbons 070d7ee87e
add tests that boxed strings are not valid values for options 2024-03-11 22:47:43 -07:00
Kevin Gibbons 6d7bd55175
address ljharb comments 2024-03-11 22:43:06 -07:00
Kevin Gibbons 911aa6173d
update detached buffer tests 2024-02-07 16:43:17 -08:00
Kevin Gibbons 07807bd544
fromBase64Into -> setFromBase64 2024-02-07 16:41:32 -08:00
Kevin Gibbons bd05e23d40
add tests for base64 proposal 2024-01-21 17:09:11 -08:00
Philip Chimento 3a7a72aef5 Temporal: Add tests for conversion of calendar and time zone IDs in constructors
Now that we don't have to deal with strings or objects as input to the
calendar ID or time zone ID parameter of constructors, we accept only the
data that actually goes into the internal slots.
2024-07-05 10:43:53 +02:00
Philip Chimento cb13595617 Temporal: Add staging test to check June 2024 API removals
This test should trip if an implementation forgets to perform the removals
that reached consensus in June 2024. (Although such an implementation
would technically comply with the specification, if you really need to do
that, please open an issue on the Temporal proposal repo rather than just
skiplisting this test.)
2024-07-05 10:43:53 +02:00
Philip Chimento bbfcfd59b0 Temporal: Port staging tests that require non-ISO calendar or non-UTC time zone
As in the previous commit, without custom calendars and time zones, some
functionality cannot be tested on implementations that don't have any
other calendars and time zones than iso8601 and UTC.

Some of the staging tests fall in this category. We take the opportunity
to port these into proper tests, in the intl402/ folder.
2024-07-05 10:43:53 +02:00
Philip Chimento efc7424844 Temporal: Don't use getISOFields() in other tests
Previously getISOFields() was used to get the exact value of the
[[Calendar]] and [[TimeZone]] internal slots, as well as to get the
reference ISO year for PlainMonthDay and reference ISO day for
PlainYearMonth.

Use calendarId and timeZoneId for the former and toString() for the
latter.
2024-07-05 10:43:53 +02:00
Philip Chimento 7e4de57437 Temporal: Remove tests for getISOFields methods 2024-07-05 10:43:53 +02:00
Philip Chimento e5ef51ba7e Temporal: Move tests into intl402/ that require non-ISO calendar or non-UTC time zone
Without custom calendars and time zones there are actually a bunch of
things that we now can't test on implementations that don't have non-ISO
calendars or non-UTC time zones. (Alternatively, we can say that these are
functionalities that those implementations don't have to implement.)
2024-07-05 10:43:53 +02:00
Philip Chimento 9671c4a613 Temporal: Test adjustments for removing calendar and time zone objects 2024-07-05 10:43:53 +02:00
Philip Chimento 5cd7e9077d Temporal: Remove calendar and time zone observers
These are no longer possible without custom objects. Also add an exception
for calendar and timeZone properties in property bag observers so they are
not treated as objects.
2024-07-05 10:43:53 +02:00
Philip Chimento 27bc974287 Temporal: Replace TemporalHelpers.specificOffsetTimeZone with offset strings 2024-07-05 10:43:53 +02:00
Philip Chimento 0a1cb1307f Temporal: Edit test descriptions that refer to Calendar and TimeZone objects 2024-07-05 10:43:53 +02:00
Philip Chimento 372527e572 Temporal: Don't pass custom calendar in helper tests
This is no longer necessary if there are no calendar objects.
2024-07-05 10:43:53 +02:00
Philip Chimento 9c6734f39b Temporal: Remove Calendar and TimeZone objects from "wrong-type" tests
Test the "wrong type of object" with Duration objects where appropriate,
otherwise just use plain objects.
2024-07-05 10:43:53 +02:00
Philip Chimento debd22a2ad Temporal: Remove tests that throw on calendar or time zone method accesses
Many tests tested some functionality while asserting that there were no
calls of calendar or time zone methods. We can continue testing the
functionality, but there are no more methods to call, so we can delete
those parts of the tests.
2024-07-05 10:43:53 +02:00
Philip Chimento 7d970fbe4e Temporal: Remove fake West Coast and Samoa time zones from TemporalHelpers
It's no longer possible to fake built-in time zones using custom objects.
So testing DST shifts will have to use real built-in time zones. Replace
TemporalHelpers.springForwardFallBackTimeZone with America/Vancouver (it
was modelled on the DST transitions in 2000) and
TemporalHelpers.crossDateLineTimeZone with Pacific/Apia (it was modelled
on the 2011 switch to the other side of the international date line.)

These tests have to move to the intl402/ folder since non-Intl-aware
implementations are allowed (but not required) to support any built-in
time zones other than UTC.
2024-07-05 10:43:53 +02:00
Philip Chimento c728e6d89e Temporal: Fix tests that unnecessarily create TimeZone or Calendar instances
In many cases we created a TimeZone or Calendar instance from a built-in
time zone or calendar. These tests can be trivially adapted to just use
the string ID.
2024-07-05 10:43:53 +02:00
Philip Chimento ea2268aa43 Temporal: Remove tests directly relating to custom calendar and time zones
These are tests that just won't apply anymore without custom calendars and
time zones.
2024-07-05 10:43:53 +02:00
Philip Chimento 6595838b3d Temporal: Remove TimeZone.p.equals method
Some of the tests can be removed altogether since they deal with what
forms of input can be passed to ToTemporalTimeZoneSlotValue. Those are
tested on every method that takes a TimeZone as input.

Other tests are still relevant, but need to move to ZonedDateTime.p.equals
where the various quirks of time zone equality can still be tested. (Some
of these still will be removed in a following commit because they use
time zone objects.)

See: #2826
2024-07-05 10:43:53 +02:00
Philip Chimento 1213ab17ec Temporal: Remove getCalendar and getTimeZone methods
Temporarily replace them with getISOFields().calendar/timeZone just to
keep the tests running until we remove Calendar and TimeZone objects
altogether.

See: tc39/proposal-temporal#2826
2024-07-05 10:43:53 +02:00
Philip Chimento 73f85aeeaf Temporal: Add tests covering options bag argument of getTimeZoneTransition 2024-07-05 10:43:53 +02:00
Philip Chimento c22fbc7b45 Temporal: Port staging tests that use next/previousTransition
See: tc39/proposal-temporal#2826
2024-07-05 10:43:53 +02:00
Philip Chimento 71877cde79 Temporal: Move tests for getNext/PreviousTransition into ZonedDateTime
See: tc39/proposal-temporal#2826
2024-07-05 10:43:53 +02:00
Philip Chimento 9ff6ac3368 Temporal: Remove tests for argument of TimeZone.p.getNext/PreviousTransition
This is being moved to a method on Temporal.ZonedDateTime.prototype. It
will not take a Temporal.Instant argument.

See: tc39/proposal-temporal#2826
2024-07-05 10:43:53 +02:00
Ioanna M Dimitriou H 673856839c
RAB: Integrate staging tests for the .findLastIndex method (#4129)
* Import relevant files from #3888

* Removing parts in resizableArrayBufferUtils.js and adding it in includes,
while adjusting usage of CollectValuesAndResize and applying review changes
from PRs for previously tested methods.
2024-07-04 13:15:53 -07:00
Ioanna M Dimitriou H 6f2eeebdcc
RAB: Integrate staging tests for the .findLast method (#4128)
* Import relevant files from #3888

* Removing parts in resizableArrayBufferUtils.js and adding it in includes,
while adjusting usage of CollectValuesAndResize and applying review changes
from PRs for previously tested methods.
2024-07-04 12:48:33 -07:00
Ioanna M Dimitriou H 105906a49c
RAB: Integrate staging tests for the .findIndex method (#4127)
* Import relevant files from #3888

* Removing parts in resizableArrayBufferUtils.js and adding it in includes,
while adjusting usage of CollectValuesAndResize and applying review changes
from PRs for previously tested methods.
2024-07-04 12:12:02 -07:00
Ioanna M Dimitriou H e023765890
RAB: Integrate staging tests for the .find method (#4126)
* Import relevant files from #3888

* Removing parts in resizableArrayBufferUtils.js and adding it in includes,
while adjusting usage of CollectValuesAndResize and applying review changes
from PRs for previously tested methods.
2024-07-04 11:05:24 -07:00
Ioanna M Dimitriou H a507aa01de
RAB: Integrate staging tests for the .filter method (#4125)
* Import relevant files from #3888

* Removing parts in resizableArrayBufferUtils.js and adding it in includes,
while adjusting usage of CollectValuesAndResize and applying review changes
from PRs for previously tested methods.

* Addresses review comment removing forgoten onlyStrict flag

a62d978ca6 (r1663298683)
2024-07-04 08:35:13 -07:00
Peter Hoddie e4f4abdcb2
Compatibility with Hardened JavaScript (#4088)
This PR proposes changes to existing test262 tests to allow them to pass under Hardened JavaScript (see Secure ECMAScript proposal and Hardened JavaScript). Moddable uses Hardened JavaScript for JavaScript runtimes on resource constrained embedded devices, including those targeted by ECMA-419.

The changes fall into four groups:

1. Replace use of new Date() with new Date(1970). Scripts running inside a Compartment cannot retrieve the current time, so new Date() throws but new Date(1970) succeeds. Very few tests need the current time, but instead simply need a Date instance.
2. Use Object.defineProperty instead of setting existing built-in properties directly, such as toString and toValue. In Hardened JavaScript, prototypes of built-in objects are frozen. Consequently, setting properties of an instance that exist on the prototype throw (Hardened JavaScript is always in strict mode).
3. Eliminate use of Math.random(). Scripts running inside a Compartment cannot generate random numbers. One test identified so far uses Math.random() in a way that can easily be replaced with a counter.
4. Narrow the scope of exception tests. Consider the following

assert.throws(TypeError, () => {
  var s1 = new Date();
  s1.toString = Boolean.prototype.toString;
  s1.toString();
});

This test passes, but only because new Date() fails by throwing a TypeError. If the invocation of the Date constructor is resolved by (1) above, then the assignment to toString fails as per (2) above. The script should be modified as below to ensure that assert.throws only tests the intended statement, s1.toString(). The modified script tests the intended functionality and passes under Hardened JavaScript

var s1 = new Date(1970);
Object.defineProperty(s1, "toString", {
  value: Boolean.prototype.toString
});
assert.throws(TypeError, () => {
  s1.toString();
});

This is an initial PR to begin the process of adapting test262 for use with Hardened JavaScript. Further changes are expected, with the vast majority likely to fall into the four groups described above.

Thank you to gibson042, kriskowal, and erights for their advice on this work.
2024-07-04 08:19:23 -07:00
Philip Chimento 3f805a1383 Temporal: Test calendar canonicalization in Temporal
Following the upstream ECMA-402 change tested in the previous commit, add
test coverage for the corresponding functionality in Temporal. Fix one
test that was erroneous.
2024-07-04 11:14:16 +02:00
Philip Chimento 31a20380b0 Intl: Test calendar canonicalization in Intl.DateTimeFormat constructor
This ECMA-402 change is already from several years ago, but lacked test
coverage: https://github.com/tc39/ecma402/pull/418
2024-07-04 11:14:16 +02:00
Linus Groh a82f5382ff Remove 'AsyncArrowFunction' test
There is no such hidden constructor, it's the same as the hidden
AsyncFunction constructor. In other words:

```js
Object.getPrototypeOf(async () => {}).constructor ===
Object.getPrototypeOf(async function () {}).constructor
```

Also add a test to ensure that %AsyncFunction.prototype% is indeed the
prototype of an async arrow function.

Closes #4044.
2024-07-04 11:03:23 +02:00
Kevin Gibbons 3d5c52e112
add tests for Math.sumPrecise (#4049)
* add tests for Math.sumPrecise

* add feature

* I hate yaml

* fix writability check
2024-07-03 08:56:34 -07:00
Philip Chimento 6626b60df6 Temporal: Make U+2212 MINUS SIGN invalid in ISO strings
These are the test adjustments corresponding to the normative PR
https://github.com/tc39/ecma262/pull/3334 which reached consensus at the
June 2024 TC39 meeting.
2024-07-03 08:50:57 -07:00
Philip Chimento 7c985a4fd9 Make U+2212 MINUS SIGN an invalid sign character for offset time zone IDs
These are the test adjustments corresponding to the normative PR
https://github.com/tc39/ecma262/pull/3334 which reached consensus at the
June 2024 TC39 meeting.
2024-07-03 08:50:57 -07:00
Ioanna M Dimitriou H d2596e2651
RAB: Integrate staging tests for the .every method (#4074)
* RAB: Integrate staging tests for the .every method
of Array.prototype and TypedArray.prototype

This is part of PR #3888 to make reviewing easier.
Includes changes to use the helper ./harness/resizableArrayBufferUtils.js

* Added missing includes

* Removed unnecessary function call.

* Apply suggestions from code review

* Applied review suggestion to the rest of the files

* Addressed forgotten review comment noting some files are missing.

https://github.com/tc39/test262/pull/4074#pullrequestreview-2046589557

Adds forgotten tests from #3888

* Addresses review comment.

* Fixed forgotten rename

* Simplify the tests and add documentation.

New approach replaces ...Helper with CollectResize to make the tests easier to understand.
In particular:
- Replaced the need for '...Helper' abstractions with a more descriptive
  function 'ResizeBufferMidIteration', which the .every method can call
  directly.
- Moved 'let values' back outside of the loops, together with a function
  definition 'ResizeBufferMidIteration' to persist the side effects that
  'CollectValuesAndResize' has on 'values' but without having to define
  this inside every loop.
  + So this reverts commit d9a2bac41f87f0964a43d34c6f349b6d78401633 and
  + this reverts commit 0bc2d66335671cac56912981b73c7900bf309cee.
- Added documentation.

* Documentation style change and remove accidental additions.
2024-06-28 16:42:09 -07:00
Nicolò Ribaudo 03852c962b
Avoid duplicate binding import-source-binding-name.js (#4121) 2024-06-28 15:14:23 +02:00
SUZUKI Sosuke 27b2551c00
Add test to check `nfOptions.roundingMode` for seconds / microseconds / nanoseconds is `"trunc"` (#4115)
* Test that `nfOptions.roundingMode` for seconds / microseconds / nanoseconds is `"trunc"`

* Add license header

* Use `Intl.NumberFormat` instead of `testintl.js` harness

* Use correct harness
2024-06-27 10:08:11 -07:00
Chengzhong Wu 8a2229cde8
Add tests for Source Phase Imports (#3980) 2024-06-27 14:58:04 +02:00
Frank Yung-Fong Tang c3a326ace8
Add test for ECMA402 PR833 Allow locale based ignorePunctuation default (#3922)
* Add test for ECMA402 833

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

* Update test/intl402/Collator/prototype/resolvedOptions/ignorePunctuation-default.js

Co-authored-by: André Bargull <andre.bargull@gmail.com>

* Update test/intl402/Collator/prototype/resolvedOptions/ignorePunctuation-default.js

Co-authored-by: André Bargull <andre.bargull@gmail.com>

---------

Co-authored-by: André Bargull <andre.bargull@gmail.com>
2024-06-26 17:40:01 -07:00
Ioanna M Dimitriou H c2815ec090
RAB: Integrate staging tests for .fill method (#4075)
RAB: Integrate staging tests for the .fill method
of Array.prototype and TypedArray.prototype

This is part of PR #3888 to make reviewing easier.
Includes changes to use the helper ./harness/resizableArrayBufferUtils.js
2024-06-26 16:26:22 -07:00
Ioanna M Dimitriou H cbdff1ca5f
RAB: Integrate staging tests for the .entries method (#4073)
RAB: Integrate staging tests for the .entries method
of Array.prototype and TypedArray.prototype

This is part of PR #3888 to make reviewing easier.
Includes changes to use the helper ./harness/resizableArrayBufferUtils.js
2024-06-26 16:12:35 -07:00
Ioanna M Dimitriou H d7b2f4acfc
RAB: Integrate staging tests for .copyWithin method (#4072)
RAB: Integrate staging tests for .copyWithin method
of Array.prototype and TypedArray.prototype

This is part of PR #3888 to make reviewing easier.
Includes changes to use the helper ./harness/resizableArrayBufferUtils.js
2024-06-26 16:05:45 -07:00
André Bargull c47b716e8d Update harness tests for Float16Array
Fixes #4029
2024-06-24 17:02:39 +02:00
Shu-yu Guo 29c6f7028a [top-level-await] Sync implementation with spec text
The module evaluation machinery has undergone non-trivial refactoring
since implementation. Sync up the comments and code for maintenance.

Notably,

- Actually use the kEvaluatingAsync status (previously conflated under
  kEvaluated)
- [[IsAsyncEvaluating]] -> [[IsAsyncEvaluation]]
- GatherAsyncParentCompletions -> GatherAvailableAncestors
- async -> has_toplevel_await
- kAsyncModule -> kModuleWithTopLevelAwait

Bug: 347060515
Change-Id: Ia2c35d5b42ee9f58db841cdfcaef9d17b018c9c6
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/5636701
Reviewed-by: Adam Klein <adamk@chromium.org>
Commit-Queue: Shu-yu Guo <syg@chromium.org>
Cr-Commit-Position: refs/heads/main@{#94591}
2024-06-21 23:23:02 +02:00
André Bargull 43a64eabe3 Remove empty info block scalar 2024-06-21 10:17:07 +02:00
Linus Groh 15ae4bb43f Fix wrong array literal in Map/Set value tests 2024-06-14 01:26:22 +02:00
Philip Chimento 58df8fb22a Temporal: Remove methods with ISO-named pairs
See tc39/proposal-temporal#2846
2024-06-13 22:04:16 +02:00
Philip Chimento 3c28e3a359 Temporal: Remove Plain/ZonedDateTime to PlainYearMonth/MonthDay APIs
See tc39/proposal-temporal#2848
2024-06-13 22:04:16 +02:00
Philip Chimento 1c900ca59c Temporal: Remove epoch seconds and epoch microseconds APIs
See: tc39/proposal-temporal#2849
2024-06-13 22:04:16 +02:00
Philip Chimento 7184313667 Temporal: Remove PlainTime.toPlainDateTime/toZonedDateTime methods
See tc39/proposal-temporal#2848
2024-06-13 22:04:16 +02:00
Philip Chimento a9c223c60e Temporal: Remove withPlainDate() methods
See tc39/proposal-temporal#2847.
2024-06-13 22:04:16 +02:00
Philip Chimento 61e3f5ec4d Temporal: Tests for removal of relativeTo from Duration.p.add/subtract
See tc39/proposal-temporal#2825.

Various edits to existing tests so that they make more sense with the
removal of relativeTo.

New tests specifically testing that calendar units cannot be added or
subtracted directly.
2024-06-13 13:54:46 +02:00
Philip Chimento ea4945c66f Temporal: Remove tests using relativeTo in Duration.p.add/subtract
See tc39/proposal-temporal#2825. This is a mass removal of tests that use
this functionality, in a separate commit for ease of review. Further
adjustments will be made in the following commit.
2024-06-13 13:54:46 +02:00
Adam Shaw ba9c397923 tests for https://github.com/tc39/proposal-temporal/issues/2820 2024-06-13 08:54:19 +02:00
André Bargull 2496577225
Fix strict mode errors in Temporal staging test (#4100) 2024-05-30 16:07:35 +02:00
André Bargull 42a9f69ab2 Declare variables to allow running in strict-mode 2024-05-29 11:10:42 +02:00
André Bargull 57b9f154a6 Allow alternative implementations for Chinese lunar calendar 2024-05-29 10:47:09 +02:00
André Bargull efe0b1871f Split yearMonthFromFields/reference-day.js into calendar specific files 2024-05-29 10:47:09 +02:00
Sosuke Suzuki c00830acef Fix description of `fractionalDigits` tests 2024-05-28 15:41:01 +02:00
Luis Fernando Pardo Sixtos e394ebb6fc [decorators] Add flag, accessor keyword and token
This change doesn't do any functionality changes.

Bug: 42202709
Change-Id: I613b96b6e7630e10748e31162080a61e7da4c2a1
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/5542951
Commit-Queue: Luis Pardo <lpardosixtos@microsoft.com>
Reviewed-by: Shu-yu Guo <syg@chromium.org>
Cr-Commit-Position: refs/heads/main@{#94086}
2024-05-27 09:22:09 +02:00
Timothy Leverett 2a7468c934 Temporal: fix messages on `Duration/out-of-range` tests
Fixed test messages that incorrectly referenced the `days` parameter to say `weeks` instead.
2024-05-23 19:16:00 -07:00
test262-merge-bot 0eb7f6eccb
Merge branch 'main' into chromium-export-7eb56ce860 2024-05-19 12:19:57 +02:00
Timothy Flynn 232dfc7b60
Add missing `return` statement to `throwsAsync` callback
This callback is expected to return a thenable.
2024-05-18 11:30:57 -04:00
Jordan Harband 5217ef396e
throwsAsync, `Promise.try`: avoid unneeded syntax
Followup to #4086
2024-05-17 09:13:21 -07:00
Sosuke Suzuki 57c7d06bf1 Wrap `throwsAsync` with `asyncTest` 2024-05-17 16:31:13 +02:00
Sosuke Suzuki 3d3df6ec02 Remove incorrect property access 2024-05-17 21:57:46 +09:00
Sosuke Suzuki d4fac47d3b Fix `asyncTest` usage for `Promise.try` tests 2024-05-17 14:20:50 +02:00
Rezvan Mahdavi Hezaveh 081808bebd [explicit-resource-management] Add adopt and defer
This CL adds adopt() and defer() to DisposableStack
prototype.

Bug: 42203506
Change-Id: I556b96a0cf42595acdd483b0a02aef9ca41bd0bc
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/5512877
Reviewed-by: Simon Zünd <szuend@chromium.org>
Commit-Queue: Rezvan Mahdavi Hezaveh <rezvan@chromium.org>
Reviewed-by: Shu-yu Guo <syg@chromium.org>
Cr-Commit-Position: refs/heads/main@{#93930}
2024-05-15 23:18:28 +02:00
Rezvan Mahdavi Hezaveh fb7ab87dd5 [explicit-resource-management] Add move and disposed getter
This CL adds move() function and a getter for disposed to
DisposableStack prototype.

Bug: 42203506
Change-Id: I8d7750b1d4aa199ebeb997bde7fe6d06c9ccbff0
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/5528992
Commit-Queue: Rezvan Mahdavi Hezaveh <rezvan@chromium.org>
Reviewed-by: Adam Klein <adamk@chromium.org>
Reviewed-by: Shu-yu Guo <syg@chromium.org>
Cr-Commit-Position: refs/heads/main@{#93931}
2024-05-15 13:19:32 -07:00
Jordan Harband 8b6b0f516d
add Promise.try tests 2024-05-01 15:27:31 -07:00
Philip Chimento a7e796a4ce Temporal: Add test coverage for edge case in DST balancing after rounding
This covers an edge case that we hit, where 24 hours would not balance up
to one day in a 25-hour day if only largestUnit was specified, but would
erroneously balance up if rounding was also performed by specifying
smallestUnit.
2024-05-14 09:24:12 +02:00
Philip Chimento 500cea9384 Temporal: Add test coverage for large roundingIncrement in ZDT math
In ZonedDateTime.p.since/until, it's possible for AddDateTime to hit the
limit if the rounding increment is very high, even if the resulting
rounded duration isn't outside of the limit. Add a test covering this
case.
2024-05-14 09:24:12 +02:00
Philip Chimento e02220badd Temporal: Move some round() and total() tests out of staging
Including tests for every possible combination of largest and smallest
unit, for each type of relativeTo (undefined, PlainDate, ZonedDateTime).
2024-05-14 09:24:12 +02:00
Philip Chimento 96e31e7e28 Temporal: Tests for round() and since()/until() using the same code path
This should produce all the same results (except for a change to weeks
balancing in round(), which is now more consistent with since()/until())
but leads to different observable user code calls.

See https://github.com/tc39/proposal-temporal/issues/2742
2024-05-14 09:24:12 +02:00
Philip Chimento 6c6c72b063 Temporal: Adjust tests for Duration rounding fix
A MoveRelativeZonedDateTime step was missing, causing incorrect results.
See https://github.com/tc39/proposal-temporal/issues/2742
2024-05-14 09:24:12 +02:00
Rezvan Mahdavi Hezaveh 9b4c6577f6 [explicit-resource-management] Add DisposableStack constructor, use
and dispose method

This CL adds DisposableStack constructor, use() and dispose() methods
as developer exposed methods. Also, this CL fixed the use
of `using` keyword with `null` and `undefined` and adds tests for them.

Bug: 42203506
Change-Id: If50b9e33d9cbb3de2be41dc81e656d9d202b8fa8
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/5498999
Commit-Queue: Rezvan Mahdavi Hezaveh <rezvan@chromium.org>
Reviewed-by: Simon Zünd <szuend@chromium.org>
Cr-Commit-Position: refs/heads/main@{#93807}
2024-05-09 00:18:17 +02:00
Ioanna M Dimitriou H 55a5346f99
RAB: Integrate staging tests for .byteLength method (#4071)
* RAB: Integrate staging tests for .byteLength method
of TypedArray.prototype

This is part of PR #3888 to make reviewing easier.
Includes changes to use the helper ./harness/resizableArrayBufferUtils.js
2024-05-08 08:35:46 -07:00
Ioanna M Dimitriou H 0fca7339eb
RAB: Integrate staging tests for .at method (#4070)
* RAB: Integrate staging tests for .at method
of Array.prototype and TypedArray.prototype

This is part of PR #3888 to make reviewing easier.
Includes changes to use the helper ./harness/resizableArrayBufferUtils.js
2024-05-08 08:27:49 -07:00
Ben Allen 8724a0de23 ListFormats used in DurationFormat/prototype/format/fractions-of-subsecond-units-en.js were missing required `type: "unit"` option 2024-04-29 15:54:34 +02:00
Linus Groh cdf7ba7396 Fix typo in with statement test file name 2024-04-29 15:30:25 +02:00
Rezvan Mahdavi Hezaveh 27b6e4500f [explicit-resource-management]Add exception handling to sync ERM
This CL adds exception handling to the implementation of sync
explicit management proposal.

Bug: v8:13559
Change-Id: I2f4ffea432057b753634c2af4801f9dc48edac43
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/5405985
Reviewed-by: Leszek Swirski <leszeks@chromium.org>
Commit-Queue: Rezvan Mahdavi Hezaveh <rezvan@chromium.org>
Reviewed-by: Toon Verwaest <verwaest@chromium.org>
Cr-Commit-Position: refs/heads/main@{#93620}
2024-04-26 20:18:23 +02:00
Frank Yung-Fong Tang c2ae5ed5e9 Fix mixed-short-and-numeric.js
The option for the listFormat need to include {type: "unit"}
2024-04-25 10:55:21 +02:00
André Bargull a640565994 Add test for negative zero inputs 2024-04-23 18:27:01 +02:00
André Bargull 859b5c67ef Update numeric-hour-with-zero-minutes-and-non-zero-seconds for new default display of sub-hours units
Numeric "minute" and "seconds" units now default to "always" display, so we have
to add an additional test to cover when "auto" display is used. Additionally add
more inputs to cover all possible test combinations.
2024-04-23 18:27:01 +02:00
André Bargull 19d2a38558 Add tests for negative durations with leading zero unit 2024-04-23 18:27:01 +02:00
André Bargull cadd064174 Use formatDurationFormatPattern for "/numeric-hour-with-zero-minutes-and-non-zero-seconds"
The changes from the first commit allow to use
`formatDurationFormatPattern` for this test.
2024-04-23 18:27:01 +02:00
André Bargull 330ecdd016 Sync partitionDurationFormatPattern with latest spec draft
Sync `partitionDurationFormatPattern` with the latest spec draft and
change it to use an `Intl.DurationFormat` object as the input, so it's
easier to compare it against the spec text and because it allows to test
more inputs.

Includes the fixes for:
- https://github.com/tc39/proposal-intl-duration-format/pull/183
- https://github.com/tc39/proposal-intl-duration-format/pull/184
2024-04-23 18:27:01 +02:00
Ben Allen b37947f3a4 Removed extraneous comment, added roundingMode: 'trunc' to NumberFormat options when fractional digits are formatted to match behaviour of DurationFormat -- doesn't make a difference with these test values, but could with others 2024-04-23 11:30:16 +02:00
Ross Kirsling 007b333af2 Add additional tests for tc39/ecma262#3307.
Ensure that the following cases are covered:
- https://github.com/tc39/ecma262/issues/3295#issuecomment-2058110314
- https://github.com/tc39/ecma262/issues/2659#issue-1131245695
2024-04-22 12:36:07 -07:00
Mathias Bynens 830b17a3a0 Update RegExp `\p{…}` tests per Unicode 15.1.0
Issue: #3945
2024-04-17 16:04:56 -07:00
Marko Lahma 263c514afa Add missing DummyError function definition to target-super-computed-reference.js 2024-04-15 11:30:42 -07:00
Sosuke Suzuki 23c3e0111b Use space instead of tab in comments 2024-04-15 11:11:23 -07:00
Ross Kirsling 142a6a6fbe
Update test for o[p] = f() (#4052)
* Update test for o[p] = f()

Update S11.13.1_A7_T3.js now that consensus has been reached on https://github.com/tc39/ecma262/pull/3307.

* Rename test and add an analogous one for super.
2024-04-12 11:59:40 -07:00
Shu-yu Guo c5a80993cd Allow global var-via-eval be declared
See https://github.com/tc39/ecma262/pull/3226
2024-04-11 17:22:43 -07:00
Ben Allen 046dff4b33
test formatting when microseconds or nanoseconds are the first numeric-styled unit (#4034)
* test formatting when microseconds or nanoseconds are the first numeric-styled unit

* incorporated Philip Chimento guidance re: padding fractional components
2024-04-11 17:02:37 -07:00
Shu-yu Guo 0c43c587cc Fix groupBy string test keys to be insertion order 2024-04-11 16:56:41 -07:00
Ben Allen e11ef85b1b
added test for formatting mixture of short and numeric styles (#4033)
* added test for formatting mixture of short and numeric styles

* incorporated Philip Chimento feedback re: making test more general across locales
2024-04-11 16:29:13 -07:00
Frank Tang b37b6f3552 Fix incorrect tests landed in PR3890
https://github.com/tc39/test262/pull/3890
2024-04-11 16:33:56 +02:00
Philip Chimento d865ffeb2d Use correct keys in non-iso-calendars.js
Using Object.keys() of the expected values in each case decouples these
tests.
2024-04-10 08:37:31 -07:00
Philip Chimento bce41ea609 Reduce locale-dependence in non-iso-calendars.js
Previously, this test checked for a particular format. This would break
depending on which engine executed it. Instead, test for the presence of
particular types and their values in the output of formatToParts().

(There's an existing comment which suggests that this should already have
been testing formatToParts().)
2024-04-10 08:37:31 -07:00
Philip Chimento 9537de33af Remove performance logging from non-iso-calendars.js staging test
The performance logging was left over from when this test lived in the
proposal-temporal repo. It was already switched off anyway.
2024-04-10 08:37:31 -07:00
Adam Shaw 6c60904d42 test for all overflow/underflow scenarios 2024-04-08 18:24:26 -07:00
Adam Shaw 6c35fba9b2 adjust tests for round-zdt-day bugfix 2024-04-08 18:24:26 -07:00
Sosuke Suzuki b73f7d662d Use emoji strings 2024-04-04 12:47:57 -07:00
SUZUKI Sosuke 065ccc121e Update test/built-ins/Object/groupBy/string.js
Co-authored-by: Jordan Harband <ljharb@gmail.com>
2024-04-04 12:47:57 -07:00
SUZUKI Sosuke 8245443f8f Update test/built-ins/Map/groupBy/string.js
Co-authored-by: Jordan Harband <ljharb@gmail.com>
2024-04-04 12:47:57 -07:00
Sosuke Suzuki 112cf25567 Add tests for `Object.groupBy` and `Map.groupBy` with string items 2024-04-04 12:47:57 -07:00
Ben Allen e0a0c27796
DurationFormat: added tests for default styles for units following numeric-styled units (#4032) 2024-04-03 18:09:00 +02:00
Philip Chimento 63933d1da5 Temporal: Tests that dateStyle affects toLocaleString output
For each Temporal type, add a test (which should not be sensitive to the
exact locale format) that ensures dateStyle affects the output, for a
Gregorian and non-Gregorian calendar.

See https://github.com/tc39/proposal-temporal/issues/2058
2024-04-03 12:32:46 +02:00
Philip Chimento a074d97c5b Temporal: Tests for conversion of ISO 8601 string to ISO 8601 calendar
See https://github.com/tc39/proposal-temporal/issues/2105. This was not
covered yet in test262.
2024-04-03 12:32:46 +02:00
Philip Chimento a8da70622d Temporal: Tests for calendar.dateFromFields options in PYM/PMD.toPlainDate
It was previously not tested what options value a custom calendar's
dateFromFields() method would be called with, when called from the
toPlainDate() method of PlainYearMonth/PlainMonthDay.

See tc39/proposal-temporal#2803
2024-04-03 12:32:46 +02:00
Philip Chimento b4b574fca1 Temporal: argument-propertybag-calendar-year-zero testing the wrong thing
These tests were supposed to test an invalid ISO string being used as the
`calendar` property in a property bag. Instead they were testing being
used as an invalid ISO string directly where a PlainDate input was needed.
(That is also already covered elsewhere.)
2024-04-03 12:32:46 +02:00
Philip Chimento 0cb219ffe0 Temporal: Fix argument-propertybag-calendar-number testing the wrong methods
Due to overlooked copy-paste errors we were creating the wrong type of
instance in these tests, and therefore testing the wrong method.

(Add blank line for consistency with the other instances of these tests.)
2024-04-03 12:32:46 +02:00
Philip Chimento d7aec8e178 Temporal: Add test for Duration going out of range after rounding
After rounding relative to a ZonedDateTime, we have to potentially adjust
for DST. With a time zone providing nonsensical values, the duration may
go out of range.

See: tc39/proposal-temporal#2801
2024-04-03 12:32:46 +02:00
Philip Chimento f03883c7bb Temporal: Fix assertion message about float64-representable integer
This test isn't testing what the assertion message previously said it was
testing. The integer is allowed to be unsafe, but in this case its
float64-representation is out of range.

See: https://github.com/tc39/proposal-temporal/issues/2785
2024-04-03 12:32:46 +02:00
Philip Chimento c4f5778671 Temporal: Add tests for mixed signs in DifferenceTemporalPlainDateTime
With test cases kindly provided by Anba, this adds test coverage for the
abrupt completion in the last step of DifferenceTemporalPlainDateTime,
where the resulting Duration components have mixed signs.

See: https://github.com/tc39/proposal-temporal/issues/2783
2024-04-03 12:32:46 +02:00
Philip Chimento c8a876b1d9 Temporal: Add clarifying assertion messages
normalized-time-duration-to-days-range-errors.js tests for several error
cases in the AO NormalizedTimeDurationToDays. Adding assertion messages
helps to know which one you are debugging.
2024-04-03 12:32:46 +02:00
Philip Chimento 0c12b84244 Temporal: Add tests for incorrectly capitalized annotation keys
As per IETF, annotation keys may only consist of lowercase letters,
dashes, and digits, and an optional leading underscore. Uppercase letters
are non-syntactical. Add tests covering this.
2024-04-03 12:32:46 +02:00
Philip Chimento 8b781361a9 Temporal: Add test for last step of UnbalanceDateDurationRelative throwing
Based on a test case by Anba.
See https://github.com/tc39/proposal-temporal/pull/2690#issuecomment-1938768702
2024-04-03 12:32:46 +02:00
Philip Chimento f4f33d272c Temporal: Fix assertion message 2024-04-03 12:32:46 +02:00
Philip Chimento 1e3d8cbb37 Add extra tests for newly fixed bug 2024-04-01 17:44:45 -07:00
Adam Shaw 96718952b0 updated tests for ZDT diffing w/ backoffs 2024-04-01 17:44:45 -07:00
Philip Chimento 984f3cc284 Temporal: Tests for correct intermediate value in ZonedDateTime difference/rounding
These test cases ensure that DST disambiguation does not take place on
intermediate values that are not the start or the end of the calculation.

Note that NormalizedTimeDurationToDays is no longer called inside
Temporal.Duration.prototype.add/subtract, so a few tests can be deleted.

Other tests need to be adjusted because NormalizedTimeDurationToDays is
no longer called inside Temporal.ZonedDateTime.prototype.since/until via
DifferenceZonedDateTime, although it is still called as part of rounding.

In addition, new tests for the now-fixed edge case are added, and for the
day corrections that can happen to intermediates.

See https://github.com/tc39/proposal-temporal/pull/2760
2024-04-01 17:44:45 -07:00
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