summaryrefslogtreecommitdiff
path: root/src/dstr-assignment/array-elem-iter-rtrn-close.case
diff options
context:
space:
mode:
Diffstat (limited to 'src/dstr-assignment/array-elem-iter-rtrn-close.case')
-rw-r--r--src/dstr-assignment/array-elem-iter-rtrn-close.case19
1 files changed, 14 insertions, 5 deletions
diff --git a/src/dstr-assignment/array-elem-iter-rtrn-close.case b/src/dstr-assignment/array-elem-iter-rtrn-close.case
index 7f1c482fe..1726266e2 100644
--- a/src/dstr-assignment/array-elem-iter-rtrn-close.case
+++ b/src/dstr-assignment/array-elem-iter-rtrn-close.case
@@ -25,12 +25,16 @@ esid: sec-runtime-semantics-destructuringassignmentevaluation
---*/
//- setup
+var nextCount = 0;
var returnCount = 0;
var unreachable = 0;
var thisValue = null;
var args = null;
-var iterable = {};
var iterator = {
+ next: function() {
+ nextCount += 1;
+ return {done: false, value: undefined};
+ },
return: function() {
returnCount += 1;
thisValue = this;
@@ -38,24 +42,29 @@ var iterator = {
return {};
}
};
-var iter, result;
+var iterable = {};
iterable[Symbol.iterator] = function() {
return iterator;
};
function* g() {
//- elems
-[ {}[yield] ]
+[ {} = yield ]
//- vals
iterable
//- body
unreachable += 1;
//- teardown
}
-iter = g();
+var iter = g();
iter.next();
-result = iter.return(777);
+assert.sameValue(nextCount, 1);
+assert.sameValue(returnCount, 0);
+
+var result = iter.return(777);
+
+assert.sameValue(nextCount, 1);
assert.sameValue(returnCount, 1);
assert.sameValue(unreachable, 0, 'Unreachable statement was not executed');
assert.sameValue(result.value, 777);