diff options
Diffstat (limited to 'test/built-ins/GeneratorPrototype/return')
17 files changed, 80 insertions, 30 deletions
diff --git a/test/built-ins/GeneratorPrototype/return/from-state-executing.js b/test/built-ins/GeneratorPrototype/return/from-state-executing.js index 9cf5a78bd..203c1a746 100644 --- a/test/built-ins/GeneratorPrototype/return/from-state-executing.js +++ b/test/built-ins/GeneratorPrototype/return/from-state-executing.js @@ -37,6 +37,7 @@ features: [generators] ---*/ var iter, result; + function* g() { iter.return(42); } diff --git a/test/built-ins/GeneratorPrototype/return/from-state-suspended-start.js b/test/built-ins/GeneratorPrototype/return/from-state-suspended-start.js index b20ad0aed..34e6eebfb 100644 --- a/test/built-ins/GeneratorPrototype/return/from-state-suspended-start.js +++ b/test/built-ins/GeneratorPrototype/return/from-state-suspended-start.js @@ -10,6 +10,7 @@ features: [generators] ---*/ var bodyCount = 0; + function* G() { bodyCount += 1; } diff --git a/test/built-ins/GeneratorPrototype/return/this-val-not-generator.js b/test/built-ins/GeneratorPrototype/return/this-val-not-generator.js index 1af04d299..dd0ff4b33 100644 --- a/test/built-ins/GeneratorPrototype/return/this-val-not-generator.js +++ b/test/built-ins/GeneratorPrototype/return/this-val-not-generator.js @@ -27,44 +27,60 @@ var GeneratorPrototype = Object.getPrototypeOf(g).prototype; assert.throws( TypeError, - function() { GeneratorPrototype.return.call({}); }, + function() { + GeneratorPrototype.return.call({}); + }, 'ordinary object (without value)' ); assert.throws( TypeError, - function() { GeneratorPrototype.return.call({}, 1); }, + function() { + GeneratorPrototype.return.call({}, 1); + }, 'ordinary object (with value)' ); assert.throws( TypeError, - function() { GeneratorPrototype.return.call(function() {}); }, + function() { + GeneratorPrototype.return.call(function() {}); + }, 'function object (without value)' ); assert.throws( TypeError, - function() { GeneratorPrototype.return.call(function() {}, 1); }, + function() { + GeneratorPrototype.return.call(function() {}, 1); + }, 'function object (with value)' ); assert.throws( TypeError, - function() { GeneratorPrototype.return.call(g); }, + function() { + GeneratorPrototype.return.call(g); + }, 'generator function object (without value)' ); assert.throws( TypeError, - function() { GeneratorPrototype.return.call(g, 1); }, + function() { + GeneratorPrototype.return.call(g, 1); + }, 'generator function object (with value)' ); assert.throws( TypeError, - function() { GeneratorPrototype.return.call(g.prototype); }, + function() { + GeneratorPrototype.return.call(g.prototype); + }, 'generator function prototype object (without value)' ); assert.throws( TypeError, - function() { GeneratorPrototype.return.call(g.prototype, 1); }, + function() { + GeneratorPrototype.return.call(g.prototype, 1); + }, 'generator function prototype object (with value)' ); diff --git a/test/built-ins/GeneratorPrototype/return/this-val-not-object.js b/test/built-ins/GeneratorPrototype/return/this-val-not-object.js index edf0b124e..c8431b407 100644 --- a/test/built-ins/GeneratorPrototype/return/this-val-not-object.js +++ b/test/built-ins/GeneratorPrototype/return/this-val-not-object.js @@ -26,66 +26,90 @@ var symbol = Symbol(); assert.throws( TypeError, - function() { GeneratorPrototype.return.call(undefined); }, + function() { + GeneratorPrototype.return.call(undefined); + }, 'undefined (without value)' ); assert.throws( TypeError, - function() { GeneratorPrototype.return.call(undefined, 1); }, + function() { + GeneratorPrototype.return.call(undefined, 1); + }, 'undefined (with value)' ); assert.throws( TypeError, - function() { GeneratorPrototype.return.call(null); }, + function() { + GeneratorPrototype.return.call(null); + }, 'null (without value)' ); assert.throws( TypeError, - function() { GeneratorPrototype.return.call(null, 1); }, + function() { + GeneratorPrototype.return.call(null, 1); + }, 'null (with value)' ); assert.throws( TypeError, - function() { GeneratorPrototype.return.call(true); }, + function() { + GeneratorPrototype.return.call(true); + }, 'boolean (without value)' ); assert.throws( TypeError, - function() { GeneratorPrototype.return.call(true, 1); }, + function() { + GeneratorPrototype.return.call(true, 1); + }, 'boolean (with value)' ); assert.throws( TypeError, - function() { GeneratorPrototype.return.call('s'); }, + function() { + GeneratorPrototype.return.call('s'); + }, 'string (without value)' ); assert.throws( TypeError, - function() { GeneratorPrototype.return.call('s', 1); }, + function() { + GeneratorPrototype.return.call('s', 1); + }, 'string (with value)' ); assert.throws( TypeError, - function() { GeneratorPrototype.return.call(1); }, + function() { + GeneratorPrototype.return.call(1); + }, 'number (without value)' ); assert.throws( TypeError, - function() { GeneratorPrototype.return.call(1, 1); }, + function() { + GeneratorPrototype.return.call(1, 1); + }, 'number (with value)' ); assert.throws( TypeError, - function() { GeneratorPrototype.return.call(symbol); }, + function() { + GeneratorPrototype.return.call(symbol); + }, 'symbol (without value)' ); assert.throws( TypeError, - function() { GeneratorPrototype.return.call(symbol, 1); }, + function() { + GeneratorPrototype.return.call(symbol, 1); + }, 'symbol (with value)' ); diff --git a/test/built-ins/GeneratorPrototype/return/try-catch-before-try.js b/test/built-ins/GeneratorPrototype/return/try-catch-before-try.js index f1b1bdc44..d7c40026d 100644 --- a/test/built-ins/GeneratorPrototype/return/try-catch-before-try.js +++ b/test/built-ins/GeneratorPrototype/return/try-catch-before-try.js @@ -10,6 +10,7 @@ features: [generators] ---*/ var unreachable = 0; + function* g() { yield; try { diff --git a/test/built-ins/GeneratorPrototype/return/try-catch-following-catch.js b/test/built-ins/GeneratorPrototype/return/try-catch-following-catch.js index f354530be..b7880cea8 100644 --- a/test/built-ins/GeneratorPrototype/return/try-catch-following-catch.js +++ b/test/built-ins/GeneratorPrototype/return/try-catch-following-catch.js @@ -11,6 +11,7 @@ features: [generators] var afterCatch = 0; var unreachable = 0; + function* g() { try { throw new Error(); diff --git a/test/built-ins/GeneratorPrototype/return/try-catch-within-catch.js b/test/built-ins/GeneratorPrototype/return/try-catch-within-catch.js index 16c9573f6..a995017d2 100644 --- a/test/built-ins/GeneratorPrototype/return/try-catch-within-catch.js +++ b/test/built-ins/GeneratorPrototype/return/try-catch-within-catch.js @@ -11,6 +11,7 @@ features: [generators] var inCatch = 0; var unreachable = 0; + function* g() { try { throw new Error(); diff --git a/test/built-ins/GeneratorPrototype/return/try-catch-within-try.js b/test/built-ins/GeneratorPrototype/return/try-catch-within-try.js index 3e925ba10..2d86cb3bf 100644 --- a/test/built-ins/GeneratorPrototype/return/try-catch-within-try.js +++ b/test/built-ins/GeneratorPrototype/return/try-catch-within-try.js @@ -11,6 +11,7 @@ features: [generators] var inTry = 0; var unreachable = 0; + function* g() { try { inTry += 1; diff --git a/test/built-ins/GeneratorPrototype/return/try-finally-before-try.js b/test/built-ins/GeneratorPrototype/return/try-finally-before-try.js index 1f1522fbb..24be6db3c 100644 --- a/test/built-ins/GeneratorPrototype/return/try-finally-before-try.js +++ b/test/built-ins/GeneratorPrototype/return/try-finally-before-try.js @@ -10,12 +10,11 @@ features: [generators] ---*/ var unreachable = 0; + function* g() { yield; unreachable += 1; - try { - } finally { - } + try {} finally {} } var iter = g(); var result; diff --git a/test/built-ins/GeneratorPrototype/return/try-finally-following-finally.js b/test/built-ins/GeneratorPrototype/return/try-finally-following-finally.js index 9066852be..665e968b4 100644 --- a/test/built-ins/GeneratorPrototype/return/try-finally-following-finally.js +++ b/test/built-ins/GeneratorPrototype/return/try-finally-following-finally.js @@ -11,9 +11,9 @@ features: [generators] var afterFinally = 0; var unreachable = 0; + function* g() { - try { - } finally {} + try {} finally {} afterFinally += 1; yield; unreachable += 1; diff --git a/test/built-ins/GeneratorPrototype/return/try-finally-nested-try-catch-within-catch.js b/test/built-ins/GeneratorPrototype/return/try-finally-nested-try-catch-within-catch.js index 25e1c134e..937a0bd28 100644 --- a/test/built-ins/GeneratorPrototype/return/try-finally-nested-try-catch-within-catch.js +++ b/test/built-ins/GeneratorPrototype/return/try-finally-nested-try-catch-within-catch.js @@ -13,6 +13,7 @@ features: [generators] var inCatch = 0; var inFinally = 0; var unreachable = 0; + function* g() { try { try { diff --git a/test/built-ins/GeneratorPrototype/return/try-finally-nested-try-catch-within-finally.js b/test/built-ins/GeneratorPrototype/return/try-finally-nested-try-catch-within-finally.js index 42ff56701..6bfef0e30 100644 --- a/test/built-ins/GeneratorPrototype/return/try-finally-nested-try-catch-within-finally.js +++ b/test/built-ins/GeneratorPrototype/return/try-finally-nested-try-catch-within-finally.js @@ -11,11 +11,11 @@ features: [generators] var inFinally = 0; var unreachable = 0; + function* g() { try { throw new Error(); - try { - } catch (e) {} + try {} catch (e) {} } finally { inFinally += 1; yield; diff --git a/test/built-ins/GeneratorPrototype/return/try-finally-nested-try-catch-within-inner-try.js b/test/built-ins/GeneratorPrototype/return/try-finally-nested-try-catch-within-inner-try.js index 8cb4b6ba1..9d8d5b6ae 100644 --- a/test/built-ins/GeneratorPrototype/return/try-finally-nested-try-catch-within-inner-try.js +++ b/test/built-ins/GeneratorPrototype/return/try-finally-nested-try-catch-within-inner-try.js @@ -13,6 +13,7 @@ features: [generators] var inTry = 0; var inFinally = 0; var unreachable = 0; + function* g() { try { try { diff --git a/test/built-ins/GeneratorPrototype/return/try-finally-nested-try-catch-within-outer-try-after-nested.js b/test/built-ins/GeneratorPrototype/return/try-finally-nested-try-catch-within-outer-try-after-nested.js index 2342f69a6..5e056c140 100644 --- a/test/built-ins/GeneratorPrototype/return/try-finally-nested-try-catch-within-outer-try-after-nested.js +++ b/test/built-ins/GeneratorPrototype/return/try-finally-nested-try-catch-within-outer-try-after-nested.js @@ -13,6 +13,7 @@ features: [generators] var inCatch = 0; var inFinally = 0; var unreachable = 0; + function* g() { try { try { @@ -29,7 +30,7 @@ function* g() { var iter = g(); var result; - iter.next(); +iter.next(); assert.sameValue(inCatch, 1, '`catch` code path executed'); assert.sameValue(inFinally, 1, '`finally` code path executed'); diff --git a/test/built-ins/GeneratorPrototype/return/try-finally-nested-try-catch-within-outer-try-before-nested.js b/test/built-ins/GeneratorPrototype/return/try-finally-nested-try-catch-within-outer-try-before-nested.js index f97d9bb48..7121ebd77 100644 --- a/test/built-ins/GeneratorPrototype/return/try-finally-nested-try-catch-within-outer-try-before-nested.js +++ b/test/built-ins/GeneratorPrototype/return/try-finally-nested-try-catch-within-outer-try-before-nested.js @@ -13,6 +13,7 @@ features: [generators] var inTry = 0; var inFinally = 0; var unreachable = 0; + function* g() { try { inTry += 1; diff --git a/test/built-ins/GeneratorPrototype/return/try-finally-within-finally.js b/test/built-ins/GeneratorPrototype/return/try-finally-within-finally.js index 4ea893dc3..fbec889d9 100644 --- a/test/built-ins/GeneratorPrototype/return/try-finally-within-finally.js +++ b/test/built-ins/GeneratorPrototype/return/try-finally-within-finally.js @@ -11,9 +11,9 @@ features: [generators] var inFinally = 0; var unreachable = 0; + function* g() { - try { - } finally { + try {} finally { inFinally += 1; yield; unreachable += 1; diff --git a/test/built-ins/GeneratorPrototype/return/try-finally-within-try.js b/test/built-ins/GeneratorPrototype/return/try-finally-within-try.js index 5b0dce6ef..336c0389b 100644 --- a/test/built-ins/GeneratorPrototype/return/try-finally-within-try.js +++ b/test/built-ins/GeneratorPrototype/return/try-finally-within-try.js @@ -12,6 +12,7 @@ features: [generators] var inTry = 0; var inFinally = 0; var unreachable = 0; + function* g() { try { inTry += 1; |