[await-dictionary] add failure case and edge case tests#5041
[await-dictionary] add failure case and edge case tests#5041danialasaria wants to merge 1 commit into
Conversation
578f02d to
6e2fa0c
Compare
acutmore
left a comment
There was a problem hiding this comment.
Could we also have a test that a custom constructor is being 'constructed' rather than 'called'.
If we can use new.target we can check like:
var error = new Test262Error();
function Constructor(executor) {
if (new.target !== Constructor) {
throw error
}
}We can also have assertions that validate the arguments passed to a custom constructor are correct: should only be one argument: the executor. And it should be a function with length 2.
|
|
||
| Promise.allSettledKeyed.call(Constructor, input); | ||
|
|
||
| assert.sameValue(callCount, 1, "callCount after call to allSettledKeyed()"); |
There was a problem hiding this comment.
Could we either move the callCount to after the assertions, or have a separate count for the start and end of the callback. Otherwise technically the assertions could reject and they are swallowed by the function caller yet the test would pass (unless the harness has some tracking logic to guarantee a test fails if a harness assertion errors, rather than relying on the exception bubbling up)
Cover remaining items from the testing plan (tc39#4886): - NewPromiseCapability: constructor throws, executor not callable - NewPromiseCapability: validate Construct (new.target, executor arity) - GetPromiseResolve: Get accessor throws, promiseResolve call throws - Invoke(then): Get accessor throws, call throws - allKeyed rejection ordering (2nd and last to settle) - Synchronous thenables hitting remainingElementsCount step 8 - Exotic object: [[OwnPropertyKeys]] throws - Exotic object: [[GetOwnProperty]] throws / returns undefined - Property descriptor filtering: non-enumerable keys skipped
6e2fa0c to
85ec0d4
Compare
| ownKeys: function() { | ||
| return ['key']; | ||
| }, |
There was a problem hiding this comment.
not harmful but also feels superfluous to the test as ownKeys will already be returning this.
| ownKeys: function() { | ||
| return ['key']; | ||
| }, |
There was a problem hiding this comment.
Same comment as: https://github.com/tc39/test262/pull/5041/changes#r3241633686
Summary
This PR adds the remaining failure-case and edge-case coverage for the await-dictionary proposal's Promise keyed combinators:
Promise.allKeyedPromise.allSettledKeyedIt follows the runtime/behavioral tests PR (#4932) and completes the testing plan from #4886.
What this PR covers
NewPromiseCapability failures (sync throws)
ctx-ctor-throws.js)capability-executor-not-callable.js)GetPromiseResolve failures (async rejections)
Get(constructor, "resolve")accessor throws (invoke-resolve-get-error-reject.js)promiseResolvefunction throws (invoke-resolve-error-reject.js)Invoke(then) failures (async rejections)
Get(nextPromise, "then")accessor throws (invoke-then-get-error-reject.js)nextPromise.then(...)throws (invoke-then-error-reject.js)allKeyed rejection ordering
reject-second.js)reject-last.js)Synchronous thenables (step 8 edge case)
onFulfilledduring the loop, causingremainingElementsCountto reach zero before the loop exits (resolve-before-loop-exit.js)Exotic object abrupt completions (Proxy)
[[OwnPropertyKeys]]throws (ownkeys-throws.js)[[GetOwnProperty]]throws (getownproperty-throws.js)[[GetOwnProperty]]returnsundefined-- key is skipped (getownproperty-returns-undefined.js)Property descriptor filtering
getownproperty-not-enumerable.js)Notes
asyncTestfromasyncHelpers.jsper reviewer feedback on [await-dictionary] add runtime keyed Promise combinator tests #4932assert.throws(...)features: [await-dictionary]; Proxy tests additionally gate onProxyPromise.all/Promise.allSettledtest suitescapability-executor-not-callableincludes poisonedresolvegetters (matchingPromise.allcounterpart) to detect wrong evaluation orderWhat this PR does not cover
This completes all items from the testing plan (#4886).
References
Promise.allKeyedandPromise.allSettledKeyedtesting plan #4886