diff options
Diffstat (limited to 'test/built-ins/GeneratorPrototype/next')
7 files changed, 79 insertions, 25 deletions
diff --git a/test/built-ins/GeneratorPrototype/next/consecutive-yields.js b/test/built-ins/GeneratorPrototype/next/consecutive-yields.js index 3f6332163..3986c63d0 100644 --- a/test/built-ins/GeneratorPrototype/next/consecutive-yields.js +++ b/test/built-ins/GeneratorPrototype/next/consecutive-yields.js @@ -8,7 +8,10 @@ description: > features: [generators] ---*/ -function* g() { yield 1; yield 2; } +function* g() { + yield 1; + yield 2; +} var iter = g(); var result; diff --git a/test/built-ins/GeneratorPrototype/next/context-method-invocation.js b/test/built-ins/GeneratorPrototype/next/context-method-invocation.js index 5e6f3ed5a..aff5667ad 100644 --- a/test/built-ins/GeneratorPrototype/next/context-method-invocation.js +++ b/test/built-ins/GeneratorPrototype/next/context-method-invocation.js @@ -9,8 +9,13 @@ features: [generators] ---*/ var context; -function* g() { context = this; } -var obj = { g: g }; + +function* g() { + context = this; +} +var obj = { + g: g +}; var iter = obj.g(); iter.next(); diff --git a/test/built-ins/GeneratorPrototype/next/from-state-executing.js b/test/built-ins/GeneratorPrototype/next/from-state-executing.js index 29461cc11..2a05f8c2f 100644 --- a/test/built-ins/GeneratorPrototype/next/from-state-executing.js +++ b/test/built-ins/GeneratorPrototype/next/from-state-executing.js @@ -37,9 +37,11 @@ features: [generators] ---*/ var iter, result; + function* withoutVal() { iter.next(); } + function* withVal() { iter.next(42); } diff --git a/test/built-ins/GeneratorPrototype/next/lone-return.js b/test/built-ins/GeneratorPrototype/next/lone-return.js index cae93289b..0a444cbc1 100644 --- a/test/built-ins/GeneratorPrototype/next/lone-return.js +++ b/test/built-ins/GeneratorPrototype/next/lone-return.js @@ -8,7 +8,9 @@ description: > features: [generators] ---*/ -function* g() { return 23; } +function* g() { + return 23; +} var iter = g(); var result; diff --git a/test/built-ins/GeneratorPrototype/next/lone-yield.js b/test/built-ins/GeneratorPrototype/next/lone-yield.js index 76199c672..c909af148 100644 --- a/test/built-ins/GeneratorPrototype/next/lone-yield.js +++ b/test/built-ins/GeneratorPrototype/next/lone-yield.js @@ -8,7 +8,9 @@ description: > features: [generators] ---*/ -function* g() { yield 1; } +function* g() { + yield 1; +} var iter = g(); var result; diff --git a/test/built-ins/GeneratorPrototype/next/this-val-not-generator.js b/test/built-ins/GeneratorPrototype/next/this-val-not-generator.js index dee7dfc4e..25727d062 100644 --- a/test/built-ins/GeneratorPrototype/next/this-val-not-generator.js +++ b/test/built-ins/GeneratorPrototype/next/this-val-not-generator.js @@ -27,44 +27,60 @@ var GeneratorPrototype = Object.getPrototypeOf(g).prototype; assert.throws( TypeError, - function() { GeneratorPrototype.next.call({}); }, + function() { + GeneratorPrototype.next.call({}); + }, 'ordinary object (without value)' ); assert.throws( TypeError, - function() { GeneratorPrototype.next.call({}, 1); }, + function() { + GeneratorPrototype.next.call({}, 1); + }, 'ordinary object (with value)' ); assert.throws( TypeError, - function() { GeneratorPrototype.next.call(function() {}); }, + function() { + GeneratorPrototype.next.call(function() {}); + }, 'function object (without value)' ); assert.throws( TypeError, - function() { GeneratorPrototype.next.call(function() {}, 1); }, + function() { + GeneratorPrototype.next.call(function() {}, 1); + }, 'function object (with value)' ); assert.throws( TypeError, - function() { GeneratorPrototype.next.call(g); }, + function() { + GeneratorPrototype.next.call(g); + }, 'generator function object (without value)' ); assert.throws( TypeError, - function() { GeneratorPrototype.next.call(g, 1); }, + function() { + GeneratorPrototype.next.call(g, 1); + }, 'generator function object (with value)' ); assert.throws( TypeError, - function() { GeneratorPrototype.next.call(g.prototype); }, + function() { + GeneratorPrototype.next.call(g.prototype); + }, 'generator function prototype object (without value)' ); assert.throws( TypeError, - function() { GeneratorPrototype.next.call(g.prototype, 1); }, + function() { + GeneratorPrototype.next.call(g.prototype, 1); + }, 'generator function prototype object (with value)' ); diff --git a/test/built-ins/GeneratorPrototype/next/this-val-not-object.js b/test/built-ins/GeneratorPrototype/next/this-val-not-object.js index 646590b6f..c42b5777f 100644 --- a/test/built-ins/GeneratorPrototype/next/this-val-not-object.js +++ b/test/built-ins/GeneratorPrototype/next/this-val-not-object.js @@ -26,66 +26,90 @@ var symbol = Symbol(); assert.throws( TypeError, - function() { GeneratorPrototype.next.call(undefined); }, + function() { + GeneratorPrototype.next.call(undefined); + }, 'undefined (without value)' ); assert.throws( TypeError, - function() { GeneratorPrototype.next.call(undefined, 1); }, + function() { + GeneratorPrototype.next.call(undefined, 1); + }, 'undefined (with value)' ); assert.throws( TypeError, - function() { GeneratorPrototype.next.call(null); }, + function() { + GeneratorPrototype.next.call(null); + }, 'null (without value)' ); assert.throws( TypeError, - function() { GeneratorPrototype.next.call(null, 1); }, + function() { + GeneratorPrototype.next.call(null, 1); + }, 'null (with value)' ); assert.throws( TypeError, - function() { GeneratorPrototype.next.call(true); }, + function() { + GeneratorPrototype.next.call(true); + }, 'boolean (without value)' ); assert.throws( TypeError, - function() { GeneratorPrototype.next.call(true, 1); }, + function() { + GeneratorPrototype.next.call(true, 1); + }, 'boolean (with value)' ); assert.throws( TypeError, - function() { GeneratorPrototype.next.call('s'); }, + function() { + GeneratorPrototype.next.call('s'); + }, 'string (without value)' ); assert.throws( TypeError, - function() { GeneratorPrototype.next.call('s', 1); }, + function() { + GeneratorPrototype.next.call('s', 1); + }, 'string (with value)' ); assert.throws( TypeError, - function() { GeneratorPrototype.next.call(1); }, + function() { + GeneratorPrototype.next.call(1); + }, 'number (without value)' ); assert.throws( TypeError, - function() { GeneratorPrototype.next.call(1, 1); }, + function() { + GeneratorPrototype.next.call(1, 1); + }, 'number (with value)' ); assert.throws( TypeError, - function() { GeneratorPrototype.next.call(symbol); }, + function() { + GeneratorPrototype.next.call(symbol); + }, 'symbol (without value)' ); assert.throws( TypeError, - function() { GeneratorPrototype.next.call(symbol, 1); }, + function() { + GeneratorPrototype.next.call(symbol, 1); + }, 'symbol (with value)' ); |