Correct test

As written, the test behavior and description do not match--the
`throw` invocation takes place while generator execution is paused
*within* the `finally` block (not following it).

Ensure that the test exercises the described behavior (and remove
extraneous invocation of method under test).
This commit is contained in:
Mike Pennisi 2015-05-25 15:16:11 -04:00
parent ef5594b675
commit a2e1fc713e
1 changed files with 6 additions and 1 deletions

View File

@ -16,6 +16,7 @@ function* g() {
yield 3;
}
yield 4;
$ERROR('This code is unreachable');
}
var iter = g();
var result;
@ -28,10 +29,14 @@ result = iter.next();
assert.sameValue(result.value, 2, 'Second result `value`');
assert.sameValue(result.done, false, 'Second result `done` flag');
result = iter.throw(new Error());
result = iter.next();
assert.sameValue(result.value, 3, 'Third result `value`');
assert.sameValue(result.done, false, 'Third result `done` flag');
result = iter.next();
assert.sameValue(result.value, 4, 'Third result `value`');
assert.sameValue(result.done, false, 'Third result `done` flag');
assert.throws(Test262Error, function() { iter.throw(new Test262Error()); });
result = iter.next();