Commit Graph

182 Commits

Author SHA1 Message Date
Rick Waldron 7fbce5a9d8 Promise.any: simplify promise creation 2020-03-25 12:04:37 -04:00
Rick Waldron 5c68b60ad3 Promise.any: cleanup in @@species tests 2020-03-25 12:04:37 -04:00
Rick Waldron d9265df3ab Promise.any: additional then + resolve tests 2020-03-25 12:04:37 -04:00
Rick Waldron 1c748507f2 Promise.any: feature flags 2020-03-25 12:04:36 -04:00
Rick Waldron 5d3eafc547 Promise.any: review fixes 2020-03-25 12:04:36 -04:00
Rick Waldron 6edaba378e Promise.any: updates, corrections and new tests. 2020-03-25 12:04:36 -04:00
Rick Waldron e0f0c7860b Promise.any: empty iterable rejects with AggregateError 2020-03-25 12:04:36 -04:00
Rick Waldron 272e9abed4 Promise.any: make async operation test actually async 2020-03-25 12:04:36 -04:00
Rick Waldron 47b3858978 Promise.any: expected rejection shouldn't end with error message. 2020-03-25 12:04:36 -04:00
Rick Waldron 55b22d8d9f Promise.any: string iterable should not be rejected (adds error message for clarity) 2020-03-25 12:04:36 -04:00
Rick Waldron e0abeaa4df Promise.any: convert sync test to async test to ensure run to completion 2020-03-25 12:04:36 -04:00
chicoxyzzy 860e02ad28 add iter-assigned tests 2020-03-25 12:04:36 -04:00
chicoxyzzy 9567abd85a Add iter-arg tests 2020-03-25 12:04:36 -04:00
chicoxyzzy 094ddc7f75 add species-get-error test 2020-03-25 12:04:36 -04:00
chicoxyzzy e3d48f244a add Invocation of the instance's `then` method test 2020-03-25 12:04:35 -04:00
chicoxyzzy afe3f0bb50 add reject-immed test 2020-03-25 12:04:35 -04:00
chicoxyzzy adcd162c10 add is callable test 2020-03-25 12:04:35 -04:00
chicoxyzzy 88d058b59e Add returns promise test 2020-03-25 12:04:35 -04:00
chicoxyzzy be1bf6391e Add Promise and Promise.any properties tests 2020-03-25 12:04:35 -04:00
chicoxyzzy 23d7f0b79d add Invocation of the constructor's `resolve` method test 2020-03-25 12:04:35 -04:00
chicoxyzzy f0fd4e0d4d update features.txt
-
2020-03-25 12:04:35 -04:00
chicoxyzzy aca10842a2 Add context tests 2020-03-25 12:04:35 -04:00
chicoxyzzy 715964b16b Add Capability Executor tests 2020-03-25 12:04:35 -04:00
Gus Caplan 900855b07b Fix Promise/prototype/finally/rejected-observable-then-calls-argument 2020-02-13 10:37:24 -05:00
Gus Caplan 505949357b Fix call to $DONE 2020-02-08 08:55:38 -05:00
Rick Waldron 811090fce2 Fix: \$DONE() must not be called with an argument, unless the argument is an error. 2020-02-07 12:24:43 -05:00
Jordan Harband 0ebbdf0395 `Promise.prototype.finally` thunks have a length of 0 2020-02-07 11:44:31 -05:00
Alexey Shvayka 57d5ffa471 Fix $DONE usage 2020-02-05 15:05:51 -05:00
Alexey Shvayka c5b1c97362 Fix isConstructor checks 2020-02-05 15:05:51 -05:00
Alexey Shvayka b3ec56fb8c Add CreateResolvingFunctions tests 2020-02-05 15:05:51 -05:00
Alexey Shvayka 8ce27898b9 Add Then Finally Functions test 2020-02-05 15:05:51 -05:00
Alexey Shvayka 1e13f2b1e7 Add Catch Finally Functions test 2020-02-05 15:05:51 -05:00
Alexey Shvayka 95fd012c66 Add isConstructor to Promise.prototype.finally test 2020-02-05 15:05:51 -05:00
Alexey Shvayka 71a70fc117 Use isConstructor in "executor-function-nonconstructor.js" (#2393) 2019-10-08 14:41:29 -04:00
Mike Pennisi f26c2a11bd Remove unnecessary "includes" directives
The values defined by the referenced files are not used by these tests.
This makes their inclusion superfluous, which needlessly increases the
time to execute the tests and may confuse some readers.
2019-09-25 13:59:24 -04:00
Alexey Shvayka 8042c57d9b Add Promise#finally invoked on thenable test (#2312)
* Rename proxy context test

* Add thenable context test
2019-08-28 12:42:24 -03:00
André Bargull 59a1a016b7 Assign "name" property to all anonymous functions (#2299)
Implements the changes from <https://github.com/tc39/ecma262/pull/1490>.
2019-08-15 10:58:40 -04:00
Leo Balter ff9763729d Remove duplicated es[56]id if esid is present 2019-08-05 10:54:37 -04:00
André Bargull d8c20b423b Call $DONE function exactly once per test
Also make a note in CONTRIBUTING.md that `$DONE` shouldn't be called multiple times.
2019-07-22 02:12:24 -07:00
Alexey Shvayka d7c95efe66 Improve "name" tests of Promise built-in functions (#2179) 2019-06-26 15:03:14 -04:00
Gus Caplan 61ccff550e Fix invoke-resolve-get-error-close tests (#2210) 2019-06-21 14:26:57 -04:00
Aleksey Shvayka e4fed70c9b Fix description of Promise constructor test (#2174) 2019-05-22 17:57:45 -04:00
Aleksey Shvayka ee960aefb5 Improve Promise constructor coverage (#2158)
* Add constructor descriptor test

* Rename & improve non-callable executor test

* Rename & simplify executor call context tests

* Remove duplicate reject via abrupt test

* Deduplicate undefined NewTarget tests

* Add basic constructor test

* Add abrupt prototype getting tests
2019-05-22 17:33:09 -04:00
Leo Balter 3b2ad0b5d0 Fix tests for new resolve lookup in Promise.allSettled 2019-04-24 17:28:01 -04:00
Leo Balter 24d1b6d59c Fix tests for new resolve lookup 2019-04-24 17:28:01 -04:00
Leo Balter b646cf6365 Add tests for Promise.all|race resolve lookup
Ref tc39/ecma262#1506
2019-04-24 17:28:01 -04:00
Leo Balter 7e7b9e103d
Port tests from Promise.all to Promise.allSettled (#2124) 2019-04-17 14:17:54 -04:00
Rick Waldron 6d2288fe79 Eliminate false positives: Promise.prototype.finally 2018-11-30 09:34:25 -05:00
Adrian Heine fc6de76a0d Add missing mandatory Promise.{all,race} argument 2018-11-08 09:37:56 +01:00
André Bargull 500e48e6ce Fix various test bugs (#1502)
Fixes #1492
2018-03-22 16:36:57 -04:00
Rick Waldron 03f0f56961 Promise.all/race with non-iterable or invalid return from Symbol.iterator. (#1496)
Fixes gh-1490
2018-03-19 14:01:36 -04:00
Rick Waldron 133dfa8793 built-ins/Promise/*: make all indentation consistent (depth & character) (#1433) 2018-02-15 15:11:21 -05:00
André Bargull f95b56ab28 Revert "js-beautify: make all indentation consistent (depth & character) (#1409)" (#1412)
This reverts commit a01de4a722.
2018-02-09 12:09:47 -05:00
Rick Waldron a01de4a722 js-beautify: make all indentation consistent (depth & character) (#1409) 2018-02-09 11:35:37 -05:00
André Bargull 82c6148980 Add missing closing parenthesis and remove invalid async flag (#1402) 2018-02-01 14:04:51 -05:00
Jordan Harband 03da22868a Promise.prototype.finally: add more tests
- per https://github.com/tc39/ecma262/pull/1083#issuecomment-361775023
2018-01-30 20:47:35 -05:00
Jordan Harband 7c5b5bf750 Promise.prototype.finally: add missing tests
Per:
 - https://github.com/tc39/test262/issues/866#issuecomment-328565337
 - https://github.com/tc39/test262/issues/866#issuecomment-359978873

Closes #866.
2018-01-25 14:03:28 -05:00
André Bargull f717982c94 Remove unused includes 2018-01-25 13:59:37 -05:00
Rick Waldron 66df349af3 Assert that promise callbacks were actually called. Closes #1328
Originally reported here: https://github.com/tc39/test262/pull/1328, OP passed on revising.
2018-01-05 13:23:35 -05:00
Rick Waldron 92a2621901 Frontmatter: fixup "info: >" to "info: |" 2018-01-05 12:27:59 -05:00
Rick Waldron 4b4c44cb51 fixup: swap actual and expected in test/built-ins/Promise/prototype/finally/species-symbol.js (#1333) 2017-11-03 15:34:22 -04:00
Sathya Gunasekaran a392f6ced8 Promise.p.finally: test SpeciesConstructor and Symbol.species lookup 2017-10-28 14:01:13 -07:00
Leo Balter 7cbbe51216 Add cross-realm feature 2017-09-22 15:29:10 -04:00
Jordan Harband 3528601c41
Promise.prototype.finally: add tests 2017-07-25 23:06:12 -07:00
Rick Waldron 86209d8fd9 Make all harness/* file names consistent; update occurrences in test
Signed-off-by: Rick Waldron <waldron.rick@gmail.com>
2017-06-28 11:53:58 -04:00
Leo Balter f6175af556 Add tests for Promises rejection queue (#1029)
* Add tests for Promises rejection queue

These basic tests assert the rejection is captured but a later queued job
from a chain of then calls.

* fixup! Add tests for Promises rejection queue
2017-05-10 12:59:18 -04:00
Mike Pennisi a61efb5192 Add omitted license information
As the author of these files, I can verify that they were contributed in
2015 on behalf of the V8 project.
2017-04-18 12:23:22 -04:00
André Bargull d59e30c95e Remove execute bit from files (#976) 2017-04-13 16:24:07 -04:00
Rick Waldron fdd2fa9b1c Rename $ => $262. Fixes gh-802 (#823)
Signed-off-by: Rick Waldron <waldron.rick@gmail.com>
2017-03-01 16:34:15 -05:00
Kevin Gibbons e6abf652d9 Ensure that tests calling $DONE have the async flag 2016-11-21 10:14:30 -05:00
Sathya 84e6ba81d0 Update context-non-object-with-promise.js (#790)
Promise constructor accepts only one executor function
2016-11-15 10:45:03 -08:00
jugglinmike 71e573f7da Add tests for realm interactions (#688)
* Add tests for prototype realm inference

* Add tests for miscellaneous realm concerns

* Add tests for realm of spec-created Errors

In some cases, Error objects produced by the specification are
observable from ECMAScript code. Among these cases, some are further
differentiated in that they occur outside of any built-in function and
may be triggered through syntactic production directly. The current
realm record is commonly interpreted incorrectly under these
circumstances.

Add tests asserting that the expected realm record is used when
constructing such Error objects.

* Add tests for realm use in ArraySpeciesCreate

* Add tests for function realm retrieval

* Add tests for cross-realm behaviors of Symbols

* Add tests for GetValue and PutValue

* Add tests for realm of spec-created Arrays

In some cases, Arrays produced by CreateArrayFromList are observable
from ECMAScript code. Among these cases, two occur outside of any
built-in function and may be triggered through syntactic production
directly. The current realm record is commonly interpreted incorrectly
under these circumstances.

Add tests asserting that the expected realm record is used when
constructing arrays.

* Add test for spec-created object

* fixup! Add tests for realm of spec-created Errors

* fixup! Add tests for realm of spec-created Errors

* fixup! Add tests for prototype realm inference

* fixup! Add tests for miscellaneous realm concerns
2016-10-24 10:43:17 -07:00
Mike Pennisi 1ec40f349a Re-write tests for Promise.prototype internal slots
The original implementation of the test for the absense of a
[[PromiseState]] internal slot did not actually assert the documented
semantics. Re-implement the test to rely on the IsPromise abstract
operation (via `Promise.prototype.then`) to accurately ensure that the
object does not have a [[PromiseState]] internal slot.

In relying on the semantics of the `instanceof` operator, the original
test for the [[Prototype]] internal slot was imprecise (the assertion
could be satisfied if additional objects were incorrectly defined on the
prototype chain). Re-write the test to assert the value of the
[[Prototype]] internal slot directly.
2016-06-27 15:31:01 -04:00
Mike Pennisi cc7c77b9a1 Add test for Promise prototype property descriptor 2016-06-27 15:31:00 -04:00
Mike Pennisi 23659d6128 Extend coverage for `Promise.prototype.catch` 2016-06-27 15:31:00 -04:00
Mike Pennisi 12902b29c0 Add tests for invocation of Promise capability fns 2016-06-27 15:26:36 -04:00
Mike Pennisi c62700c8ef Assert iterator protocol for Promise methods 2016-06-27 15:26:35 -04:00
Mike Pennisi 2b5efe135c Add test for abrupt completion during Promise.all 2016-06-27 15:19:48 -04:00
Mike Pennisi b458d9bcc4 Add more tests for Promise resolution
Ensure that resolution is ignored for Promises that have already been
rejected.
2016-06-27 15:19:48 -04:00
Mike Pennisi 023ab45cf0 Extend tests for Promise resolve and reject fns
Assert expected return values in all cases.
2016-06-24 20:17:24 -04:00
Mike Pennisi eb644bb2da Reduce reliance on `fnGlobalObject.js`
This harness function is not necessary in the majority of cases in which
it is used. Remove its usage to simplify tests and decrease the amount
of domain-specific knowledge necessary to contribute to the test suite.

Persist the harness function itself for use by future tests for ES2015
modules (such a helper is necessary for tests that are interpreted as
module code).
2016-04-25 11:09:21 -07:00
Leo Balter 5357b1585b Merge pull request #504 from bocoup/explicit-async
Make asynchronous test configuration explicit
2016-03-17 15:28:08 -04:00
Gorkem Yakin eeb44cbe09 Merge pull request #500 from bocoup/prms-guard-thenable-opt
Promise: Add tests to disallow faulty optimization
2016-02-12 17:06:34 -08:00
Mike Pennisi 23d566209a Make asynchronous test configuration explicit
For asynchronous tests, the contract between test file and test runner
is implicit: runners are expected to inspect the source code for
references to a global `$DONE` identifier.

Promote a more explicit contract between test file and test runner by
introducing a new frontmatter "tag", `async`. This brings asynchronous
test configuration in-line with other configuration mechanisms and also
provides a more natural means of test filtering.

The modifications to test files was made programatically using the
`grep` and `sed` utilities:

    $ grep "\$DONE" test/ -r --files-with-match --null | \
        xargs -0 sed -i 's/^\(flags:\s*\)\[/\1[async, /g'
    $ grep "\$DONE" test/ -rl --null | \
        xargs -0 grep -E '^flags:' --files-without-match --null | \
        xargs -0 sed -i 's/^---\*\//flags: [async]\n---*\//'
2016-02-12 13:03:19 -05:00
Mike Pennisi e3fae6eeb4 Promise: Add test for constructor access count
Assert that the `constructor` property of the "this" value of
`Promise.prototype.then` is accessed exactly once. This guards against
implementations where repeated access is used instead of reference
passing (possibly motivated by convenience).

Repeated access of this kind was demonstrated by V8's implementation of
the specification:

https://bugs.chromium.org/p/v8/issues/detail?id=4539
2016-02-10 13:56:55 -05:00
Mike Pennisi 219bdc6f73 Promise: Add tests to disallow faulty optimization
Add tests that assert behavior when a Promise is resolved with another
Promise whose `then` method has been overridden. Because all objects
with a `then` method are treated equivalently, the presence of a
[[PromiseState]] internal slot should have no effect on program
behavior.

These tests guard against a faulty optimization originally implemented
in V8:

https://bugs.chromium.org/p/v8/issues/detail?id=3641
2016-02-10 13:38:03 -05:00
Gorkem Yakin 738a24b109 Merge pull request from jugglinmike/improve-promise-coverage-resolve (closes #463) 2016-01-19 16:33:23 -08:00
Mike Pennisi b1b4f04494 Add tests for Promise Resolve Functions
Remove files that tested both PerformPromiseThen and
PromiseResolveFunction in favor of new tests that test
PromiseResolveFunction more directly and completely.
2016-01-19 16:32:36 -08:00
Gorkem Yakin 4a862fba95 Merge pull request #465 from jugglinmike/improve-promise-coverage-all-race
Improve Promise coverage: PerformPromiseAll & PeformPromiseRace
2016-01-15 16:19:18 -08:00
André Bargull ca61d9b876 Add missing tests for "length" and "name" properties of built-in functions
Note: Already uses the updated DataView function lengths from tc39/ecma262#266 (ES2016 Draft 2015-12-20)
2016-01-15 18:12:05 +01:00
André Bargull 5e3eed63b9 Move Symbol.species and AnnexB tests to new subfolders 2016-01-15 18:11:03 +01:00
Gorkem Yakin cd60a6d83a Merge pull request #464 from jugglinmike/improve-promise-coverage-cap
Improve Promise coverage: NewPromiseCapability
2016-01-13 16:49:47 -08:00
Mike Pennisi 7fab70bb21 Add tests for Promise Reject Functions 2016-01-07 13:24:42 -05:00
Mike Pennisi a5bf19486a Extend coverage for PerformPromiseThen 2016-01-07 13:24:01 -05:00
Mike Pennisi 8e069e918f Extend coverage for PromiseReactionJob
Add tests that assert sequential job execution
2016-01-07 13:24:01 -05:00
Mike Pennisi eded6b269b Extend tests to fully cover invocation concerns
Update test metadata to accurately describe the more complete set of
assertions.
2016-01-07 13:24:00 -05:00
Mike Pennisi 5f2ba2522f Limit semantics under test
Because these tests concern the behavior of the PromiseReactionJob
abstract operation itself, they should avoid assumptions about the
correct implementation of that operation. Specifically: they should not
rely on the behavior of abupt completions returned from "reaction
handler" functions.

Re-implement tests to express control flow expectations using the
`$DONE` function only.
2016-01-07 13:23:54 -05:00
Mike Pennisi 5a8d1fdf77 Re-organize tests according to internal operations
By organizing files according to the structure of the specification,
test coverage can be more methodically evaluated.
2016-01-07 13:01:25 -05:00
Mike Pennisi 29cdc4543f Rename tests for PromiseReactionJob
Use names that describe the behavior (not the location in the
specification) as per the current convention.
2016-01-07 12:55:36 -05:00
Mike Pennisi f01767916a Rename tests for PerformPromiseThen
These tests concern the behavior of PerformPromiseThen for settled
Promises. That abstract operation behaves differently for pending
promises, so the file naming scheme should reflect this distinction in
order to support the future implementation of additional tests.
2016-01-07 12:55:31 -05:00