Fix issues in async generator case files

Incorrect $DONE handlers which led to calling $DONE twice
- async-generators/yield-promise-reject-next-yield-star-async-iterator.case
- dstr-assignment-for-await/array-elem-trlg-iter-rest-nrml-close-skip.case

$DONE handler not called at all:
- dstr-assignment-for-await/array-elem-put-const.case
- dstr-assignment-for-await/array-elem-trlg-iter-elision-iter-nrml-close-null.case

Incorrect assumed execution sequence in IteratorDestructuringAssignmentEvaluation:
- dstr-assignment-for-await/array-elem-iter-rtrn-close-null.case
This commit is contained in:
André Bargull 2017-09-02 17:08:45 +02:00 committed by Rick Waldron
parent c23ea89fe2
commit f810ad2550
5 changed files with 28 additions and 6 deletions

View File

@ -28,4 +28,4 @@ iter.next().then(() => {
assert.sameValue(done, true, "The value of IteratorResult.done is `true`");
assert.sameValue(value, undefined, "The value of IteratorResult.value is `undefined`");
}).then($DONE, $DONE);
}).then($DONE, $DONE);
}, $DONE).catch($DONE);

View File

@ -4,6 +4,12 @@
desc: >
IteratorClose throws a TypeError when `return` returns a non-Object value
info: |
AssignmentElement : DestructuringAssignmentTarget Initializer
1. If DestructuringAssignmentTarget is neither an ObjectLiteral nor an ArrayLiteral, then
a. Let lref be the result of evaluating DestructuringAssignmentTarget.
b. ReturnIfAbrupt(lref).
[...]
ArrayAssignmentPattern : [ AssignmentElementList ]
[...]
@ -43,7 +49,12 @@ iterable
//- body
unreachable += 1;
//- teardown
iter.next().then(() => $DONE('Promise incorrectly fulfilled.'), ({ constructor }) => {
assert.sameValue(unreachable, 0);
assert.sameValue(constructor, TypeError);
}).then($DONE, $DONE);
iter.next().then(result => {
assert.sameValue(result.value, undefined);
assert.sameValue(result.done, false);
iter.return().then(() => $DONE('Promise incorrectly fulfilled.'), ({ constructor }) => {
assert.sameValue(unreachable, 0);
assert.sameValue(constructor, TypeError);
}).then($DONE, $DONE);
}, $DONE).catch($DONE);

View File

@ -15,3 +15,8 @@ const c = null;
[ c ]
//- vals
[1]
//- teardown
promise.then(() => $DONE('Promise incorrectly fulfilled.'), ({ constructor }) => {
assert.sameValue(iterCount, 0);
assert.sameValue(constructor, TypeError);
}).then($DONE, $DONE);

View File

@ -57,3 +57,9 @@ TypeError
[ x , , ]
//- vals
iterable
//- teardown
promise.then(() => $DONE('Promise incorrectly fulfilled.'), ({ constructor }) => {
assert.sameValue(iterCount, 0);
assert.sameValue(nextCount, 2);
assert.sameValue(constructor, TypeError);
}).then($DONE, $DONE);

View File

@ -52,4 +52,4 @@ iter.next().then(() => {
assert.sameValue(x, 1, 'x');
assert.sameValue(y.length, 0, 'y.length');
}).then($DONE, $DONE);
}).then($DONE, $DONE);
}, $DONE).catch($DONE);