mirror of https://github.com/tc39/test262.git
Correct test
As written, the test behavior and description do not match--the `throw` invocation takes place while generator execution is paused *within* the `try..catch` statement (not following it). Ensure that the test exercises the described behavior (and remove extraneous invocation of method under test).
This commit is contained in:
parent
332c4dab05
commit
ef5594b675
|
@ -8,10 +8,12 @@ description: >
|
|||
location in the function body.
|
||||
---*/
|
||||
|
||||
var obj = {};
|
||||
function* g() {
|
||||
yield 1;
|
||||
try {
|
||||
yield 2;
|
||||
throw obj;
|
||||
} catch (e) {
|
||||
yield e;
|
||||
}
|
||||
|
@ -29,9 +31,14 @@ result = iter.next();
|
|||
assert.sameValue(result.value, 2, 'Second result `value`');
|
||||
assert.sameValue(result.done, false, 'Second result `done` flag');
|
||||
|
||||
result = iter.throw(exception);
|
||||
assert.sameValue(result.value, exception, 'Third result `value`');
|
||||
result = iter.next();
|
||||
assert.sameValue(result.value, obj, 'Third result `value`');
|
||||
assert.sameValue(result.done, false, 'Third result `done` flag');
|
||||
|
||||
result = iter.next();
|
||||
assert.sameValue(result.value, 3, 'Fourth result `value`');
|
||||
assert.sameValue(result.done, false, 'Fourth result `done` flag');
|
||||
|
||||
assert.throws(Test262Error, function() { iter.throw(new Test262Error()); });
|
||||
|
||||
result = iter.next();
|
||||
|
|
Loading…
Reference in New Issue