Commit Graph

70 Commits

Author SHA1 Message Date
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
Mike Pennisi 615f42274d Extend coverage for NewPromiseCapability 2016-01-07 12:42:44 -05:00
Mike Pennisi 6e9d88a293 Extend coverage for PerformPromiseRace 2016-01-07 12:42:21 -05:00
Mike Pennisi bb26beece2 Extend coverage for PerformPromiseAll 2016-01-07 12:42:21 -05:00
Gorkem Yakin ca0e411870 Merge pull request #447 from anba/promise_coverage
Improve test coverage for various Promise methods
2015-12-10 08:29:38 -08:00
Rick Waldron 59dfae6311 Merge pull request #450 from cscott/promise-improvements
Remove unnecessary ES2015 syntax; add feature flags where appropriate.
2015-12-04 14:50:52 -05:00
André Bargull 4341537ecd Add 'class' features tag 2015-12-04 14:31:01 +01:00
C. Scott Ananian bae004d531 Remove unnecessary ES2015 syntax; add feature flags where appropriate.
This allows these tests to be more easily reused to test Promise
implementations in isolation.
2015-12-03 17:34:17 -05:00
Gorkem Yakin 47d3eb1bfe Merge pull request #446 from anba/es2016_december_update
Updates for ES2016 Draft 2015-12-01
2015-12-03 13:15:34 -08:00
André Bargull bd8c91e250 Updates for ES2016 Draft 2015-12-01
- RegExp.prototype[Symbol.split] calls ToUint32 (https://github.com/tc39/ecma262/issues/92)
- Species lookup removed from Promise.all and Promise.race (https://github.com/tc39/ecma262/issues/151)
- Generator functions are no longer constructors (https://github.com/tc39/ecma262/pull/171)

Fixes #444
2015-12-02 18:07:06 +01:00
André Bargull 5279bcb174 Improve test coverage for various Promise methods 2015-12-02 18:06:40 +01:00
André Bargull 38c6700cbb Test built-in function requirements of Promise and Proxy helper functions 2015-11-24 20:12:55 +01:00
Mike Pennisi d6bbbc9aed Add tests for well-known Symbol: @@toStringTag 2015-08-07 20:02:44 -04:00