From c43a36a45a37670ced0180144f2600374a345d7c Mon Sep 17 00:00:00 2001 From: Caitlin Potter Date: Wed, 11 Jan 2017 17:29:03 -0500 Subject: [PATCH 01/12] Add tests for async generator function expressions --- .../early-errors-expression-NSPL-with-USD.js | 15 +++++++ ...pression-arguments-in-formal-parameters.js | 15 +++++++ ...on-await-as-function-binding-identifier.js | 14 +++++++ ...expression-binding-identifier-arguments.js | 16 ++++++++ ...rors-expression-binding-identifier-eval.js | 16 ++++++++ ...ors-expression-body-contains-super-call.js | 14 +++++++ ...expression-body-contains-super-property.js | 14 +++++++ ...rs-expression-eval-in-formal-parameters.js | 15 +++++++ ...expression-formals-body-duplicate-const.js | 15 +++++++ ...s-expression-formals-body-duplicate-let.js | 15 +++++++ ...-expression-formals-contains-await-expr.js | 14 +++++++ ...rrors-expression-formals-contains-await.js | 15 +++++++ ...-expression-formals-contains-super-call.js | 14 +++++++ ...ression-formals-contains-super-property.js | 14 +++++++ ...-expression-formals-contains-yield-expr.js | 14 +++++++ ...rrors-expression-formals-contains-yield.js | 15 +++++++ ...arly-errors-expression-label-name-await.js | 17 ++++++++ ...arly-errors-expression-label-name-yield.js | 17 ++++++++ ...expression-not-simple-assignment-target.js | 14 +++++++ ...on-yield-as-function-binding-identifier.js | 14 +++++++ ...ors-expression-yield-star-after-newline.js | 17 ++++++++ .../expression-await-as-yield-operand.js | 24 +++++++++++ ...pression-await-promise-as-yield-operand.js | 26 ++++++++++++ ...ression-await-thenable-as-yield-operand.js | 30 ++++++++++++++ .../expression-yield-as-operand.js | 31 ++++++++++++++ .../expression-yield-as-statement.js | 41 +++++++++++++++++++ .../expression-yield-newline.js | 26 ++++++++++++ .../expression-yield-star-before-newline.js | 20 +++++++++ 28 files changed, 512 insertions(+) create mode 100644 test/language/expressions/async-generators/early-errors-expression-NSPL-with-USD.js create mode 100644 test/language/expressions/async-generators/early-errors-expression-arguments-in-formal-parameters.js create mode 100644 test/language/expressions/async-generators/early-errors-expression-await-as-function-binding-identifier.js create mode 100644 test/language/expressions/async-generators/early-errors-expression-binding-identifier-arguments.js create mode 100644 test/language/expressions/async-generators/early-errors-expression-binding-identifier-eval.js create mode 100644 test/language/expressions/async-generators/early-errors-expression-body-contains-super-call.js create mode 100644 test/language/expressions/async-generators/early-errors-expression-body-contains-super-property.js create mode 100644 test/language/expressions/async-generators/early-errors-expression-eval-in-formal-parameters.js create mode 100644 test/language/expressions/async-generators/early-errors-expression-formals-body-duplicate-const.js create mode 100644 test/language/expressions/async-generators/early-errors-expression-formals-body-duplicate-let.js create mode 100644 test/language/expressions/async-generators/early-errors-expression-formals-contains-await-expr.js create mode 100644 test/language/expressions/async-generators/early-errors-expression-formals-contains-await.js create mode 100644 test/language/expressions/async-generators/early-errors-expression-formals-contains-super-call.js create mode 100644 test/language/expressions/async-generators/early-errors-expression-formals-contains-super-property.js create mode 100644 test/language/expressions/async-generators/early-errors-expression-formals-contains-yield-expr.js create mode 100644 test/language/expressions/async-generators/early-errors-expression-formals-contains-yield.js create mode 100644 test/language/expressions/async-generators/early-errors-expression-label-name-await.js create mode 100644 test/language/expressions/async-generators/early-errors-expression-label-name-yield.js create mode 100644 test/language/expressions/async-generators/early-errors-expression-not-simple-assignment-target.js create mode 100644 test/language/expressions/async-generators/early-errors-expression-yield-as-function-binding-identifier.js create mode 100644 test/language/expressions/async-generators/early-errors-expression-yield-star-after-newline.js create mode 100644 test/language/expressions/async-generators/expression-await-as-yield-operand.js create mode 100644 test/language/expressions/async-generators/expression-await-promise-as-yield-operand.js create mode 100644 test/language/expressions/async-generators/expression-await-thenable-as-yield-operand.js create mode 100644 test/language/expressions/async-generators/expression-yield-as-operand.js create mode 100644 test/language/expressions/async-generators/expression-yield-as-statement.js create mode 100644 test/language/expressions/async-generators/expression-yield-newline.js create mode 100644 test/language/expressions/async-generators/expression-yield-star-before-newline.js diff --git a/test/language/expressions/async-generators/early-errors-expression-NSPL-with-USD.js b/test/language/expressions/async-generators/early-errors-expression-NSPL-with-USD.js new file mode 100644 index 00000000000..b887c2ce270 --- /dev/null +++ b/test/language/expressions/async-generators/early-errors-expression-NSPL-with-USD.js @@ -0,0 +1,15 @@ +// Copyright 2017 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +author: Caitlin Potter +esid: pending +description: > + It is a Syntax Error if ContainsUseStrict of AsyncGeneratorBody is true and + IsSimpleParameterList of UniqueFormalParameters is false. +negative: + phase: early + type: SyntaxError +---*/ + +(async function*(x = 1) {"use strict"}); diff --git a/test/language/expressions/async-generators/early-errors-expression-arguments-in-formal-parameters.js b/test/language/expressions/async-generators/early-errors-expression-arguments-in-formal-parameters.js new file mode 100644 index 00000000000..69e5026b854 --- /dev/null +++ b/test/language/expressions/async-generators/early-errors-expression-arguments-in-formal-parameters.js @@ -0,0 +1,15 @@ +// Copyright 2017 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +author: Caitlin Potter +esid: pending +description: > + It is a SyntaxError if FormalParameters contains arguments in strict mode. +negative: + phase: early + type: SyntaxError +flags: [onlyStrict] +---*/ + +(async function*(arguments) { }); diff --git a/test/language/expressions/async-generators/early-errors-expression-await-as-function-binding-identifier.js b/test/language/expressions/async-generators/early-errors-expression-await-as-function-binding-identifier.js new file mode 100644 index 00000000000..0b02630356d --- /dev/null +++ b/test/language/expressions/async-generators/early-errors-expression-await-as-function-binding-identifier.js @@ -0,0 +1,14 @@ +// Copyright 2017 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +author: Caitlin Potter +esid: 12.1.1 +description: > + `await` is not a valid BindingIdentifier for AsyncGeneratorExpressions. +negative: + phase: early + type: SyntaxError +---*/ + +(async function* await() { }); diff --git a/test/language/expressions/async-generators/early-errors-expression-binding-identifier-arguments.js b/test/language/expressions/async-generators/early-errors-expression-binding-identifier-arguments.js new file mode 100644 index 00000000000..85617538a4e --- /dev/null +++ b/test/language/expressions/async-generators/early-errors-expression-binding-identifier-arguments.js @@ -0,0 +1,16 @@ +// Copyright 2017 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +author: Caitlin Potter +esid: pending +description: > + If the source code matching this production is strict code, it is a + Syntax Error if BindingIdentifier is the IdentifierName arguments. +negative: + phase: early + type: SyntaxError +flags: [onlyStrict] +---*/ + +(async function* arguments() { }); diff --git a/test/language/expressions/async-generators/early-errors-expression-binding-identifier-eval.js b/test/language/expressions/async-generators/early-errors-expression-binding-identifier-eval.js new file mode 100644 index 00000000000..79474a644f8 --- /dev/null +++ b/test/language/expressions/async-generators/early-errors-expression-binding-identifier-eval.js @@ -0,0 +1,16 @@ +// Copyright 2017 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +author: Caitlin Potter +esid: pending +description: > + If the source code matching this production is strict code, it is a + Syntax Error if BindingIdentifier is the IdentifierName eval. +negative: + phase: early + type: SyntaxError +flags: [onlyStrict] +---*/ + +(async function* eval() { }); diff --git a/test/language/expressions/async-generators/early-errors-expression-body-contains-super-call.js b/test/language/expressions/async-generators/early-errors-expression-body-contains-super-call.js new file mode 100644 index 00000000000..bca6ed5d716 --- /dev/null +++ b/test/language/expressions/async-generators/early-errors-expression-body-contains-super-call.js @@ -0,0 +1,14 @@ +// Copyright 2017 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +author: Caitlin Potter +esid: pending +description: > + It is a syntax error if AsyncGeneratorBody contains SuperCall is true. +negative: + phase: early + type: SyntaxError +---*/ + +(async function*() { super(); }); diff --git a/test/language/expressions/async-generators/early-errors-expression-body-contains-super-property.js b/test/language/expressions/async-generators/early-errors-expression-body-contains-super-property.js new file mode 100644 index 00000000000..794125f52e4 --- /dev/null +++ b/test/language/expressions/async-generators/early-errors-expression-body-contains-super-property.js @@ -0,0 +1,14 @@ +// Copyright 2017 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +author: Caitlin Potter +esid: pending +description: > + It is a syntax error if AsyncGeneratorBody contains SuperProperty is true. +negative: + phase: early + type: SyntaxError +---*/ + +(async function*() { super.prop; }); diff --git a/test/language/expressions/async-generators/early-errors-expression-eval-in-formal-parameters.js b/test/language/expressions/async-generators/early-errors-expression-eval-in-formal-parameters.js new file mode 100644 index 00000000000..c87c23b6770 --- /dev/null +++ b/test/language/expressions/async-generators/early-errors-expression-eval-in-formal-parameters.js @@ -0,0 +1,15 @@ +// Copyright 2017 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +author: Caitlin Potter +esid: pending +description: > + It is a SyntaxError if FormalParameters contains eval in strict mode. +negative: + phase: early + type: SyntaxError +flags: [onlyStrict] +---*/ + +(async function*(eval) { }); diff --git a/test/language/expressions/async-generators/early-errors-expression-formals-body-duplicate-const.js b/test/language/expressions/async-generators/early-errors-expression-formals-body-duplicate-const.js new file mode 100644 index 00000000000..53e3a2365a6 --- /dev/null +++ b/test/language/expressions/async-generators/early-errors-expression-formals-body-duplicate-const.js @@ -0,0 +1,15 @@ +// Copyright 2017 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +author: Caitlin Potter +esid: pending +description: > + It is a SyntaxError if BoundNames of FormalParameters also occurs in the + LexicallyDeclaredNames of AsyncFunctionBody +negative: + phase: early + type: SyntaxError +---*/ + +(async function*(a) { const a = 0; }); diff --git a/test/language/expressions/async-generators/early-errors-expression-formals-body-duplicate-let.js b/test/language/expressions/async-generators/early-errors-expression-formals-body-duplicate-let.js new file mode 100644 index 00000000000..593d4325d53 --- /dev/null +++ b/test/language/expressions/async-generators/early-errors-expression-formals-body-duplicate-let.js @@ -0,0 +1,15 @@ +// Copyright 2017 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +author: Caitlin Potter +esid: pending +description: > + It is a SyntaxError if BoundNames of FormalParameters also occurs in the + LexicallyDeclaredNames of AsyncFunctionBody +negative: + phase: early + type: SyntaxError +---*/ + +(async function*(a) { let a; }); diff --git a/test/language/expressions/async-generators/early-errors-expression-formals-contains-await-expr.js b/test/language/expressions/async-generators/early-errors-expression-formals-contains-await-expr.js new file mode 100644 index 00000000000..1c94b75fc2a --- /dev/null +++ b/test/language/expressions/async-generators/early-errors-expression-formals-contains-await-expr.js @@ -0,0 +1,14 @@ +// Copyright 2017 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +author: Caitlin Potter +esid: pending +description: > + It is a Syntax Error if FormalParameters Contains AwaitExpression is true. +negative: + phase: early + type: SyntaxError +---*/ + +(async function*(x = await 1) { }); diff --git a/test/language/expressions/async-generators/early-errors-expression-formals-contains-await.js b/test/language/expressions/async-generators/early-errors-expression-formals-contains-await.js new file mode 100644 index 00000000000..bd038d0fe23 --- /dev/null +++ b/test/language/expressions/async-generators/early-errors-expression-formals-contains-await.js @@ -0,0 +1,15 @@ +// Copyright 2017 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +author: Caitlin Potter +esid: 12.1 +description: > + `await` is a reserved keyword within async generator function bodies and may + not be used as the binding identifier of a parameter. +negative: + phase: early + type: SyntaxError +---*/ + +(async function*(await) { }); diff --git a/test/language/expressions/async-generators/early-errors-expression-formals-contains-super-call.js b/test/language/expressions/async-generators/early-errors-expression-formals-contains-super-call.js new file mode 100644 index 00000000000..c25c59d2b81 --- /dev/null +++ b/test/language/expressions/async-generators/early-errors-expression-formals-contains-super-call.js @@ -0,0 +1,14 @@ +// Copyright 2017 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +author: Caitlin Potter +esid: pending +description: > + It is a syntax error if FormalParameters contains SuperCall is true. +negative: + phase: early + type: SyntaxError +---*/ + +(async function*(a = super()) { }); diff --git a/test/language/expressions/async-generators/early-errors-expression-formals-contains-super-property.js b/test/language/expressions/async-generators/early-errors-expression-formals-contains-super-property.js new file mode 100644 index 00000000000..a162eb58ec5 --- /dev/null +++ b/test/language/expressions/async-generators/early-errors-expression-formals-contains-super-property.js @@ -0,0 +1,14 @@ +// Copyright 2017 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +author: Caitlin Potter +esid: pending +description: > + It is a syntax error if FormalParameters contains SuperProperty is true. +negative: + phase: early + type: SyntaxError +---*/ + +(async function*(a = super.prop { }); diff --git a/test/language/expressions/async-generators/early-errors-expression-formals-contains-yield-expr.js b/test/language/expressions/async-generators/early-errors-expression-formals-contains-yield-expr.js new file mode 100644 index 00000000000..828f5a57ef7 --- /dev/null +++ b/test/language/expressions/async-generators/early-errors-expression-formals-contains-yield-expr.js @@ -0,0 +1,14 @@ +// Copyright 2017 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +author: Caitlin Potter +esid: pending +description: > + It is a Syntax Error if FormalParameters Contains YieldExpression is true. +negative: + phase: early + type: SyntaxError +---*/ + +(async function*(x = yield) { }); diff --git a/test/language/expressions/async-generators/early-errors-expression-formals-contains-yield.js b/test/language/expressions/async-generators/early-errors-expression-formals-contains-yield.js new file mode 100644 index 00000000000..cbc96a88360 --- /dev/null +++ b/test/language/expressions/async-generators/early-errors-expression-formals-contains-yield.js @@ -0,0 +1,15 @@ +// Copyright 2017 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +author: Caitlin Potter +esid: 12.1 +description: > + `await` is a reserved keyword within async generator function bodies and may + not be used as the binding identifier of a parameter. +negative: + phase: early + type: SyntaxError +---*/ + +(async function*(yield) { }); diff --git a/test/language/expressions/async-generators/early-errors-expression-label-name-await.js b/test/language/expressions/async-generators/early-errors-expression-label-name-await.js new file mode 100644 index 00000000000..050f8961541 --- /dev/null +++ b/test/language/expressions/async-generators/early-errors-expression-label-name-await.js @@ -0,0 +1,17 @@ +// Copyright 2017 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +author: Caitlin Potter +esid: 12.1.1 +description: > + `await` is a reserved keyword within async generator function bodies and may + not be used as a label. +negative: + phase: early + type: SyntaxError +---*/ + +(async function*() { + await: 1; +}); diff --git a/test/language/expressions/async-generators/early-errors-expression-label-name-yield.js b/test/language/expressions/async-generators/early-errors-expression-label-name-yield.js new file mode 100644 index 00000000000..453e33b1b64 --- /dev/null +++ b/test/language/expressions/async-generators/early-errors-expression-label-name-yield.js @@ -0,0 +1,17 @@ +// Copyright 2017 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +author: Caitlin Potter +esid: 12.1.1 +description: > + `yield` is a reserved keyword within async generator function bodies and may + not be used as a label. +negative: + phase: early + type: SyntaxError +---*/ + +(async function*() { + yield: 1; +}); diff --git a/test/language/expressions/async-generators/early-errors-expression-not-simple-assignment-target.js b/test/language/expressions/async-generators/early-errors-expression-not-simple-assignment-target.js new file mode 100644 index 00000000000..900b8277e1c --- /dev/null +++ b/test/language/expressions/async-generators/early-errors-expression-not-simple-assignment-target.js @@ -0,0 +1,14 @@ +// Copyright 2017 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +author: Caitlin Potter +esid: pending +description: > + Async generator function expressions are not a simple assignment target. +negative: + phase: early + type: ReferenceError +---*/ + +(async function*() { } = 1); diff --git a/test/language/expressions/async-generators/early-errors-expression-yield-as-function-binding-identifier.js b/test/language/expressions/async-generators/early-errors-expression-yield-as-function-binding-identifier.js new file mode 100644 index 00000000000..ec54ee71828 --- /dev/null +++ b/test/language/expressions/async-generators/early-errors-expression-yield-as-function-binding-identifier.js @@ -0,0 +1,14 @@ +// Copyright 2017 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +author: Caitlin Potter +esid: 12.1.1 +description: > + `yield` is not a valid BindingIdentifier for AsyncGeneratorExpressions. +negative: + phase: early + type: SyntaxError +---*/ + +(async function* yield() { }); diff --git a/test/language/expressions/async-generators/early-errors-expression-yield-star-after-newline.js b/test/language/expressions/async-generators/early-errors-expression-yield-star-after-newline.js new file mode 100644 index 00000000000..2d2c83ab07a --- /dev/null +++ b/test/language/expressions/async-generators/early-errors-expression-yield-star-after-newline.js @@ -0,0 +1,17 @@ +// Copyright 2017 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +author: Caitlin Potter +esid: 14.4 +description: > + A newline may not precede the `*` token in a `yield` expression. +negative: + phase: early + type: SyntaxError +---*/ + +(async function*() { + yield + * 1; +}); diff --git a/test/language/expressions/async-generators/expression-await-as-yield-operand.js b/test/language/expressions/async-generators/expression-await-as-yield-operand.js new file mode 100644 index 00000000000..cad8157bb7d --- /dev/null +++ b/test/language/expressions/async-generators/expression-await-as-yield-operand.js @@ -0,0 +1,24 @@ +// Copyright 2017 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +author: Caitlin Potter +esid: 14.4 +description: > + AwaitExpressions are valid operands to yield expressions. +flags: [async] +---*/ + +var iter = (async function*() { + yield await "a"; +})(); + +iter.next().then(function(result) { + assert.sameValue(result.value, "a", 'First result `value`'); + assert.sameValue(result.done, false, 'First result `done` flag'); +}).then(undefined, $DONE); + +iter.next().then(function(result) { + assert.sameValue(result.value, undefined, 'Second result `value`'); + assert.sameValue(result.done, true, 'Second result `done` flag'); +}).then($DONE, $DONE); diff --git a/test/language/expressions/async-generators/expression-await-promise-as-yield-operand.js b/test/language/expressions/async-generators/expression-await-promise-as-yield-operand.js new file mode 100644 index 00000000000..8f345472be7 --- /dev/null +++ b/test/language/expressions/async-generators/expression-await-promise-as-yield-operand.js @@ -0,0 +1,26 @@ +// Copyright 2017 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +author: Caitlin Potter +esid: 14.4 +description: > + AwaitExpressions are valid operands to yield expressions. +flags: [async] +---*/ + +var iter = (async function*() { + yield await new Promise(function(resolve) { + resolve("a"); + }); +})(); + +iter.next().then(function(result) { + assert.sameValue(result.value, "a", 'First result `value`'); + assert.sameValue(result.done, false, 'First result `done` flag'); +}).then(undefined, $DONE); + +iter.next().then(function(result) { + assert.sameValue(result.value, undefined, 'Second result `value`'); + assert.sameValue(result.done, true, 'Second result `done` flag'); +}).then($DONE, $DONE); diff --git a/test/language/expressions/async-generators/expression-await-thenable-as-yield-operand.js b/test/language/expressions/async-generators/expression-await-thenable-as-yield-operand.js new file mode 100644 index 00000000000..c436a94172a --- /dev/null +++ b/test/language/expressions/async-generators/expression-await-thenable-as-yield-operand.js @@ -0,0 +1,30 @@ +// Copyright 2017 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +author: Caitlin Potter +esid: 14.4 +description: > + AwaitExpressions are valid operands to yield expressions. +flags: [async] +---*/ + +var thenable = { + then: function(resolve, reject) { + resolve("a"); + } +}; + +var iter = (async function*() { + yield await thenable; +})(); + +iter.next().then(function(result) { + assert.sameValue(result.value, "a", 'First result `value`'); + assert.sameValue(result.done, false, 'First result `done` flag'); +}).then(undefined, $DONE); + +iter.next().then(function(result) { + assert.sameValue(result.value, undefined, 'Second result `value`'); + assert.sameValue(result.done, true, 'Second result `done` flag'); +}).then($DONE, $DONE); diff --git a/test/language/expressions/async-generators/expression-yield-as-operand.js b/test/language/expressions/async-generators/expression-yield-as-operand.js new file mode 100644 index 00000000000..c2a14ffcd38 --- /dev/null +++ b/test/language/expressions/async-generators/expression-yield-as-operand.js @@ -0,0 +1,31 @@ +// Copyright 2017 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +author: Caitlin Potter +esid: 14.4 +description: > + `yield` expressions may be used as the right-hand-side of other `yield` + expressions. +flags: [async] +---*/ + +var g = async function*() { + yield yield 1; +}; + +var iter = g(); +iter.next().then(function(result) { + assert.sameValue(result.value, 1, 'First result `value`'); + assert.sameValue(result.done, false, 'First result `done` flag'); +}).then(undefined, $DONE); + +iter.next().then(function(result) { + assert.sameValue(result.value, undefined, 'Second result `value`'); + assert.sameValue(result.done, false, 'Second result `done` flag'); +}).then(undefined, $DONE); + +iter.next().then(function(result) { + assert.sameValue(result.value, undefined, 'Third result `value`'); + assert.sameValue(result.done, true, 'Thid result `done` flag'); +}).then($DONE, $DONE); diff --git a/test/language/expressions/async-generators/expression-yield-as-statement.js b/test/language/expressions/async-generators/expression-yield-as-statement.js new file mode 100644 index 00000000000..9647c0bb397 --- /dev/null +++ b/test/language/expressions/async-generators/expression-yield-as-statement.js @@ -0,0 +1,41 @@ +// Copyright 2017 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +author: Caitlin Potter +esid: 14.4 +description: > + `yield` is a valid statement within async generator function bodies. +flags: [async] +---*/ + +var g1 = async function*() { yield; }; +var g2 = async function*() { yield 1; }; + +var iter1 = g1(); +iter1.next().then(function(result) { + assert.sameValue( + result.value, undefined, "Without right-hand-side: first result `value`"); + assert.sameValue( + result.done, false, "Without right-hand-side: first result `done` flag"); +}).then(undefined, $DONE); +iter1.next(function(result) { + assert.sameValue( + result.value, undefined, "Without right-hand-side: second result `value`"); + assert.sameValue( + result.done, true, "Without right-hand-side: second result `done` flag"); +}).then(undefined, $DONE); + +var iter2 = g2(); +iter2.next().then(function(result) { + assert.sameValue( + result.value, 1, "With right-hand-side: first result `value`"); + assert.sameValue( + result.done, false, "With right-hand-side: first result `done` flag"); +}).then(undefined, $DONE); +iter2.next(function(result) { + assert.sameValue( + result.value, undefined, "With right-hand-side: second result `value`"); + assert.sameValue( + result.done, true, "With right-hand-side: second result `done` flag"); +}).then($DONE, $DONE); diff --git a/test/language/expressions/async-generators/expression-yield-newline.js b/test/language/expressions/async-generators/expression-yield-newline.js new file mode 100644 index 00000000000..3b183a2b6b4 --- /dev/null +++ b/test/language/expressions/async-generators/expression-yield-newline.js @@ -0,0 +1,26 @@ +// Copyright 2017 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +author: Caitlin Potter +esid: 14.4 +description: > + Newlines terminate `yield` expressions. +flags: [async] +---*/ + +var g = async function*() { + yield + 1; +}; + +var iter = g(); +iter.next().then(function(result) { + assert.sameValue(result.value, undefined, 'First result `value`'); + assert.sameValue(result.done, false, 'First result `done` flag'); +}).then(undefined, $DONE); + +iter.next().then(function(result) { + assert.sameValue(result.value, undefined, 'Second result `value`'); + assert.sameValue(result.done, true, 'Second result `done` flag'); +}).then($DONE, $DONE); diff --git a/test/language/expressions/async-generators/expression-yield-star-before-newline.js b/test/language/expressions/async-generators/expression-yield-star-before-newline.js new file mode 100644 index 00000000000..d22ef2f88f8 --- /dev/null +++ b/test/language/expressions/async-generators/expression-yield-star-before-newline.js @@ -0,0 +1,20 @@ +// Copyright 2017 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +author: Caitlin Potter +esid: 14.4 +description: > + The right-hand side of a `yield *` expression may appear on a new line. +flags: [async] +---*/ + +var g = async function*() {}; + +(async function*() { + yield* + g(); +})().next().then(function(result) { + assert.sameValue(result.value, undefined); + assert.sameValue(result.done, true); +}).then($DONE, $DONE); From d7ab9f44f3423e305b2ffa98e35a54b6d1660889 Mon Sep 17 00:00:00 2001 From: Benjamin Gruenbaum Date: Fri, 13 Jan 2017 16:47:24 +0200 Subject: [PATCH 02/12] initial work --- .../early-errors-binding-identifier-duplicate.js | 0 .../early-errors-expression-parameter-await.js | 14 ++++++++++++++ .../early-errors-expression-parameter-yield.js | 14 ++++++++++++++ ...arly-errors-next-receiver-not-async-iterator.js | 14 ++++++++++++++ 4 files changed, 42 insertions(+) create mode 100644 test/language/expressions/async-generators/early-errors-binding-identifier-duplicate.js create mode 100644 test/language/expressions/async-generators/early-errors-expression-parameter-await.js create mode 100644 test/language/expressions/async-generators/early-errors-expression-parameter-yield.js create mode 100644 test/language/expressions/async-generators/early-errors-next-receiver-not-async-iterator.js diff --git a/test/language/expressions/async-generators/early-errors-binding-identifier-duplicate.js b/test/language/expressions/async-generators/early-errors-binding-identifier-duplicate.js new file mode 100644 index 00000000000..e69de29bb2d diff --git a/test/language/expressions/async-generators/early-errors-expression-parameter-await.js b/test/language/expressions/async-generators/early-errors-expression-parameter-await.js new file mode 100644 index 00000000000..3e77f7c84f2 --- /dev/null +++ b/test/language/expressions/async-generators/early-errors-expression-parameter-await.js @@ -0,0 +1,14 @@ +// Copyright 2017 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +author: Benjamin Gruenbaum +esid: pending +description: > + throw a SyntaxError if UniqueFormalParameters contains await (invalid BindingIdentifier): +negative: + phase: early + type: SyntaxError +---*/ + +(async function* (await) {}); \ No newline at end of file diff --git a/test/language/expressions/async-generators/early-errors-expression-parameter-yield.js b/test/language/expressions/async-generators/early-errors-expression-parameter-yield.js new file mode 100644 index 00000000000..a2bef65f952 --- /dev/null +++ b/test/language/expressions/async-generators/early-errors-expression-parameter-yield.js @@ -0,0 +1,14 @@ +// Copyright 2017 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +author: Benjamin Gruenbaum +esid: pending +description: > + throw a SyntaxError if UniqueFormalParameters contains yield (invalid BindingIdentifier): +negative: + phase: early + type: SyntaxError +---*/ + +(async function* (yield) {}); \ No newline at end of file diff --git a/test/language/expressions/async-generators/early-errors-next-receiver-not-async-iterator.js b/test/language/expressions/async-generators/early-errors-next-receiver-not-async-iterator.js new file mode 100644 index 00000000000..254a4b10886 --- /dev/null +++ b/test/language/expressions/async-generators/early-errors-next-receiver-not-async-iterator.js @@ -0,0 +1,14 @@ +// Copyright 2017 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +author: Benjamin Gruenbaum +esid: pending +description: > + next() throws a TypeError when receiver is not an AsyncGenerator instance: +negative: + phase: early + type: TypeError +---*/ + +(async function*() {})().next.call((function*() {})()); \ No newline at end of file From 0c017e8ffee58557f8f3913d0d21b96bb97a30fb Mon Sep 17 00:00:00 2001 From: sasha Date: Fri, 13 Jan 2017 17:17:44 +0200 Subject: [PATCH 03/12] async generators test --- .gitignore | 1 + ...laration-parameters-contains-await-expression.js | 13 +++++++++++++ ...y-error-declaration-parameters-contains-await.js | 13 +++++++++++++ ...or-declaration-parameters-contains-super-call.js | 13 +++++++++++++ ...eclaration-parameters-contains-super-property.js | 13 +++++++++++++ ...ors-decalaration-body-contains-super-property.js | 13 +++++++++++++ ...y-errors-declaration-body-contains-super-call.js | 13 +++++++++++++ ...laration-parameters-contains-yield-expression.js | 13 +++++++++++++ 8 files changed, 92 insertions(+) create mode 100644 test/language/statements/async-generator/early-error-declaration-parameters-contains-await-expression.js create mode 100644 test/language/statements/async-generator/early-error-declaration-parameters-contains-await.js create mode 100644 test/language/statements/async-generator/early-error-declaration-parameters-contains-super-call.js create mode 100644 test/language/statements/async-generator/early-error-declaration-parameters-contains-super-property.js create mode 100644 test/language/statements/async-generator/early-errors-decalaration-body-contains-super-property.js create mode 100644 test/language/statements/async-generator/early-errors-declaration-body-contains-super-call.js create mode 100644 test/language/statements/async-generator/early-errors-declaration-parameters-contains-yield-expression.js diff --git a/.gitignore b/.gitignore index 1203b32d2ea..bb6ea389254 100644 --- a/.gitignore +++ b/.gitignore @@ -3,3 +3,4 @@ *~ *.pyc console/TestCases +.idea \ No newline at end of file diff --git a/test/language/statements/async-generator/early-error-declaration-parameters-contains-await-expression.js b/test/language/statements/async-generator/early-error-declaration-parameters-contains-await-expression.js new file mode 100644 index 00000000000..986f3c784ca --- /dev/null +++ b/test/language/statements/async-generator/early-error-declaration-parameters-contains-await-expression.js @@ -0,0 +1,13 @@ +// Copyright 2016 Microsoft, Inc. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- + author: Sasha Kruglyak + esid: pending + description: It is a syntax error if FormalParameters contains AwaitExpression + negative: + phase: early + type: SyntaxError + ---*/ + +async function* foo (await 1) { } diff --git a/test/language/statements/async-generator/early-error-declaration-parameters-contains-await.js b/test/language/statements/async-generator/early-error-declaration-parameters-contains-await.js new file mode 100644 index 00000000000..099b921770a --- /dev/null +++ b/test/language/statements/async-generator/early-error-declaration-parameters-contains-await.js @@ -0,0 +1,13 @@ +// Copyright 2016 Microsoft, Inc. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- + author: Sasha Kruglyak + esid: pending + description: It is a syntax error if FormalParameters contains await + negative: + phase: early + type: SyntaxError + ---*/ + +async function* foo (await) { } diff --git a/test/language/statements/async-generator/early-error-declaration-parameters-contains-super-call.js b/test/language/statements/async-generator/early-error-declaration-parameters-contains-super-call.js new file mode 100644 index 00000000000..4180ebbb484 --- /dev/null +++ b/test/language/statements/async-generator/early-error-declaration-parameters-contains-super-call.js @@ -0,0 +1,13 @@ +// Copyright 2016 Microsoft, Inc. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- + author: Sasha Kruglyak + esid: pending + description: It is a syntax error if FormalParameters contains SuperCall + negative: + phase: early + type: SyntaxError + ---*/ + +async function* foo (super()) { } diff --git a/test/language/statements/async-generator/early-error-declaration-parameters-contains-super-property.js b/test/language/statements/async-generator/early-error-declaration-parameters-contains-super-property.js new file mode 100644 index 00000000000..d864a6c4246 --- /dev/null +++ b/test/language/statements/async-generator/early-error-declaration-parameters-contains-super-property.js @@ -0,0 +1,13 @@ +// Copyright 2016 Microsoft, Inc. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- + author: Sasha Kruglyak + esid: pending + description: It is a syntax error if FormalParameters contains SuperProperty + negative: + phase: early + type: SyntaxError + ---*/ + +async function* foo (super) { } diff --git a/test/language/statements/async-generator/early-errors-decalaration-body-contains-super-property.js b/test/language/statements/async-generator/early-errors-decalaration-body-contains-super-property.js new file mode 100644 index 00000000000..065108573ac --- /dev/null +++ b/test/language/statements/async-generator/early-errors-decalaration-body-contains-super-property.js @@ -0,0 +1,13 @@ +// Copyright 2016 Microsoft, Inc. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- + author: Sasha Kruglyak + esid: pending + description: It is a syntax error if AsyncGeneratorBody contains SuperProperty + negative: + phase: early + type: SyntaxError + ---*/ + +async function* foo () { super.prop; } diff --git a/test/language/statements/async-generator/early-errors-declaration-body-contains-super-call.js b/test/language/statements/async-generator/early-errors-declaration-body-contains-super-call.js new file mode 100644 index 00000000000..ef9fe5f158d --- /dev/null +++ b/test/language/statements/async-generator/early-errors-declaration-body-contains-super-call.js @@ -0,0 +1,13 @@ +// Copyright 2016 Microsoft, Inc. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- + author: Sasha Kruglyak + esid: pending + description: It is a syntax error if AsyncGeneratorBody contains SuperCall + negative: + phase: early + type: SyntaxError + ---*/ + +async function* foo () { super(); } diff --git a/test/language/statements/async-generator/early-errors-declaration-parameters-contains-yield-expression.js b/test/language/statements/async-generator/early-errors-declaration-parameters-contains-yield-expression.js new file mode 100644 index 00000000000..76b08b42e72 --- /dev/null +++ b/test/language/statements/async-generator/early-errors-declaration-parameters-contains-yield-expression.js @@ -0,0 +1,13 @@ +// Copyright 2016 Microsoft, Inc. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- + author: Sasha Kruglyak + esid: pending + description: It is a syntax error if FormalParameters contains YieldExpression + negative: + phase: early + type: SyntaxError + ---*/ + +async function* foo (yield) { } From 3561cc3083a2295279214853a74f0124bce8551f Mon Sep 17 00:00:00 2001 From: Benjamin Gruenbaum Date: Fri, 13 Jan 2017 17:02:22 +0200 Subject: [PATCH 04/12] fix test to reject instead of throw symbol tests more symbol tests feedback by caitp simplify symbol test fix built in tests initial work ORealm -> otherRealmSymbol Error->Test262Error figure out what these tests mean subclass tests 6.3.2.1 --- .../AsyncGenerator-construct.js | 28 +++++++++++++++++++ .../AsyncGenerator-is-extensible.js | 10 +++++++ .../AsyncGenerator-is-subclass.js | 14 ++++++++++ .../AsyncGenerator/AsyncGenerator-length.js | 13 +++++++++ .../AsyncGenerator/AsyncGenerator.js | 8 ++++++ .../Symbol/asyncIterator/cross-realm.js | 15 ++++++++++ .../Symbol/asyncIterator/prop-desc.js | 17 +++++++++++ ...rly-errors-binding-identifier-duplicate.js | 0 ...early-errors-expression-parameter-await.js | 14 ---------- ...errors-next-receiver-not-async-iterator.js | 11 ++++---- 10 files changed, 111 insertions(+), 19 deletions(-) create mode 100644 test/built-ins/AsyncGenerator/AsyncGenerator-construct.js create mode 100644 test/built-ins/AsyncGenerator/AsyncGenerator-is-extensible.js create mode 100644 test/built-ins/AsyncGenerator/AsyncGenerator-is-subclass.js create mode 100644 test/built-ins/AsyncGenerator/AsyncGenerator-length.js create mode 100644 test/built-ins/AsyncGenerator/AsyncGenerator.js create mode 100644 test/built-ins/Symbol/asyncIterator/cross-realm.js create mode 100644 test/built-ins/Symbol/asyncIterator/prop-desc.js delete mode 100644 test/language/expressions/async-generators/early-errors-binding-identifier-duplicate.js delete mode 100644 test/language/expressions/async-generators/early-errors-expression-parameter-await.js diff --git a/test/built-ins/AsyncGenerator/AsyncGenerator-construct.js b/test/built-ins/AsyncGenerator/AsyncGenerator-construct.js new file mode 100644 index 00000000000..7e52d6f9ac7 --- /dev/null +++ b/test/built-ins/AsyncGenerator/AsyncGenerator-construct.js @@ -0,0 +1,28 @@ +/*--- +author: Benjamin Gruenbaum +esid: pending +description: > + %AsyncGeneratorProrotype% creates functions with or without new and handles arguments + similarly to functions. +---*/ + +var AsyncGeneratorProrotype = async function* foo() { }.constructor; +var fn; + +fn = AsyncGeneratorProrotype("a", "await 1;"); +assert.sameValue(fn.length, 1, "length with 1 argument, call"); + +fn = AsyncGeneratorProrotype("a,b", "await 1;"); +assert.sameValue(fn.length, 2, "length with 2 arguments in one, call"); + +fn = AsyncGeneratorProrotype("a", "b", "await 1;"); +assert.sameValue(fn.length, 2, "length with 2 arguments, call"); + +fn = new AsyncGeneratorProrotype("a", "await 1;"); +assert.sameValue(fn.length, 1, "length with 1 argument, construct"); + +fn = new AsyncGeneratorProrotype("a,b", "await 1;"); +assert.sameValue(fn.length, 2, "length with 2 arguments in one, construct"); + +fn = new AsyncGeneratorProrotype("a", "b", "await 1;"); +assert.sameValue(fn.length, 2, "length with 2 arguments, construct"); diff --git a/test/built-ins/AsyncGenerator/AsyncGenerator-is-extensible.js b/test/built-ins/AsyncGenerator/AsyncGenerator-is-extensible.js new file mode 100644 index 00000000000..c5c58790251 --- /dev/null +++ b/test/built-ins/AsyncGenerator/AsyncGenerator-is-extensible.js @@ -0,0 +1,10 @@ +/*--- +author: Benjamin Gruenbaum +esid: pending +description: > + %AsyncGeneratorFunction% is extensible +---*/ + +var AsyncGeneratorFunction = async function() { }.constructor; +AsyncGeneratorFunction.x = 1; +assert.sameValue(AsyncGeneratorFunction.x, 1); diff --git a/test/built-ins/AsyncGenerator/AsyncGenerator-is-subclass.js b/test/built-ins/AsyncGenerator/AsyncGenerator-is-subclass.js new file mode 100644 index 00000000000..a60da2aad15 --- /dev/null +++ b/test/built-ins/AsyncGenerator/AsyncGenerator-is-subclass.js @@ -0,0 +1,14 @@ +/*--- +author: Benjamin Gruenbaum +esid: pending +description: > + %AsyncGeneratorFunction% is a subclass of Function + (The AsyncGeneratorFunction constructor is a standard built-in + function object that inherits from the Function constructor. ) +---*/ +async function* foo() { }; +var AsyncGeneratorFunction = foo.constructor; +assert.sameValue(Object.getPrototypeOf(AsyncGeneratorFunction), Function, "Prototype of constructor is Function"); +assert.sameValue(Object.getPrototypeOf(AsyncGeneratorFunction.prototype), Function.prototype, "Prototype of constructor's prototype is Function.prototype"); +assert(foo instanceof Function, 'async generator instance is instanceof Function'); + diff --git a/test/built-ins/AsyncGenerator/AsyncGenerator-length.js b/test/built-ins/AsyncGenerator/AsyncGenerator-length.js new file mode 100644 index 00000000000..42aa73b41eb --- /dev/null +++ b/test/built-ins/AsyncGenerator/AsyncGenerator-length.js @@ -0,0 +1,13 @@ +/*--- +author: Benjamin Gruenbaum +esid: pending +description: > + %AsyncGeneratorFunction% has a length of 1 with writable false, enumerable false, configurable true. +includes: [propertyHelper.js] +---*/ + +var AsyncGeneratorFunction = async function* foo() { }.constructor; +assert.sameValue(AsyncGeneratorFunction.length, 1); +verifyNotWritable(AsyncGeneratorFunction, 'length'); +verifyNotEnumerable(AsyncGeneratorFunction, 'length'); +verifyConfigurable(AsyncGeneratorFunction, 'length'); diff --git a/test/built-ins/AsyncGenerator/AsyncGenerator.js b/test/built-ins/AsyncGenerator/AsyncGenerator.js new file mode 100644 index 00000000000..80fc91a332a --- /dev/null +++ b/test/built-ins/AsyncGenerator/AsyncGenerator.js @@ -0,0 +1,8 @@ +/*--- +author: Benjamin Gruenbaum +description: > + %AsyncGeneratorPrototype% exists and is a function +---*/ + +var AsyncGeneratorFunction = async function* foo() { }.constructor; +assert.sameValue(typeof AsyncGeneratorFunction, "function"); diff --git a/test/built-ins/Symbol/asyncIterator/cross-realm.js b/test/built-ins/Symbol/asyncIterator/cross-realm.js new file mode 100644 index 00000000000..ceccf50f9a9 --- /dev/null +++ b/test/built-ins/Symbol/asyncIterator/cross-realm.js @@ -0,0 +1,15 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +author: Benjamin Gruenbaum +esid: early +description: Value shared by all realms +info: > + Unless otherwise specified, well-known symbols values are shared by all + realms. +features: [Symbol.asyncIterator] +---*/ + +var otherRealmSymbol = $.createRealm().global.Symbol; + +assert.sameValue(Symbol.asyncIterator, otherRealmSymbol.asyncIterator); diff --git a/test/built-ins/Symbol/asyncIterator/prop-desc.js b/test/built-ins/Symbol/asyncIterator/prop-desc.js new file mode 100644 index 00000000000..4da5fce2aae --- /dev/null +++ b/test/built-ins/Symbol/asyncIterator/prop-desc.js @@ -0,0 +1,17 @@ +// Copyright (C) 2015-2017 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: early +description: > + `Symbol.asyncIterator` property descriptor +info: > + This property has the attributes { [[Writable]]: false, [[Enumerable]]: + false, [[Configurable]]: false }. +includes: [propertyHelper.js] +features: [Symbol.asyncIterator] +---*/ + +assert.sameValue(typeof Symbol.asyncIterator, 'symbol'); +verifyNotEnumerable(Symbol, 'asyncIterator'); +verifyNotWritable(Symbol, 'asyncIterator'); +verifyNotConfigurable(Symbol, 'asyncIterator'); diff --git a/test/language/expressions/async-generators/early-errors-binding-identifier-duplicate.js b/test/language/expressions/async-generators/early-errors-binding-identifier-duplicate.js deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/test/language/expressions/async-generators/early-errors-expression-parameter-await.js b/test/language/expressions/async-generators/early-errors-expression-parameter-await.js deleted file mode 100644 index 3e77f7c84f2..00000000000 --- a/test/language/expressions/async-generators/early-errors-expression-parameter-await.js +++ /dev/null @@ -1,14 +0,0 @@ -// Copyright 2017 the V8 project authors. All rights reserved. -// This code is governed by the BSD license found in the LICENSE file. - -/*--- -author: Benjamin Gruenbaum -esid: pending -description: > - throw a SyntaxError if UniqueFormalParameters contains await (invalid BindingIdentifier): -negative: - phase: early - type: SyntaxError ----*/ - -(async function* (await) {}); \ No newline at end of file diff --git a/test/language/expressions/async-generators/early-errors-next-receiver-not-async-iterator.js b/test/language/expressions/async-generators/early-errors-next-receiver-not-async-iterator.js index 254a4b10886..542b6b2993a 100644 --- a/test/language/expressions/async-generators/early-errors-next-receiver-not-async-iterator.js +++ b/test/language/expressions/async-generators/early-errors-next-receiver-not-async-iterator.js @@ -5,10 +5,11 @@ author: Benjamin Gruenbaum esid: pending description: > - next() throws a TypeError when receiver is not an AsyncGenerator instance: -negative: - phase: early - type: TypeError + next() rejects with a TypeError when receiver is not an AsyncGenerator instance: ---*/ -(async function*() {})().next.call((function*() {})()); \ No newline at end of file +(async function*() {})().next.call((function*() {})()).then(function() { + throw new Test262Error("should not have resolved"); +}, function(err) { + assert(err instanceof TypeError); +}).then($DONE, $DONE); \ No newline at end of file From 93e68552eff0b26cee6ccdd46054e34530e0eacf Mon Sep 17 00:00:00 2001 From: Benjamin Gruenbaum Date: Fri, 13 Jan 2017 17:43:16 +0200 Subject: [PATCH 05/12] test name --- .../AsyncGenerator/AsyncGenerator-name.js | 15 +++++++++++++++ test/built-ins/Symbol/asyncIterator/name-prop.js | 11 +++++++++++ 2 files changed, 26 insertions(+) create mode 100644 test/built-ins/AsyncGenerator/AsyncGenerator-name.js create mode 100644 test/built-ins/Symbol/asyncIterator/name-prop.js diff --git a/test/built-ins/AsyncGenerator/AsyncGenerator-name.js b/test/built-ins/AsyncGenerator/AsyncGenerator-name.js new file mode 100644 index 00000000000..b21cfaa27a6 --- /dev/null +++ b/test/built-ins/AsyncGenerator/AsyncGenerator-name.js @@ -0,0 +1,15 @@ +/*--- +author: Benjamin Gruenbaum +esid: pending +description: > + The value of the name property of + the AsyncGeneratorFunction is "AsyncGeneratorFunction". +includes: [propertyHelper.js] +---*/ + +var AsyncGeneratorFunction = async function* foo() { }.constructor; +assert.sameValue(AsyncGeneratorFunction.name, "AsyncGeneratorFunction"); +verifyNotWritable(AsyncGeneratorFunctionAsyncFunction, "name"); +verifyNotEnumerable(AsyncGeneratorFunction, "name"); +verifyConfigurable(AsyncGeneratorFunction, "name"); + \ No newline at end of file diff --git a/test/built-ins/Symbol/asyncIterator/name-prop.js b/test/built-ins/Symbol/asyncIterator/name-prop.js new file mode 100644 index 00000000000..f8e3ba29916 --- /dev/null +++ b/test/built-ins/Symbol/asyncIterator/name-prop.js @@ -0,0 +1,11 @@ +/*--- +author: Benjamin Gruenbaum +esid: early +description: Name prop of Symbol.asyncIterator +info: > + The value of the name property of this function is "[Symbol.asyncIterator]". +features: [Symbol.asyncIterator] +---*/ + + +assert.sameValue(Symbol.asyncIterator.name, '[Symbol.asyncIterator]'); From 55ecee26769420a76ee1de496dad0fab67b54d54 Mon Sep 17 00:00:00 2001 From: Benjamin Gruenbaum Date: Fri, 13 Jan 2017 18:09:34 +0200 Subject: [PATCH 06/12] port thefourtheyes tests --- .../AsyncGenerator-is-extensible.js | 2 +- .../AsyncGenerator/AsyncGenerator-prototype.js | 11 +++++++++++ .../AsyncGeneratorPrototye-constructor.js | 14 ++++++++++++++ .../AsyncGeneratorPrototype-is-extensible.js | 11 +++++++++++ .../exposed-via-constructor-property.js | 8 ++++++++ test/built-ins/AsyncGenerator/is-not-a-global.js | 8 ++++++++ .../prototype-property-toStringTag.js | 15 +++++++++++++++ 7 files changed, 68 insertions(+), 1 deletion(-) create mode 100644 test/built-ins/AsyncGenerator/AsyncGenerator-prototype.js create mode 100644 test/built-ins/AsyncGenerator/AsyncGeneratorPrototye-constructor.js create mode 100644 test/built-ins/AsyncGenerator/AsyncGeneratorPrototype-is-extensible.js create mode 100644 test/built-ins/AsyncGenerator/exposed-via-constructor-property.js create mode 100644 test/built-ins/AsyncGenerator/is-not-a-global.js create mode 100644 test/built-ins/AsyncGenerator/prototype-property-toStringTag.js diff --git a/test/built-ins/AsyncGenerator/AsyncGenerator-is-extensible.js b/test/built-ins/AsyncGenerator/AsyncGenerator-is-extensible.js index c5c58790251..c8c1827ad3e 100644 --- a/test/built-ins/AsyncGenerator/AsyncGenerator-is-extensible.js +++ b/test/built-ins/AsyncGenerator/AsyncGenerator-is-extensible.js @@ -5,6 +5,6 @@ description: > %AsyncGeneratorFunction% is extensible ---*/ -var AsyncGeneratorFunction = async function() { }.constructor; +var AsyncGeneratorFunction = async function*() { }.constructor; AsyncGeneratorFunction.x = 1; assert.sameValue(AsyncGeneratorFunction.x, 1); diff --git a/test/built-ins/AsyncGenerator/AsyncGenerator-prototype.js b/test/built-ins/AsyncGenerator/AsyncGenerator-prototype.js new file mode 100644 index 00000000000..c39408850b8 --- /dev/null +++ b/test/built-ins/AsyncGenerator/AsyncGenerator-prototype.js @@ -0,0 +1,11 @@ +/*--- +author: Benjamin Gruenbaum +esid: pending +description: AsyncGeneratorFunction has a prototype property with writable false, enumerable false, configurable false. +includes: [propertyHelper.js] +---*/ + +var AsyncGeneratorFunction = async function* foo() { }.constructor; +verifyNotConfigurable(AsyncGeneratorFunction, 'prototype'); +verifyNotWritable(AsyncGeneratorFunction, 'prototype'); +verifyNotEnumerable(AsyncGeneratorFunctionAsyncFunction, 'prototype'); diff --git a/test/built-ins/AsyncGenerator/AsyncGeneratorPrototye-constructor.js b/test/built-ins/AsyncGenerator/AsyncGeneratorPrototye-constructor.js new file mode 100644 index 00000000000..2b23da826fc --- /dev/null +++ b/test/built-ins/AsyncGenerator/AsyncGeneratorPrototye-constructor.js @@ -0,0 +1,14 @@ +/*--- +author: Sakthipriyan Vairamani (thefourtheye) +description: Check if %AsyncGeneratorFunction% function's `prototype` + object's `constructor` property is %AsyncGeneratorFunction% + itself +---*/ + +const AsyncGeneratorFunction = async function* () {}.constructor; +const AGFPrototype = AsyncGeneratorFunction.prototype; +assert.sameValue(AGFPrototype.constructor, AsyncGeneratorFunction); + +verifyNotEnumerable(AGFPrototype, 'constructor'); +verifyNotWritable(AGFPrototype, 'constructor'); +verifyConfigurable(AGFPrototype, 'constructor'); \ No newline at end of file diff --git a/test/built-ins/AsyncGenerator/AsyncGeneratorPrototype-is-extensible.js b/test/built-ins/AsyncGenerator/AsyncGeneratorPrototype-is-extensible.js new file mode 100644 index 00000000000..a30bb67447e --- /dev/null +++ b/test/built-ins/AsyncGenerator/AsyncGeneratorPrototype-is-extensible.js @@ -0,0 +1,11 @@ +/*--- +author: Benjamin Gruenbaum +esid: pending +description: > + %AsyncGeneratorPrototype% has a [[Extensible]] of true +---*/ + +var AsyncGeneratorFunction = async function* foo() { }.constructor; +AsyncGeneratorFunction.prototype.x = 1; +assert.sameValue(AsyncGeneratorFunction.prototype.x, 1); + diff --git a/test/built-ins/AsyncGenerator/exposed-via-constructor-property.js b/test/built-ins/AsyncGenerator/exposed-via-constructor-property.js new file mode 100644 index 00000000000..4ca32f6753b --- /dev/null +++ b/test/built-ins/AsyncGenerator/exposed-via-constructor-property.js @@ -0,0 +1,8 @@ +/*--- +author: Sakthipriyan Vairamani (thefourtheye) +description: Make sure %AsyncGeneratorFunction% is exposed via the + `.constructor` property. +---*/ + +const AsyncGeneratorFunction = async function* () {}.constructor; +assert.sameValue(typeof AsyncGeneratorFunction, 'function'); \ No newline at end of file diff --git a/test/built-ins/AsyncGenerator/is-not-a-global.js b/test/built-ins/AsyncGenerator/is-not-a-global.js new file mode 100644 index 00000000000..99ef5fda89a --- /dev/null +++ b/test/built-ins/AsyncGenerator/is-not-a-global.js @@ -0,0 +1,8 @@ +/*--- +author: Sakthipriyan Vairamani (thefourtheye) +description: Make sure %AsyncGeneratorFunction% is not a global function +---*/ + +assert.throws(ReferenceError, function() { + AsyncGeneratorFunction +}, 'AsyncGeneratorFunction should not be available in global scope'); \ No newline at end of file diff --git a/test/built-ins/AsyncGenerator/prototype-property-toStringTag.js b/test/built-ins/AsyncGenerator/prototype-property-toStringTag.js new file mode 100644 index 00000000000..a1bb7a0adb8 --- /dev/null +++ b/test/built-ins/AsyncGenerator/prototype-property-toStringTag.js @@ -0,0 +1,15 @@ +/*--- +author: Sakthipriyan Vairamani (thefourtheye) +description: Check if %AsyncGeneratorFunction% function's `prototype` + object's `Symbol.toStringTag` property is + 'AsyncGeneratorFunction' +---*/ + +const AsyncGeneratorFunction = async function* () {}.constructor; +const AGFPrototype = AsyncGeneratorFunction.prototype; + +assert.sameValue(AGFPrototype[Symbol.toStringTag], 'AsyncGeneratorFunction'); + +verifyNotEnumerable(AGFPrototype, Symbol.toStringTag); +verifyNotWritable(AGFPrototype, Symbol.toStringTag); +verifyConfigurable(AGFPrototype, Symbol.toStringTag); \ No newline at end of file From fc0a26dbe686532181c56746eb800c2543d2ca36 Mon Sep 17 00:00:00 2001 From: sasha Date: Fri, 13 Jan 2017 18:18:04 +0200 Subject: [PATCH 07/12] test --- ...s-yield-nested-async-function-expression.js | 16 ++++++++++++++++ ...tains-yield-nested-generator-declaration.js | 18 ++++++++++++++++++ ...ntains-yield-nested-generator-expression.js | 16 ++++++++++++++++ ...s-contains-yield-nested-generator-method.js | 18 ++++++++++++++++++ ...or-declaration-parameters-contains-yield.js | 13 +++++++++++++ 5 files changed, 81 insertions(+) create mode 100644 test/language/statements/async-generator/early-error-declaration-parameters-contains-yield-nested-async-function-expression.js create mode 100644 test/language/statements/async-generator/early-error-declaration-parameters-contains-yield-nested-generator-declaration.js create mode 100644 test/language/statements/async-generator/early-error-declaration-parameters-contains-yield-nested-generator-expression.js create mode 100644 test/language/statements/async-generator/early-error-declaration-parameters-contains-yield-nested-generator-method.js create mode 100644 test/language/statements/async-generator/early-error-declaration-parameters-contains-yield.js diff --git a/test/language/statements/async-generator/early-error-declaration-parameters-contains-yield-nested-async-function-expression.js b/test/language/statements/async-generator/early-error-declaration-parameters-contains-yield-nested-async-function-expression.js new file mode 100644 index 00000000000..d9d8fa33cf1 --- /dev/null +++ b/test/language/statements/async-generator/early-error-declaration-parameters-contains-yield-nested-async-function-expression.js @@ -0,0 +1,16 @@ +// Copyright 2016 Microsoft, Inc. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- + author: Sasha Kruglyak + esid: pending + description: It is a syntax error if BindingIdentifier is "yield" + and function is nested inside AsyncFunctionExpression + negative: + phase: early + type: SyntaxError + ---*/ + +async function() { + async function* foo (yield) { } +} \ No newline at end of file diff --git a/test/language/statements/async-generator/early-error-declaration-parameters-contains-yield-nested-generator-declaration.js b/test/language/statements/async-generator/early-error-declaration-parameters-contains-yield-nested-generator-declaration.js new file mode 100644 index 00000000000..bb1acc2b548 --- /dev/null +++ b/test/language/statements/async-generator/early-error-declaration-parameters-contains-yield-nested-generator-declaration.js @@ -0,0 +1,18 @@ +// Copyright 2016 Microsoft, Inc. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- + author: Sasha Kruglyak + esid: pending + description: It is a syntax error if BindingIdentifier is "yield" + and function is nested inside GeneratorDeclaration + negative: + phase: early + type: SyntaxError + ---*/ + +function* boo() { + async function* foo (yield) { } +} + + diff --git a/test/language/statements/async-generator/early-error-declaration-parameters-contains-yield-nested-generator-expression.js b/test/language/statements/async-generator/early-error-declaration-parameters-contains-yield-nested-generator-expression.js new file mode 100644 index 00000000000..dcb4f17ab8b --- /dev/null +++ b/test/language/statements/async-generator/early-error-declaration-parameters-contains-yield-nested-generator-expression.js @@ -0,0 +1,16 @@ +// Copyright 2016 Microsoft, Inc. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- + author: Sasha Kruglyak + esid: pending + description: It is a syntax error if BindingIdentifier is "yield" + and function is nested inside GeneratorExpression + negative: + phase: early + type: SyntaxError + ---*/ + +function*() { + async function* foo (yield) { } +} \ No newline at end of file diff --git a/test/language/statements/async-generator/early-error-declaration-parameters-contains-yield-nested-generator-method.js b/test/language/statements/async-generator/early-error-declaration-parameters-contains-yield-nested-generator-method.js new file mode 100644 index 00000000000..bbd84041775 --- /dev/null +++ b/test/language/statements/async-generator/early-error-declaration-parameters-contains-yield-nested-generator-method.js @@ -0,0 +1,18 @@ +// Copyright 2016 Microsoft, Inc. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- + author: Sasha Kruglyak + esid: pending + description: It is a syntax error if BindingIdentifier is "yield" + and function is nested inside GeneratorMethod + negative: + phase: early + type: SyntaxError + ---*/ + +class A { + *boo() { + async function* foo (yield) { } + } +} \ No newline at end of file diff --git a/test/language/statements/async-generator/early-error-declaration-parameters-contains-yield.js b/test/language/statements/async-generator/early-error-declaration-parameters-contains-yield.js new file mode 100644 index 00000000000..d3143c1a5b6 --- /dev/null +++ b/test/language/statements/async-generator/early-error-declaration-parameters-contains-yield.js @@ -0,0 +1,13 @@ +// Copyright 2016 Microsoft, Inc. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- + author: Sasha Kruglyak + esid: pending + description: It is a syntax error if FormalParameters contains yield + negative: + phase: early + type: SyntaxError + ---*/ + +async function* foo (yield) { } From 0e1bea094e800f306625cfc7d28a9e592716e4fd Mon Sep 17 00:00:00 2001 From: sasha Date: Fri, 13 Jan 2017 19:15:40 +0200 Subject: [PATCH 08/12] move test --- ...-parameters-contains-yield-nested-async-function-expression.js | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename test/language/statements/{async-generator => async-function}/early-error-declaration-parameters-contains-yield-nested-async-function-expression.js (100%) diff --git a/test/language/statements/async-generator/early-error-declaration-parameters-contains-yield-nested-async-function-expression.js b/test/language/statements/async-function/early-error-declaration-parameters-contains-yield-nested-async-function-expression.js similarity index 100% rename from test/language/statements/async-generator/early-error-declaration-parameters-contains-yield-nested-async-function-expression.js rename to test/language/statements/async-function/early-error-declaration-parameters-contains-yield-nested-async-function-expression.js From 8edb6c6dcba07818bca95918485cfbb017c96ba7 Mon Sep 17 00:00:00 2001 From: Benjamin Gruenbaum Date: Fri, 13 Jan 2017 16:47:24 +0200 Subject: [PATCH 09/12] # This is a combination of 9 commits. # The first commit's message is: initial work fix test to reject instead of throw symbol tests more symbol tests feedback by caitp simplify symbol test fix built in tests initial work ORealm -> otherRealmSymbol Error->Test262Error figure out what these tests mean AsyncGeneratorMethod throw a SyntaxError if UniqueFormalParameters contains AwaitExpression AsyncGeneratorMethod throw a SyntaxError if UniqueFormalParameters contains YieldExpression. AsyncGeneratorMethod throw a SyntaxError if HasDirectSuper of AsyncGeneratorMethod is true. async generators test fix test to reject instead of throw symbol tests more symbol tests feedback by caitp simplify symbol test fix built in tests initial work ORealm -> otherRealmSymbol Error->Test262Error figure out what these tests mean subclass tests 6.3.2.1 # This is the commit message #2: test name # This is the commit message #3: port thefourtheyes tests # This is the commit message #4: fixed async/yield test naming (added expression), also added two tests for yield/await named params # This is the commit message #5: oops, untracked accesors # This is the commit message #6: renamed tests to conform with other early tests # This is the commit message #7: removed unnecessary copyright # This is the commit message #8: added wrongly created file # This is the commit message #9: Update AsyncGenerator-is-extensible.js --- .gitignore | 1 + .../AsyncGenerator-construct.js | 28 +++++++++++++++++++ .../AsyncGenerator-is-extensible.js | 10 +++++++ .../AsyncGenerator-is-subclass.js | 14 ++++++++++ .../AsyncGenerator/AsyncGenerator-length.js | 13 +++++++++ .../AsyncGenerator/AsyncGenerator-name.js | 15 ++++++++++ .../AsyncGenerator-prototype.js | 11 ++++++++ .../AsyncGenerator/AsyncGenerator.js | 8 ++++++ .../AsyncGeneratorPrototye-constructor.js | 14 ++++++++++ .../AsyncGeneratorPrototype-is-extensible.js | 11 ++++++++ .../exposed-via-constructor-property.js | 8 ++++++ .../AsyncGenerator/is-not-a-global.js | 8 ++++++ .../prototype-property-toStringTag.js | 15 ++++++++++ .../Symbol/asyncIterator/cross-realm.js | 15 ++++++++++ .../Symbol/asyncIterator/name-prop.js | 11 ++++++++ .../Symbol/asyncIterator/prop-desc.js | 17 +++++++++++ ...early-errors-expression-parameter-yield.js | 14 ++++++++++ ...errors-next-receiver-not-async-iterator.js | 15 ++++++++++ ...on-parameters-contains-await-expression.js | 13 +++++++++ ...r-declaration-parameters-contains-await.js | 13 +++++++++ ...laration-parameters-contains-super-call.js | 13 +++++++++ ...tion-parameters-contains-super-property.js | 13 +++++++++ ...calaration-body-contains-super-property.js | 13 +++++++++ ...rs-declaration-body-contains-super-call.js | 13 +++++++++ ...on-parameters-contains-yield-expression.js | 13 +++++++++ ...c-generators-await-expression-in-params.js | 12 ++++++++ ...ethods-async-generators-await-in-params.js | 13 +++++++++ ...ync-generators-duplicate-entries-params.js | 12 ++++++++ ...ethods-async-generators-super-call-body.js | 13 +++++++++ ...thods-async-generators-super-call-param.js | 13 +++++++++ ...c-generators-yield-expression-in-params.js | 12 ++++++++ ...ethods-async-generators-yield-in-params.js | 13 +++++++++ ...y-errors-methods-async-super-call-body.js} | 0 ...-errors-methods-async-super-call-param.js} | 0 34 files changed, 407 insertions(+) create mode 100644 test/built-ins/AsyncGenerator/AsyncGenerator-construct.js create mode 100644 test/built-ins/AsyncGenerator/AsyncGenerator-is-extensible.js create mode 100644 test/built-ins/AsyncGenerator/AsyncGenerator-is-subclass.js create mode 100644 test/built-ins/AsyncGenerator/AsyncGenerator-length.js create mode 100644 test/built-ins/AsyncGenerator/AsyncGenerator-name.js create mode 100644 test/built-ins/AsyncGenerator/AsyncGenerator-prototype.js create mode 100644 test/built-ins/AsyncGenerator/AsyncGenerator.js create mode 100644 test/built-ins/AsyncGenerator/AsyncGeneratorPrototye-constructor.js create mode 100644 test/built-ins/AsyncGenerator/AsyncGeneratorPrototype-is-extensible.js create mode 100644 test/built-ins/AsyncGenerator/exposed-via-constructor-property.js create mode 100644 test/built-ins/AsyncGenerator/is-not-a-global.js create mode 100644 test/built-ins/AsyncGenerator/prototype-property-toStringTag.js create mode 100644 test/built-ins/Symbol/asyncIterator/cross-realm.js create mode 100644 test/built-ins/Symbol/asyncIterator/name-prop.js create mode 100644 test/built-ins/Symbol/asyncIterator/prop-desc.js create mode 100644 test/language/expressions/async-generators/early-errors-expression-parameter-yield.js create mode 100644 test/language/expressions/async-generators/early-errors-next-receiver-not-async-iterator.js create mode 100644 test/language/statements/async-generator/early-error-declaration-parameters-contains-await-expression.js create mode 100644 test/language/statements/async-generator/early-error-declaration-parameters-contains-await.js create mode 100644 test/language/statements/async-generator/early-error-declaration-parameters-contains-super-call.js create mode 100644 test/language/statements/async-generator/early-error-declaration-parameters-contains-super-property.js create mode 100644 test/language/statements/async-generator/early-errors-decalaration-body-contains-super-property.js create mode 100644 test/language/statements/async-generator/early-errors-declaration-body-contains-super-call.js create mode 100644 test/language/statements/async-generator/early-errors-declaration-parameters-contains-yield-expression.js create mode 100644 test/language/statements/class/definition/early-errors-methods-async-generators-await-expression-in-params.js create mode 100644 test/language/statements/class/definition/early-errors-methods-async-generators-await-in-params.js create mode 100644 test/language/statements/class/definition/early-errors-methods-async-generators-duplicate-entries-params.js create mode 100644 test/language/statements/class/definition/early-errors-methods-async-generators-super-call-body.js create mode 100644 test/language/statements/class/definition/early-errors-methods-async-generators-super-call-param.js create mode 100644 test/language/statements/class/definition/early-errors-methods-async-generators-yield-expression-in-params.js create mode 100644 test/language/statements/class/definition/early-errors-methods-async-generators-yield-in-params.js rename test/language/statements/class/definition/{methods-async-super-call-body.js => early-errors-methods-async-super-call-body.js} (100%) rename test/language/statements/class/definition/{methods-async-super-call-param.js => early-errors-methods-async-super-call-param.js} (100%) diff --git a/.gitignore b/.gitignore index 1203b32d2ea..bb6ea389254 100644 --- a/.gitignore +++ b/.gitignore @@ -3,3 +3,4 @@ *~ *.pyc console/TestCases +.idea \ No newline at end of file diff --git a/test/built-ins/AsyncGenerator/AsyncGenerator-construct.js b/test/built-ins/AsyncGenerator/AsyncGenerator-construct.js new file mode 100644 index 00000000000..7e52d6f9ac7 --- /dev/null +++ b/test/built-ins/AsyncGenerator/AsyncGenerator-construct.js @@ -0,0 +1,28 @@ +/*--- +author: Benjamin Gruenbaum +esid: pending +description: > + %AsyncGeneratorProrotype% creates functions with or without new and handles arguments + similarly to functions. +---*/ + +var AsyncGeneratorProrotype = async function* foo() { }.constructor; +var fn; + +fn = AsyncGeneratorProrotype("a", "await 1;"); +assert.sameValue(fn.length, 1, "length with 1 argument, call"); + +fn = AsyncGeneratorProrotype("a,b", "await 1;"); +assert.sameValue(fn.length, 2, "length with 2 arguments in one, call"); + +fn = AsyncGeneratorProrotype("a", "b", "await 1;"); +assert.sameValue(fn.length, 2, "length with 2 arguments, call"); + +fn = new AsyncGeneratorProrotype("a", "await 1;"); +assert.sameValue(fn.length, 1, "length with 1 argument, construct"); + +fn = new AsyncGeneratorProrotype("a,b", "await 1;"); +assert.sameValue(fn.length, 2, "length with 2 arguments in one, construct"); + +fn = new AsyncGeneratorProrotype("a", "b", "await 1;"); +assert.sameValue(fn.length, 2, "length with 2 arguments, construct"); diff --git a/test/built-ins/AsyncGenerator/AsyncGenerator-is-extensible.js b/test/built-ins/AsyncGenerator/AsyncGenerator-is-extensible.js new file mode 100644 index 00000000000..c8c1827ad3e --- /dev/null +++ b/test/built-ins/AsyncGenerator/AsyncGenerator-is-extensible.js @@ -0,0 +1,10 @@ +/*--- +author: Benjamin Gruenbaum +esid: pending +description: > + %AsyncGeneratorFunction% is extensible +---*/ + +var AsyncGeneratorFunction = async function*() { }.constructor; +AsyncGeneratorFunction.x = 1; +assert.sameValue(AsyncGeneratorFunction.x, 1); diff --git a/test/built-ins/AsyncGenerator/AsyncGenerator-is-subclass.js b/test/built-ins/AsyncGenerator/AsyncGenerator-is-subclass.js new file mode 100644 index 00000000000..a60da2aad15 --- /dev/null +++ b/test/built-ins/AsyncGenerator/AsyncGenerator-is-subclass.js @@ -0,0 +1,14 @@ +/*--- +author: Benjamin Gruenbaum +esid: pending +description: > + %AsyncGeneratorFunction% is a subclass of Function + (The AsyncGeneratorFunction constructor is a standard built-in + function object that inherits from the Function constructor. ) +---*/ +async function* foo() { }; +var AsyncGeneratorFunction = foo.constructor; +assert.sameValue(Object.getPrototypeOf(AsyncGeneratorFunction), Function, "Prototype of constructor is Function"); +assert.sameValue(Object.getPrototypeOf(AsyncGeneratorFunction.prototype), Function.prototype, "Prototype of constructor's prototype is Function.prototype"); +assert(foo instanceof Function, 'async generator instance is instanceof Function'); + diff --git a/test/built-ins/AsyncGenerator/AsyncGenerator-length.js b/test/built-ins/AsyncGenerator/AsyncGenerator-length.js new file mode 100644 index 00000000000..42aa73b41eb --- /dev/null +++ b/test/built-ins/AsyncGenerator/AsyncGenerator-length.js @@ -0,0 +1,13 @@ +/*--- +author: Benjamin Gruenbaum +esid: pending +description: > + %AsyncGeneratorFunction% has a length of 1 with writable false, enumerable false, configurable true. +includes: [propertyHelper.js] +---*/ + +var AsyncGeneratorFunction = async function* foo() { }.constructor; +assert.sameValue(AsyncGeneratorFunction.length, 1); +verifyNotWritable(AsyncGeneratorFunction, 'length'); +verifyNotEnumerable(AsyncGeneratorFunction, 'length'); +verifyConfigurable(AsyncGeneratorFunction, 'length'); diff --git a/test/built-ins/AsyncGenerator/AsyncGenerator-name.js b/test/built-ins/AsyncGenerator/AsyncGenerator-name.js new file mode 100644 index 00000000000..b21cfaa27a6 --- /dev/null +++ b/test/built-ins/AsyncGenerator/AsyncGenerator-name.js @@ -0,0 +1,15 @@ +/*--- +author: Benjamin Gruenbaum +esid: pending +description: > + The value of the name property of + the AsyncGeneratorFunction is "AsyncGeneratorFunction". +includes: [propertyHelper.js] +---*/ + +var AsyncGeneratorFunction = async function* foo() { }.constructor; +assert.sameValue(AsyncGeneratorFunction.name, "AsyncGeneratorFunction"); +verifyNotWritable(AsyncGeneratorFunctionAsyncFunction, "name"); +verifyNotEnumerable(AsyncGeneratorFunction, "name"); +verifyConfigurable(AsyncGeneratorFunction, "name"); + \ No newline at end of file diff --git a/test/built-ins/AsyncGenerator/AsyncGenerator-prototype.js b/test/built-ins/AsyncGenerator/AsyncGenerator-prototype.js new file mode 100644 index 00000000000..c39408850b8 --- /dev/null +++ b/test/built-ins/AsyncGenerator/AsyncGenerator-prototype.js @@ -0,0 +1,11 @@ +/*--- +author: Benjamin Gruenbaum +esid: pending +description: AsyncGeneratorFunction has a prototype property with writable false, enumerable false, configurable false. +includes: [propertyHelper.js] +---*/ + +var AsyncGeneratorFunction = async function* foo() { }.constructor; +verifyNotConfigurable(AsyncGeneratorFunction, 'prototype'); +verifyNotWritable(AsyncGeneratorFunction, 'prototype'); +verifyNotEnumerable(AsyncGeneratorFunctionAsyncFunction, 'prototype'); diff --git a/test/built-ins/AsyncGenerator/AsyncGenerator.js b/test/built-ins/AsyncGenerator/AsyncGenerator.js new file mode 100644 index 00000000000..80fc91a332a --- /dev/null +++ b/test/built-ins/AsyncGenerator/AsyncGenerator.js @@ -0,0 +1,8 @@ +/*--- +author: Benjamin Gruenbaum +description: > + %AsyncGeneratorPrototype% exists and is a function +---*/ + +var AsyncGeneratorFunction = async function* foo() { }.constructor; +assert.sameValue(typeof AsyncGeneratorFunction, "function"); diff --git a/test/built-ins/AsyncGenerator/AsyncGeneratorPrototye-constructor.js b/test/built-ins/AsyncGenerator/AsyncGeneratorPrototye-constructor.js new file mode 100644 index 00000000000..2b23da826fc --- /dev/null +++ b/test/built-ins/AsyncGenerator/AsyncGeneratorPrototye-constructor.js @@ -0,0 +1,14 @@ +/*--- +author: Sakthipriyan Vairamani (thefourtheye) +description: Check if %AsyncGeneratorFunction% function's `prototype` + object's `constructor` property is %AsyncGeneratorFunction% + itself +---*/ + +const AsyncGeneratorFunction = async function* () {}.constructor; +const AGFPrototype = AsyncGeneratorFunction.prototype; +assert.sameValue(AGFPrototype.constructor, AsyncGeneratorFunction); + +verifyNotEnumerable(AGFPrototype, 'constructor'); +verifyNotWritable(AGFPrototype, 'constructor'); +verifyConfigurable(AGFPrototype, 'constructor'); \ No newline at end of file diff --git a/test/built-ins/AsyncGenerator/AsyncGeneratorPrototype-is-extensible.js b/test/built-ins/AsyncGenerator/AsyncGeneratorPrototype-is-extensible.js new file mode 100644 index 00000000000..a30bb67447e --- /dev/null +++ b/test/built-ins/AsyncGenerator/AsyncGeneratorPrototype-is-extensible.js @@ -0,0 +1,11 @@ +/*--- +author: Benjamin Gruenbaum +esid: pending +description: > + %AsyncGeneratorPrototype% has a [[Extensible]] of true +---*/ + +var AsyncGeneratorFunction = async function* foo() { }.constructor; +AsyncGeneratorFunction.prototype.x = 1; +assert.sameValue(AsyncGeneratorFunction.prototype.x, 1); + diff --git a/test/built-ins/AsyncGenerator/exposed-via-constructor-property.js b/test/built-ins/AsyncGenerator/exposed-via-constructor-property.js new file mode 100644 index 00000000000..4ca32f6753b --- /dev/null +++ b/test/built-ins/AsyncGenerator/exposed-via-constructor-property.js @@ -0,0 +1,8 @@ +/*--- +author: Sakthipriyan Vairamani (thefourtheye) +description: Make sure %AsyncGeneratorFunction% is exposed via the + `.constructor` property. +---*/ + +const AsyncGeneratorFunction = async function* () {}.constructor; +assert.sameValue(typeof AsyncGeneratorFunction, 'function'); \ No newline at end of file diff --git a/test/built-ins/AsyncGenerator/is-not-a-global.js b/test/built-ins/AsyncGenerator/is-not-a-global.js new file mode 100644 index 00000000000..99ef5fda89a --- /dev/null +++ b/test/built-ins/AsyncGenerator/is-not-a-global.js @@ -0,0 +1,8 @@ +/*--- +author: Sakthipriyan Vairamani (thefourtheye) +description: Make sure %AsyncGeneratorFunction% is not a global function +---*/ + +assert.throws(ReferenceError, function() { + AsyncGeneratorFunction +}, 'AsyncGeneratorFunction should not be available in global scope'); \ No newline at end of file diff --git a/test/built-ins/AsyncGenerator/prototype-property-toStringTag.js b/test/built-ins/AsyncGenerator/prototype-property-toStringTag.js new file mode 100644 index 00000000000..a1bb7a0adb8 --- /dev/null +++ b/test/built-ins/AsyncGenerator/prototype-property-toStringTag.js @@ -0,0 +1,15 @@ +/*--- +author: Sakthipriyan Vairamani (thefourtheye) +description: Check if %AsyncGeneratorFunction% function's `prototype` + object's `Symbol.toStringTag` property is + 'AsyncGeneratorFunction' +---*/ + +const AsyncGeneratorFunction = async function* () {}.constructor; +const AGFPrototype = AsyncGeneratorFunction.prototype; + +assert.sameValue(AGFPrototype[Symbol.toStringTag], 'AsyncGeneratorFunction'); + +verifyNotEnumerable(AGFPrototype, Symbol.toStringTag); +verifyNotWritable(AGFPrototype, Symbol.toStringTag); +verifyConfigurable(AGFPrototype, Symbol.toStringTag); \ No newline at end of file diff --git a/test/built-ins/Symbol/asyncIterator/cross-realm.js b/test/built-ins/Symbol/asyncIterator/cross-realm.js new file mode 100644 index 00000000000..ceccf50f9a9 --- /dev/null +++ b/test/built-ins/Symbol/asyncIterator/cross-realm.js @@ -0,0 +1,15 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +author: Benjamin Gruenbaum +esid: early +description: Value shared by all realms +info: > + Unless otherwise specified, well-known symbols values are shared by all + realms. +features: [Symbol.asyncIterator] +---*/ + +var otherRealmSymbol = $.createRealm().global.Symbol; + +assert.sameValue(Symbol.asyncIterator, otherRealmSymbol.asyncIterator); diff --git a/test/built-ins/Symbol/asyncIterator/name-prop.js b/test/built-ins/Symbol/asyncIterator/name-prop.js new file mode 100644 index 00000000000..f8e3ba29916 --- /dev/null +++ b/test/built-ins/Symbol/asyncIterator/name-prop.js @@ -0,0 +1,11 @@ +/*--- +author: Benjamin Gruenbaum +esid: early +description: Name prop of Symbol.asyncIterator +info: > + The value of the name property of this function is "[Symbol.asyncIterator]". +features: [Symbol.asyncIterator] +---*/ + + +assert.sameValue(Symbol.asyncIterator.name, '[Symbol.asyncIterator]'); diff --git a/test/built-ins/Symbol/asyncIterator/prop-desc.js b/test/built-ins/Symbol/asyncIterator/prop-desc.js new file mode 100644 index 00000000000..4da5fce2aae --- /dev/null +++ b/test/built-ins/Symbol/asyncIterator/prop-desc.js @@ -0,0 +1,17 @@ +// Copyright (C) 2015-2017 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: early +description: > + `Symbol.asyncIterator` property descriptor +info: > + This property has the attributes { [[Writable]]: false, [[Enumerable]]: + false, [[Configurable]]: false }. +includes: [propertyHelper.js] +features: [Symbol.asyncIterator] +---*/ + +assert.sameValue(typeof Symbol.asyncIterator, 'symbol'); +verifyNotEnumerable(Symbol, 'asyncIterator'); +verifyNotWritable(Symbol, 'asyncIterator'); +verifyNotConfigurable(Symbol, 'asyncIterator'); diff --git a/test/language/expressions/async-generators/early-errors-expression-parameter-yield.js b/test/language/expressions/async-generators/early-errors-expression-parameter-yield.js new file mode 100644 index 00000000000..a2bef65f952 --- /dev/null +++ b/test/language/expressions/async-generators/early-errors-expression-parameter-yield.js @@ -0,0 +1,14 @@ +// Copyright 2017 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +author: Benjamin Gruenbaum +esid: pending +description: > + throw a SyntaxError if UniqueFormalParameters contains yield (invalid BindingIdentifier): +negative: + phase: early + type: SyntaxError +---*/ + +(async function* (yield) {}); \ No newline at end of file diff --git a/test/language/expressions/async-generators/early-errors-next-receiver-not-async-iterator.js b/test/language/expressions/async-generators/early-errors-next-receiver-not-async-iterator.js new file mode 100644 index 00000000000..542b6b2993a --- /dev/null +++ b/test/language/expressions/async-generators/early-errors-next-receiver-not-async-iterator.js @@ -0,0 +1,15 @@ +// Copyright 2017 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +author: Benjamin Gruenbaum +esid: pending +description: > + next() rejects with a TypeError when receiver is not an AsyncGenerator instance: +---*/ + +(async function*() {})().next.call((function*() {})()).then(function() { + throw new Test262Error("should not have resolved"); +}, function(err) { + assert(err instanceof TypeError); +}).then($DONE, $DONE); \ No newline at end of file diff --git a/test/language/statements/async-generator/early-error-declaration-parameters-contains-await-expression.js b/test/language/statements/async-generator/early-error-declaration-parameters-contains-await-expression.js new file mode 100644 index 00000000000..986f3c784ca --- /dev/null +++ b/test/language/statements/async-generator/early-error-declaration-parameters-contains-await-expression.js @@ -0,0 +1,13 @@ +// Copyright 2016 Microsoft, Inc. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- + author: Sasha Kruglyak + esid: pending + description: It is a syntax error if FormalParameters contains AwaitExpression + negative: + phase: early + type: SyntaxError + ---*/ + +async function* foo (await 1) { } diff --git a/test/language/statements/async-generator/early-error-declaration-parameters-contains-await.js b/test/language/statements/async-generator/early-error-declaration-parameters-contains-await.js new file mode 100644 index 00000000000..099b921770a --- /dev/null +++ b/test/language/statements/async-generator/early-error-declaration-parameters-contains-await.js @@ -0,0 +1,13 @@ +// Copyright 2016 Microsoft, Inc. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- + author: Sasha Kruglyak + esid: pending + description: It is a syntax error if FormalParameters contains await + negative: + phase: early + type: SyntaxError + ---*/ + +async function* foo (await) { } diff --git a/test/language/statements/async-generator/early-error-declaration-parameters-contains-super-call.js b/test/language/statements/async-generator/early-error-declaration-parameters-contains-super-call.js new file mode 100644 index 00000000000..4180ebbb484 --- /dev/null +++ b/test/language/statements/async-generator/early-error-declaration-parameters-contains-super-call.js @@ -0,0 +1,13 @@ +// Copyright 2016 Microsoft, Inc. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- + author: Sasha Kruglyak + esid: pending + description: It is a syntax error if FormalParameters contains SuperCall + negative: + phase: early + type: SyntaxError + ---*/ + +async function* foo (super()) { } diff --git a/test/language/statements/async-generator/early-error-declaration-parameters-contains-super-property.js b/test/language/statements/async-generator/early-error-declaration-parameters-contains-super-property.js new file mode 100644 index 00000000000..d864a6c4246 --- /dev/null +++ b/test/language/statements/async-generator/early-error-declaration-parameters-contains-super-property.js @@ -0,0 +1,13 @@ +// Copyright 2016 Microsoft, Inc. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- + author: Sasha Kruglyak + esid: pending + description: It is a syntax error if FormalParameters contains SuperProperty + negative: + phase: early + type: SyntaxError + ---*/ + +async function* foo (super) { } diff --git a/test/language/statements/async-generator/early-errors-decalaration-body-contains-super-property.js b/test/language/statements/async-generator/early-errors-decalaration-body-contains-super-property.js new file mode 100644 index 00000000000..065108573ac --- /dev/null +++ b/test/language/statements/async-generator/early-errors-decalaration-body-contains-super-property.js @@ -0,0 +1,13 @@ +// Copyright 2016 Microsoft, Inc. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- + author: Sasha Kruglyak + esid: pending + description: It is a syntax error if AsyncGeneratorBody contains SuperProperty + negative: + phase: early + type: SyntaxError + ---*/ + +async function* foo () { super.prop; } diff --git a/test/language/statements/async-generator/early-errors-declaration-body-contains-super-call.js b/test/language/statements/async-generator/early-errors-declaration-body-contains-super-call.js new file mode 100644 index 00000000000..ef9fe5f158d --- /dev/null +++ b/test/language/statements/async-generator/early-errors-declaration-body-contains-super-call.js @@ -0,0 +1,13 @@ +// Copyright 2016 Microsoft, Inc. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- + author: Sasha Kruglyak + esid: pending + description: It is a syntax error if AsyncGeneratorBody contains SuperCall + negative: + phase: early + type: SyntaxError + ---*/ + +async function* foo () { super(); } diff --git a/test/language/statements/async-generator/early-errors-declaration-parameters-contains-yield-expression.js b/test/language/statements/async-generator/early-errors-declaration-parameters-contains-yield-expression.js new file mode 100644 index 00000000000..76b08b42e72 --- /dev/null +++ b/test/language/statements/async-generator/early-errors-declaration-parameters-contains-yield-expression.js @@ -0,0 +1,13 @@ +// Copyright 2016 Microsoft, Inc. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- + author: Sasha Kruglyak + esid: pending + description: It is a syntax error if FormalParameters contains YieldExpression + negative: + phase: early + type: SyntaxError + ---*/ + +async function* foo (yield) { } diff --git a/test/language/statements/class/definition/early-errors-methods-async-generators-await-expression-in-params.js b/test/language/statements/class/definition/early-errors-methods-async-generators-await-expression-in-params.js new file mode 100644 index 00000000000..2988d636159 --- /dev/null +++ b/test/language/statements/class/definition/early-errors-methods-async-generators-await-expression-in-params.js @@ -0,0 +1,12 @@ +/*--- +author: Nitzan Uziely +esid: pending +description: > + Throws a Syntax Error if UniqueFormalParameters contains AwaitExpression +negative: + phase: early + type: SyntaxError +---*/ +class A { + async function* method(await 1){} +} \ No newline at end of file diff --git a/test/language/statements/class/definition/early-errors-methods-async-generators-await-in-params.js b/test/language/statements/class/definition/early-errors-methods-async-generators-await-in-params.js new file mode 100644 index 00000000000..f921769939b --- /dev/null +++ b/test/language/statements/class/definition/early-errors-methods-async-generators-await-in-params.js @@ -0,0 +1,13 @@ +/*--- +author: Nitzan Uziely +esid: pending +description: > + AsyncGeneratorMethod throw a SyntaxError if UniqueFormalParameters + contains await (invalid BindingIdentifier) +negative: + phase: early + type: SyntaxError +---*/ +class A { + async function* method(await){} +} \ No newline at end of file diff --git a/test/language/statements/class/definition/early-errors-methods-async-generators-duplicate-entries-params.js b/test/language/statements/class/definition/early-errors-methods-async-generators-duplicate-entries-params.js new file mode 100644 index 00000000000..32f9aa9651f --- /dev/null +++ b/test/language/statements/class/definition/early-errors-methods-async-generators-duplicate-entries-params.js @@ -0,0 +1,12 @@ +/*--- +author: Nitzan Uziely +esid: pending +description: > + AsyncGeneratorMethod throw a SyntaxError if UniqueFormalParameters contains duplicate entries. +negative: + phase: early + type: SyntaxError +---*/ +class A { + async function* method(param,param){} +} \ No newline at end of file diff --git a/test/language/statements/class/definition/early-errors-methods-async-generators-super-call-body.js b/test/language/statements/class/definition/early-errors-methods-async-generators-super-call-body.js new file mode 100644 index 00000000000..05124bcbaa8 --- /dev/null +++ b/test/language/statements/class/definition/early-errors-methods-async-generators-super-call-body.js @@ -0,0 +1,13 @@ +/*--- +author: Nitzan Uziely +esid: pending +description: > + Throws a Syntax Error if HasDirectSuper of AsyncGeneratorMethod is true, + in function body +negative: + phase: early + type: SyntaxError +---*/ +class A { + async function* method(){super();} +} \ No newline at end of file diff --git a/test/language/statements/class/definition/early-errors-methods-async-generators-super-call-param.js b/test/language/statements/class/definition/early-errors-methods-async-generators-super-call-param.js new file mode 100644 index 00000000000..9fa932d763c --- /dev/null +++ b/test/language/statements/class/definition/early-errors-methods-async-generators-super-call-param.js @@ -0,0 +1,13 @@ +/*--- +author: Nitzan Uziely +esid: pending +description: > + Throws a Syntax Error if HasDirectSuper of AsyncGeneratorMethod is true, + in UniqueFormalParameters +negative: + phase: early + type: SyntaxError +---*/ +class A { + async function* method(x = super()){} +} \ No newline at end of file diff --git a/test/language/statements/class/definition/early-errors-methods-async-generators-yield-expression-in-params.js b/test/language/statements/class/definition/early-errors-methods-async-generators-yield-expression-in-params.js new file mode 100644 index 00000000000..44e7785d03c --- /dev/null +++ b/test/language/statements/class/definition/early-errors-methods-async-generators-yield-expression-in-params.js @@ -0,0 +1,12 @@ +/*--- +author: Nitzan Uziely +esid: pending +description: > + Throws a Syntax Error if UniqueFormalParameters contains YieldExpression +negative: + phase: early + type: SyntaxError +---*/ +class A { + async function* method(yield 1){} +} \ No newline at end of file diff --git a/test/language/statements/class/definition/early-errors-methods-async-generators-yield-in-params.js b/test/language/statements/class/definition/early-errors-methods-async-generators-yield-in-params.js new file mode 100644 index 00000000000..4386a948163 --- /dev/null +++ b/test/language/statements/class/definition/early-errors-methods-async-generators-yield-in-params.js @@ -0,0 +1,13 @@ +/*--- +author: Nitzan Uziely +esid: pending +description: > + AsyncGeneratorMethod throw a SyntaxError if UniqueFormalParameters + contains yield (invalid BindingIdentifier) +negative: + phase: early + type: SyntaxError +---*/ +class A { + async function* method(yield){} +} \ No newline at end of file diff --git a/test/language/statements/class/definition/methods-async-super-call-body.js b/test/language/statements/class/definition/early-errors-methods-async-super-call-body.js similarity index 100% rename from test/language/statements/class/definition/methods-async-super-call-body.js rename to test/language/statements/class/definition/early-errors-methods-async-super-call-body.js diff --git a/test/language/statements/class/definition/methods-async-super-call-param.js b/test/language/statements/class/definition/early-errors-methods-async-super-call-param.js similarity index 100% rename from test/language/statements/class/definition/methods-async-super-call-param.js rename to test/language/statements/class/definition/early-errors-methods-async-super-call-param.js From e7dde0896c074077be00fdc3c4b08ddca9d72a62 Mon Sep 17 00:00:00 2001 From: sasha Date: Fri, 13 Jan 2017 19:41:05 +0200 Subject: [PATCH 10/12] %AsyncGeneratorPrototype%.next.[[Call]] exists (is callable). --- .../AsyncGenerator/AsyncGenerator-next-callable.js | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 test/built-ins/AsyncGenerator/AsyncGenerator-next-callable.js diff --git a/test/built-ins/AsyncGenerator/AsyncGenerator-next-callable.js b/test/built-ins/AsyncGenerator/AsyncGenerator-next-callable.js new file mode 100644 index 00000000000..a0529ef3e3c --- /dev/null +++ b/test/built-ins/AsyncGenerator/AsyncGenerator-next-callable.js @@ -0,0 +1,10 @@ +/*--- + author: Sasha Kruglyak + esid: pending + description: > + %AsyncGeneratorPrototype%.next.[[Call]] exists (is callable) + ---*/ + +async function* foo() { }; +assert("next" in Object.getPrototypeOf(foo())); +foo().next(); \ No newline at end of file From 17c6ab20bc56d4724abccf240483f4d9bb8c4748 Mon Sep 17 00:00:00 2001 From: Kevin Gibbons Date: Wed, 28 Dec 2016 15:16:24 -0700 Subject: [PATCH 11/12] AsyncGenerator Tests --- .gitignore | 1 + .../AsyncGenerator-construct.js | 28 +++++++++++++ .../AsyncGenerator-is-extensible.js | 10 +++++ .../AsyncGenerator-is-subclass.js | 14 +++++++ .../AsyncGenerator/AsyncGenerator-length.js | 13 ++++++ .../AsyncGenerator/AsyncGenerator-name.js | 15 +++++++ .../AsyncGenerator-next-callable.js | 10 +++++ .../AsyncGenerator-prototype.js | 11 +++++ .../AsyncGenerator/AsyncGenerator.js | 8 ++++ .../AsyncGeneratorPrototye-constructor.js | 14 +++++++ .../AsyncGeneratorPrototype-is-extensible.js | 11 +++++ .../exposed-via-constructor-property.js | 8 ++++ .../AsyncGenerator/is-not-a-global.js | 8 ++++ .../prototype-property-toStringTag.js | 15 +++++++ .../line-terminator-normalisation-CR-LF.js | 4 +- .../line-terminator-normalisation-CR.js | 2 +- .../line-terminator-normalisation-LF.js | 2 +- .../Symbol/asyncIterator/cross-realm.js | 15 +++++++ .../Symbol/asyncIterator/name-prop.js | 11 +++++ .../Symbol/asyncIterator/prop-desc.js | 17 ++++++++ test/intl402/NumberFormat/11.1.1_20_c.js | 1 - .../early-errors-expression-NSPL-with-USD.js | 15 +++++++ ...pression-arguments-in-formal-parameters.js | 15 +++++++ ...on-await-as-function-binding-identifier.js | 14 +++++++ ...expression-binding-identifier-arguments.js | 16 ++++++++ ...rors-expression-binding-identifier-eval.js | 16 ++++++++ ...ors-expression-body-contains-super-call.js | 14 +++++++ ...expression-body-contains-super-property.js | 14 +++++++ ...rs-expression-eval-in-formal-parameters.js | 15 +++++++ ...expression-formals-body-duplicate-const.js | 15 +++++++ ...s-expression-formals-body-duplicate-let.js | 15 +++++++ ...-expression-formals-contains-await-expr.js | 14 +++++++ ...rrors-expression-formals-contains-await.js | 15 +++++++ ...-expression-formals-contains-super-call.js | 14 +++++++ ...ression-formals-contains-super-property.js | 14 +++++++ ...-expression-formals-contains-yield-expr.js | 14 +++++++ ...rrors-expression-formals-contains-yield.js | 15 +++++++ ...arly-errors-expression-label-name-await.js | 17 ++++++++ ...arly-errors-expression-label-name-yield.js | 17 ++++++++ ...expression-not-simple-assignment-target.js | 14 +++++++ ...early-errors-expression-parameter-yield.js | 14 +++++++ ...on-yield-as-function-binding-identifier.js | 14 +++++++ ...ors-expression-yield-star-after-newline.js | 17 ++++++++ ...errors-next-receiver-not-async-iterator.js | 15 +++++++ .../expression-await-as-yield-operand.js | 24 +++++++++++ ...pression-await-promise-as-yield-operand.js | 26 ++++++++++++ ...ression-await-thenable-as-yield-operand.js | 30 ++++++++++++++ .../expression-yield-as-operand.js | 31 ++++++++++++++ .../expression-yield-as-statement.js | 41 +++++++++++++++++++ .../expression-yield-newline.js | 26 ++++++++++++ .../expression-yield-star-before-newline.js | 20 +++++++++ .../namespace/Symbol.toStringTag.js | 4 +- .../internals/get-own-property-sym.js | 2 +- ...-yield-nested-async-function-expression.js | 16 ++++++++ ...on-parameters-contains-await-expression.js | 13 ++++++ ...r-declaration-parameters-contains-await.js | 13 ++++++ ...laration-parameters-contains-super-call.js | 13 ++++++ ...tion-parameters-contains-super-property.js | 13 ++++++ ...ains-yield-nested-generator-declaration.js | 18 ++++++++ ...tains-yield-nested-generator-expression.js | 16 ++++++++ ...-contains-yield-nested-generator-method.js | 18 ++++++++ ...r-declaration-parameters-contains-yield.js | 13 ++++++ ...calaration-body-contains-super-property.js | 13 ++++++ ...rs-declaration-body-contains-super-call.js | 13 ++++++ ...on-parameters-contains-yield-expression.js | 13 ++++++ ...c-generators-await-expression-in-params.js | 12 ++++++ ...ethods-async-generators-await-in-params.js | 13 ++++++ ...ync-generators-duplicate-entries-params.js | 12 ++++++ ...ethods-async-generators-super-call-body.js | 13 ++++++ ...thods-async-generators-super-call-param.js | 13 ++++++ ...c-generators-yield-expression-in-params.js | 12 ++++++ ...ethods-async-generators-yield-in-params.js | 13 ++++++ ...y-errors-methods-async-super-call-body.js} | 0 ...-errors-methods-async-super-call-param.js} | 0 ...tion-null-proto-missing-return-override.js | 2 +- 75 files changed, 1018 insertions(+), 9 deletions(-) create mode 100644 test/built-ins/AsyncGenerator/AsyncGenerator-construct.js create mode 100644 test/built-ins/AsyncGenerator/AsyncGenerator-is-extensible.js create mode 100644 test/built-ins/AsyncGenerator/AsyncGenerator-is-subclass.js create mode 100644 test/built-ins/AsyncGenerator/AsyncGenerator-length.js create mode 100644 test/built-ins/AsyncGenerator/AsyncGenerator-name.js create mode 100644 test/built-ins/AsyncGenerator/AsyncGenerator-next-callable.js create mode 100644 test/built-ins/AsyncGenerator/AsyncGenerator-prototype.js create mode 100644 test/built-ins/AsyncGenerator/AsyncGenerator.js create mode 100644 test/built-ins/AsyncGenerator/AsyncGeneratorPrototye-constructor.js create mode 100644 test/built-ins/AsyncGenerator/AsyncGeneratorPrototype-is-extensible.js create mode 100644 test/built-ins/AsyncGenerator/exposed-via-constructor-property.js create mode 100644 test/built-ins/AsyncGenerator/is-not-a-global.js create mode 100644 test/built-ins/AsyncGenerator/prototype-property-toStringTag.js create mode 100644 test/built-ins/Symbol/asyncIterator/cross-realm.js create mode 100644 test/built-ins/Symbol/asyncIterator/name-prop.js create mode 100644 test/built-ins/Symbol/asyncIterator/prop-desc.js create mode 100644 test/language/expressions/async-generators/early-errors-expression-NSPL-with-USD.js create mode 100644 test/language/expressions/async-generators/early-errors-expression-arguments-in-formal-parameters.js create mode 100644 test/language/expressions/async-generators/early-errors-expression-await-as-function-binding-identifier.js create mode 100644 test/language/expressions/async-generators/early-errors-expression-binding-identifier-arguments.js create mode 100644 test/language/expressions/async-generators/early-errors-expression-binding-identifier-eval.js create mode 100644 test/language/expressions/async-generators/early-errors-expression-body-contains-super-call.js create mode 100644 test/language/expressions/async-generators/early-errors-expression-body-contains-super-property.js create mode 100644 test/language/expressions/async-generators/early-errors-expression-eval-in-formal-parameters.js create mode 100644 test/language/expressions/async-generators/early-errors-expression-formals-body-duplicate-const.js create mode 100644 test/language/expressions/async-generators/early-errors-expression-formals-body-duplicate-let.js create mode 100644 test/language/expressions/async-generators/early-errors-expression-formals-contains-await-expr.js create mode 100644 test/language/expressions/async-generators/early-errors-expression-formals-contains-await.js create mode 100644 test/language/expressions/async-generators/early-errors-expression-formals-contains-super-call.js create mode 100644 test/language/expressions/async-generators/early-errors-expression-formals-contains-super-property.js create mode 100644 test/language/expressions/async-generators/early-errors-expression-formals-contains-yield-expr.js create mode 100644 test/language/expressions/async-generators/early-errors-expression-formals-contains-yield.js create mode 100644 test/language/expressions/async-generators/early-errors-expression-label-name-await.js create mode 100644 test/language/expressions/async-generators/early-errors-expression-label-name-yield.js create mode 100644 test/language/expressions/async-generators/early-errors-expression-not-simple-assignment-target.js create mode 100644 test/language/expressions/async-generators/early-errors-expression-parameter-yield.js create mode 100644 test/language/expressions/async-generators/early-errors-expression-yield-as-function-binding-identifier.js create mode 100644 test/language/expressions/async-generators/early-errors-expression-yield-star-after-newline.js create mode 100644 test/language/expressions/async-generators/early-errors-next-receiver-not-async-iterator.js create mode 100644 test/language/expressions/async-generators/expression-await-as-yield-operand.js create mode 100644 test/language/expressions/async-generators/expression-await-promise-as-yield-operand.js create mode 100644 test/language/expressions/async-generators/expression-await-thenable-as-yield-operand.js create mode 100644 test/language/expressions/async-generators/expression-yield-as-operand.js create mode 100644 test/language/expressions/async-generators/expression-yield-as-statement.js create mode 100644 test/language/expressions/async-generators/expression-yield-newline.js create mode 100644 test/language/expressions/async-generators/expression-yield-star-before-newline.js create mode 100644 test/language/statements/async-function/early-error-declaration-parameters-contains-yield-nested-async-function-expression.js create mode 100644 test/language/statements/async-generator/early-error-declaration-parameters-contains-await-expression.js create mode 100644 test/language/statements/async-generator/early-error-declaration-parameters-contains-await.js create mode 100644 test/language/statements/async-generator/early-error-declaration-parameters-contains-super-call.js create mode 100644 test/language/statements/async-generator/early-error-declaration-parameters-contains-super-property.js create mode 100644 test/language/statements/async-generator/early-error-declaration-parameters-contains-yield-nested-generator-declaration.js create mode 100644 test/language/statements/async-generator/early-error-declaration-parameters-contains-yield-nested-generator-expression.js create mode 100644 test/language/statements/async-generator/early-error-declaration-parameters-contains-yield-nested-generator-method.js create mode 100644 test/language/statements/async-generator/early-error-declaration-parameters-contains-yield.js create mode 100644 test/language/statements/async-generator/early-errors-decalaration-body-contains-super-property.js create mode 100644 test/language/statements/async-generator/early-errors-declaration-body-contains-super-call.js create mode 100644 test/language/statements/async-generator/early-errors-declaration-parameters-contains-yield-expression.js create mode 100644 test/language/statements/class/definition/early-errors-methods-async-generators-await-expression-in-params.js create mode 100644 test/language/statements/class/definition/early-errors-methods-async-generators-await-in-params.js create mode 100644 test/language/statements/class/definition/early-errors-methods-async-generators-duplicate-entries-params.js create mode 100644 test/language/statements/class/definition/early-errors-methods-async-generators-super-call-body.js create mode 100644 test/language/statements/class/definition/early-errors-methods-async-generators-super-call-param.js create mode 100644 test/language/statements/class/definition/early-errors-methods-async-generators-yield-expression-in-params.js create mode 100644 test/language/statements/class/definition/early-errors-methods-async-generators-yield-in-params.js rename test/language/statements/class/definition/{methods-async-super-call-body.js => early-errors-methods-async-super-call-body.js} (100%) rename test/language/statements/class/definition/{methods-async-super-call-param.js => early-errors-methods-async-super-call-param.js} (100%) diff --git a/.gitignore b/.gitignore index 1203b32d2ea..bb6ea389254 100644 --- a/.gitignore +++ b/.gitignore @@ -3,3 +3,4 @@ *~ *.pyc console/TestCases +.idea \ No newline at end of file diff --git a/test/built-ins/AsyncGenerator/AsyncGenerator-construct.js b/test/built-ins/AsyncGenerator/AsyncGenerator-construct.js new file mode 100644 index 00000000000..7e52d6f9ac7 --- /dev/null +++ b/test/built-ins/AsyncGenerator/AsyncGenerator-construct.js @@ -0,0 +1,28 @@ +/*--- +author: Benjamin Gruenbaum +esid: pending +description: > + %AsyncGeneratorProrotype% creates functions with or without new and handles arguments + similarly to functions. +---*/ + +var AsyncGeneratorProrotype = async function* foo() { }.constructor; +var fn; + +fn = AsyncGeneratorProrotype("a", "await 1;"); +assert.sameValue(fn.length, 1, "length with 1 argument, call"); + +fn = AsyncGeneratorProrotype("a,b", "await 1;"); +assert.sameValue(fn.length, 2, "length with 2 arguments in one, call"); + +fn = AsyncGeneratorProrotype("a", "b", "await 1;"); +assert.sameValue(fn.length, 2, "length with 2 arguments, call"); + +fn = new AsyncGeneratorProrotype("a", "await 1;"); +assert.sameValue(fn.length, 1, "length with 1 argument, construct"); + +fn = new AsyncGeneratorProrotype("a,b", "await 1;"); +assert.sameValue(fn.length, 2, "length with 2 arguments in one, construct"); + +fn = new AsyncGeneratorProrotype("a", "b", "await 1;"); +assert.sameValue(fn.length, 2, "length with 2 arguments, construct"); diff --git a/test/built-ins/AsyncGenerator/AsyncGenerator-is-extensible.js b/test/built-ins/AsyncGenerator/AsyncGenerator-is-extensible.js new file mode 100644 index 00000000000..c8c1827ad3e --- /dev/null +++ b/test/built-ins/AsyncGenerator/AsyncGenerator-is-extensible.js @@ -0,0 +1,10 @@ +/*--- +author: Benjamin Gruenbaum +esid: pending +description: > + %AsyncGeneratorFunction% is extensible +---*/ + +var AsyncGeneratorFunction = async function*() { }.constructor; +AsyncGeneratorFunction.x = 1; +assert.sameValue(AsyncGeneratorFunction.x, 1); diff --git a/test/built-ins/AsyncGenerator/AsyncGenerator-is-subclass.js b/test/built-ins/AsyncGenerator/AsyncGenerator-is-subclass.js new file mode 100644 index 00000000000..a60da2aad15 --- /dev/null +++ b/test/built-ins/AsyncGenerator/AsyncGenerator-is-subclass.js @@ -0,0 +1,14 @@ +/*--- +author: Benjamin Gruenbaum +esid: pending +description: > + %AsyncGeneratorFunction% is a subclass of Function + (The AsyncGeneratorFunction constructor is a standard built-in + function object that inherits from the Function constructor. ) +---*/ +async function* foo() { }; +var AsyncGeneratorFunction = foo.constructor; +assert.sameValue(Object.getPrototypeOf(AsyncGeneratorFunction), Function, "Prototype of constructor is Function"); +assert.sameValue(Object.getPrototypeOf(AsyncGeneratorFunction.prototype), Function.prototype, "Prototype of constructor's prototype is Function.prototype"); +assert(foo instanceof Function, 'async generator instance is instanceof Function'); + diff --git a/test/built-ins/AsyncGenerator/AsyncGenerator-length.js b/test/built-ins/AsyncGenerator/AsyncGenerator-length.js new file mode 100644 index 00000000000..42aa73b41eb --- /dev/null +++ b/test/built-ins/AsyncGenerator/AsyncGenerator-length.js @@ -0,0 +1,13 @@ +/*--- +author: Benjamin Gruenbaum +esid: pending +description: > + %AsyncGeneratorFunction% has a length of 1 with writable false, enumerable false, configurable true. +includes: [propertyHelper.js] +---*/ + +var AsyncGeneratorFunction = async function* foo() { }.constructor; +assert.sameValue(AsyncGeneratorFunction.length, 1); +verifyNotWritable(AsyncGeneratorFunction, 'length'); +verifyNotEnumerable(AsyncGeneratorFunction, 'length'); +verifyConfigurable(AsyncGeneratorFunction, 'length'); diff --git a/test/built-ins/AsyncGenerator/AsyncGenerator-name.js b/test/built-ins/AsyncGenerator/AsyncGenerator-name.js new file mode 100644 index 00000000000..b21cfaa27a6 --- /dev/null +++ b/test/built-ins/AsyncGenerator/AsyncGenerator-name.js @@ -0,0 +1,15 @@ +/*--- +author: Benjamin Gruenbaum +esid: pending +description: > + The value of the name property of + the AsyncGeneratorFunction is "AsyncGeneratorFunction". +includes: [propertyHelper.js] +---*/ + +var AsyncGeneratorFunction = async function* foo() { }.constructor; +assert.sameValue(AsyncGeneratorFunction.name, "AsyncGeneratorFunction"); +verifyNotWritable(AsyncGeneratorFunctionAsyncFunction, "name"); +verifyNotEnumerable(AsyncGeneratorFunction, "name"); +verifyConfigurable(AsyncGeneratorFunction, "name"); + \ No newline at end of file diff --git a/test/built-ins/AsyncGenerator/AsyncGenerator-next-callable.js b/test/built-ins/AsyncGenerator/AsyncGenerator-next-callable.js new file mode 100644 index 00000000000..a0529ef3e3c --- /dev/null +++ b/test/built-ins/AsyncGenerator/AsyncGenerator-next-callable.js @@ -0,0 +1,10 @@ +/*--- + author: Sasha Kruglyak + esid: pending + description: > + %AsyncGeneratorPrototype%.next.[[Call]] exists (is callable) + ---*/ + +async function* foo() { }; +assert("next" in Object.getPrototypeOf(foo())); +foo().next(); \ No newline at end of file diff --git a/test/built-ins/AsyncGenerator/AsyncGenerator-prototype.js b/test/built-ins/AsyncGenerator/AsyncGenerator-prototype.js new file mode 100644 index 00000000000..c39408850b8 --- /dev/null +++ b/test/built-ins/AsyncGenerator/AsyncGenerator-prototype.js @@ -0,0 +1,11 @@ +/*--- +author: Benjamin Gruenbaum +esid: pending +description: AsyncGeneratorFunction has a prototype property with writable false, enumerable false, configurable false. +includes: [propertyHelper.js] +---*/ + +var AsyncGeneratorFunction = async function* foo() { }.constructor; +verifyNotConfigurable(AsyncGeneratorFunction, 'prototype'); +verifyNotWritable(AsyncGeneratorFunction, 'prototype'); +verifyNotEnumerable(AsyncGeneratorFunctionAsyncFunction, 'prototype'); diff --git a/test/built-ins/AsyncGenerator/AsyncGenerator.js b/test/built-ins/AsyncGenerator/AsyncGenerator.js new file mode 100644 index 00000000000..80fc91a332a --- /dev/null +++ b/test/built-ins/AsyncGenerator/AsyncGenerator.js @@ -0,0 +1,8 @@ +/*--- +author: Benjamin Gruenbaum +description: > + %AsyncGeneratorPrototype% exists and is a function +---*/ + +var AsyncGeneratorFunction = async function* foo() { }.constructor; +assert.sameValue(typeof AsyncGeneratorFunction, "function"); diff --git a/test/built-ins/AsyncGenerator/AsyncGeneratorPrototye-constructor.js b/test/built-ins/AsyncGenerator/AsyncGeneratorPrototye-constructor.js new file mode 100644 index 00000000000..2b23da826fc --- /dev/null +++ b/test/built-ins/AsyncGenerator/AsyncGeneratorPrototye-constructor.js @@ -0,0 +1,14 @@ +/*--- +author: Sakthipriyan Vairamani (thefourtheye) +description: Check if %AsyncGeneratorFunction% function's `prototype` + object's `constructor` property is %AsyncGeneratorFunction% + itself +---*/ + +const AsyncGeneratorFunction = async function* () {}.constructor; +const AGFPrototype = AsyncGeneratorFunction.prototype; +assert.sameValue(AGFPrototype.constructor, AsyncGeneratorFunction); + +verifyNotEnumerable(AGFPrototype, 'constructor'); +verifyNotWritable(AGFPrototype, 'constructor'); +verifyConfigurable(AGFPrototype, 'constructor'); \ No newline at end of file diff --git a/test/built-ins/AsyncGenerator/AsyncGeneratorPrototype-is-extensible.js b/test/built-ins/AsyncGenerator/AsyncGeneratorPrototype-is-extensible.js new file mode 100644 index 00000000000..a30bb67447e --- /dev/null +++ b/test/built-ins/AsyncGenerator/AsyncGeneratorPrototype-is-extensible.js @@ -0,0 +1,11 @@ +/*--- +author: Benjamin Gruenbaum +esid: pending +description: > + %AsyncGeneratorPrototype% has a [[Extensible]] of true +---*/ + +var AsyncGeneratorFunction = async function* foo() { }.constructor; +AsyncGeneratorFunction.prototype.x = 1; +assert.sameValue(AsyncGeneratorFunction.prototype.x, 1); + diff --git a/test/built-ins/AsyncGenerator/exposed-via-constructor-property.js b/test/built-ins/AsyncGenerator/exposed-via-constructor-property.js new file mode 100644 index 00000000000..4ca32f6753b --- /dev/null +++ b/test/built-ins/AsyncGenerator/exposed-via-constructor-property.js @@ -0,0 +1,8 @@ +/*--- +author: Sakthipriyan Vairamani (thefourtheye) +description: Make sure %AsyncGeneratorFunction% is exposed via the + `.constructor` property. +---*/ + +const AsyncGeneratorFunction = async function* () {}.constructor; +assert.sameValue(typeof AsyncGeneratorFunction, 'function'); \ No newline at end of file diff --git a/test/built-ins/AsyncGenerator/is-not-a-global.js b/test/built-ins/AsyncGenerator/is-not-a-global.js new file mode 100644 index 00000000000..99ef5fda89a --- /dev/null +++ b/test/built-ins/AsyncGenerator/is-not-a-global.js @@ -0,0 +1,8 @@ +/*--- +author: Sakthipriyan Vairamani (thefourtheye) +description: Make sure %AsyncGeneratorFunction% is not a global function +---*/ + +assert.throws(ReferenceError, function() { + AsyncGeneratorFunction +}, 'AsyncGeneratorFunction should not be available in global scope'); \ No newline at end of file diff --git a/test/built-ins/AsyncGenerator/prototype-property-toStringTag.js b/test/built-ins/AsyncGenerator/prototype-property-toStringTag.js new file mode 100644 index 00000000000..a1bb7a0adb8 --- /dev/null +++ b/test/built-ins/AsyncGenerator/prototype-property-toStringTag.js @@ -0,0 +1,15 @@ +/*--- +author: Sakthipriyan Vairamani (thefourtheye) +description: Check if %AsyncGeneratorFunction% function's `prototype` + object's `Symbol.toStringTag` property is + 'AsyncGeneratorFunction' +---*/ + +const AsyncGeneratorFunction = async function* () {}.constructor; +const AGFPrototype = AsyncGeneratorFunction.prototype; + +assert.sameValue(AGFPrototype[Symbol.toStringTag], 'AsyncGeneratorFunction'); + +verifyNotEnumerable(AGFPrototype, Symbol.toStringTag); +verifyNotWritable(AGFPrototype, Symbol.toStringTag); +verifyConfigurable(AGFPrototype, Symbol.toStringTag); \ No newline at end of file diff --git a/test/built-ins/Function/prototype/toString/line-terminator-normalisation-CR-LF.js b/test/built-ins/Function/prototype/toString/line-terminator-normalisation-CR-LF.js index 4ba923e2c56..4c30dbed157 100644 --- a/test/built-ins/Function/prototype/toString/line-terminator-normalisation-CR-LF.js +++ b/test/built-ins/Function/prototype/toString/line-terminator-normalisation-CR-LF.js @@ -5,7 +5,7 @@ esid: sec-function-definitions-runtime-semantics-instantiatefunctionobject description: Function.prototype.toString line terminator normalisation (CR-LF) info: > - Function.prototype.toString should normalise line terminator sequences to Line Feed characters. + Function.prototype.toString should not normalise line terminator sequences to Line Feed characters. This file uses (Carriage Return, Line Feed) sequences as line terminators. ---*/ @@ -33,4 +33,4 @@ y } // after -assert.sameValue(f.toString(), "function\n// a\nf\n// b\n(\n// c\nx\n// d\n,\n// e\ny\n// f\n)\n// g\n{\n// h\n;\n// i\n;\n// j\n}"); +assert.sameValue(f.toString(), "function\r\n// a\r\nf\r\n// b\r\n(\r\n// c\r\nx\r\n// d\r\n,\r\n// e\r\ny\r\n// f\r\n)\r\n// g\r\n{\r\n// h\r\n;\r\n// i\r\n;\r\n// j\r\n}"); diff --git a/test/built-ins/Function/prototype/toString/line-terminator-normalisation-CR.js b/test/built-ins/Function/prototype/toString/line-terminator-normalisation-CR.js index c5ac0826286..8fdcda43546 100644 --- a/test/built-ins/Function/prototype/toString/line-terminator-normalisation-CR.js +++ b/test/built-ins/Function/prototype/toString/line-terminator-normalisation-CR.js @@ -1 +1 @@ -// Copyright (C) 2016 Michael Ficarra. All rights reserved. // This code is governed by the BSD license found in the LICENSE file. /*--- esid: sec-function-definitions-runtime-semantics-instantiatefunctionobject description: Function.prototype.toString line terminator normalisation (CR) info: > Function.prototype.toString should normalise line terminator sequences to Line Feed characters. This file uses Carriage Return characters as line terminators. ---*/ // before function // a f // b ( // c x // d , // e y // f ) // g { // h ; // i ; // j } // after assert.sameValue(f.toString(), "function\n// a\nf\n// b\n(\n// c\nx\n// d\n,\n// e\ny\n// f\n)\n// g\n{\n// h\n;\n// i\n;\n// j\n}"); \ No newline at end of file +// Copyright (C) 2016 Michael Ficarra. All rights reserved. // This code is governed by the BSD license found in the LICENSE file. /*--- esid: sec-function-definitions-runtime-semantics-instantiatefunctionobject description: Function.prototype.toString line terminator normalisation (CR) info: > Function.prototype.toString should not normalise line terminator sequences to Line Feed characters. This file uses Carriage Return characters as line terminators. ---*/ // before function // a f // b ( // c x // d , // e y // f ) // g { // h ; // i ; // j } // after assert.sameValue(f.toString(), "function\r// a\rf\r// b\r(\r// c\rx\r// d\r,\r// e\ry\r// f\r)\r// g\r{\r// h\r;\r// i\r;\r// j\r}"); diff --git a/test/built-ins/Function/prototype/toString/line-terminator-normalisation-LF.js b/test/built-ins/Function/prototype/toString/line-terminator-normalisation-LF.js index 1984e451ad1..42e31e61b82 100644 --- a/test/built-ins/Function/prototype/toString/line-terminator-normalisation-LF.js +++ b/test/built-ins/Function/prototype/toString/line-terminator-normalisation-LF.js @@ -5,7 +5,7 @@ esid: sec-function-definitions-runtime-semantics-instantiatefunctionobject description: Function.prototype.toString line terminator normalisation (LF) info: > - Function.prototype.toString should normalise line terminator sequences to Line Feed characters. + Function.prototype.toString should not normalise line terminator sequences to Line Feed characters. This file uses Line Feed characters as line terminators. ---*/ diff --git a/test/built-ins/Symbol/asyncIterator/cross-realm.js b/test/built-ins/Symbol/asyncIterator/cross-realm.js new file mode 100644 index 00000000000..ceccf50f9a9 --- /dev/null +++ b/test/built-ins/Symbol/asyncIterator/cross-realm.js @@ -0,0 +1,15 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +author: Benjamin Gruenbaum +esid: early +description: Value shared by all realms +info: > + Unless otherwise specified, well-known symbols values are shared by all + realms. +features: [Symbol.asyncIterator] +---*/ + +var otherRealmSymbol = $.createRealm().global.Symbol; + +assert.sameValue(Symbol.asyncIterator, otherRealmSymbol.asyncIterator); diff --git a/test/built-ins/Symbol/asyncIterator/name-prop.js b/test/built-ins/Symbol/asyncIterator/name-prop.js new file mode 100644 index 00000000000..f8e3ba29916 --- /dev/null +++ b/test/built-ins/Symbol/asyncIterator/name-prop.js @@ -0,0 +1,11 @@ +/*--- +author: Benjamin Gruenbaum +esid: early +description: Name prop of Symbol.asyncIterator +info: > + The value of the name property of this function is "[Symbol.asyncIterator]". +features: [Symbol.asyncIterator] +---*/ + + +assert.sameValue(Symbol.asyncIterator.name, '[Symbol.asyncIterator]'); diff --git a/test/built-ins/Symbol/asyncIterator/prop-desc.js b/test/built-ins/Symbol/asyncIterator/prop-desc.js new file mode 100644 index 00000000000..4da5fce2aae --- /dev/null +++ b/test/built-ins/Symbol/asyncIterator/prop-desc.js @@ -0,0 +1,17 @@ +// Copyright (C) 2015-2017 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: early +description: > + `Symbol.asyncIterator` property descriptor +info: > + This property has the attributes { [[Writable]]: false, [[Enumerable]]: + false, [[Configurable]]: false }. +includes: [propertyHelper.js] +features: [Symbol.asyncIterator] +---*/ + +assert.sameValue(typeof Symbol.asyncIterator, 'symbol'); +verifyNotEnumerable(Symbol, 'asyncIterator'); +verifyNotWritable(Symbol, 'asyncIterator'); +verifyNotConfigurable(Symbol, 'asyncIterator'); diff --git a/test/intl402/NumberFormat/11.1.1_20_c.js b/test/intl402/NumberFormat/11.1.1_20_c.js index 3445298f569..fedd94b0019 100644 --- a/test/intl402/NumberFormat/11.1.1_20_c.js +++ b/test/intl402/NumberFormat/11.1.1_20_c.js @@ -36,7 +36,6 @@ var currencyDigits = { BSD: 2, BTN: 2, BWP: 2, - BYR: 0, BZD: 2, CAD: 2, CDF: 2, diff --git a/test/language/expressions/async-generators/early-errors-expression-NSPL-with-USD.js b/test/language/expressions/async-generators/early-errors-expression-NSPL-with-USD.js new file mode 100644 index 00000000000..b887c2ce270 --- /dev/null +++ b/test/language/expressions/async-generators/early-errors-expression-NSPL-with-USD.js @@ -0,0 +1,15 @@ +// Copyright 2017 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +author: Caitlin Potter +esid: pending +description: > + It is a Syntax Error if ContainsUseStrict of AsyncGeneratorBody is true and + IsSimpleParameterList of UniqueFormalParameters is false. +negative: + phase: early + type: SyntaxError +---*/ + +(async function*(x = 1) {"use strict"}); diff --git a/test/language/expressions/async-generators/early-errors-expression-arguments-in-formal-parameters.js b/test/language/expressions/async-generators/early-errors-expression-arguments-in-formal-parameters.js new file mode 100644 index 00000000000..69e5026b854 --- /dev/null +++ b/test/language/expressions/async-generators/early-errors-expression-arguments-in-formal-parameters.js @@ -0,0 +1,15 @@ +// Copyright 2017 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +author: Caitlin Potter +esid: pending +description: > + It is a SyntaxError if FormalParameters contains arguments in strict mode. +negative: + phase: early + type: SyntaxError +flags: [onlyStrict] +---*/ + +(async function*(arguments) { }); diff --git a/test/language/expressions/async-generators/early-errors-expression-await-as-function-binding-identifier.js b/test/language/expressions/async-generators/early-errors-expression-await-as-function-binding-identifier.js new file mode 100644 index 00000000000..0b02630356d --- /dev/null +++ b/test/language/expressions/async-generators/early-errors-expression-await-as-function-binding-identifier.js @@ -0,0 +1,14 @@ +// Copyright 2017 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +author: Caitlin Potter +esid: 12.1.1 +description: > + `await` is not a valid BindingIdentifier for AsyncGeneratorExpressions. +negative: + phase: early + type: SyntaxError +---*/ + +(async function* await() { }); diff --git a/test/language/expressions/async-generators/early-errors-expression-binding-identifier-arguments.js b/test/language/expressions/async-generators/early-errors-expression-binding-identifier-arguments.js new file mode 100644 index 00000000000..85617538a4e --- /dev/null +++ b/test/language/expressions/async-generators/early-errors-expression-binding-identifier-arguments.js @@ -0,0 +1,16 @@ +// Copyright 2017 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +author: Caitlin Potter +esid: pending +description: > + If the source code matching this production is strict code, it is a + Syntax Error if BindingIdentifier is the IdentifierName arguments. +negative: + phase: early + type: SyntaxError +flags: [onlyStrict] +---*/ + +(async function* arguments() { }); diff --git a/test/language/expressions/async-generators/early-errors-expression-binding-identifier-eval.js b/test/language/expressions/async-generators/early-errors-expression-binding-identifier-eval.js new file mode 100644 index 00000000000..79474a644f8 --- /dev/null +++ b/test/language/expressions/async-generators/early-errors-expression-binding-identifier-eval.js @@ -0,0 +1,16 @@ +// Copyright 2017 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +author: Caitlin Potter +esid: pending +description: > + If the source code matching this production is strict code, it is a + Syntax Error if BindingIdentifier is the IdentifierName eval. +negative: + phase: early + type: SyntaxError +flags: [onlyStrict] +---*/ + +(async function* eval() { }); diff --git a/test/language/expressions/async-generators/early-errors-expression-body-contains-super-call.js b/test/language/expressions/async-generators/early-errors-expression-body-contains-super-call.js new file mode 100644 index 00000000000..bca6ed5d716 --- /dev/null +++ b/test/language/expressions/async-generators/early-errors-expression-body-contains-super-call.js @@ -0,0 +1,14 @@ +// Copyright 2017 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +author: Caitlin Potter +esid: pending +description: > + It is a syntax error if AsyncGeneratorBody contains SuperCall is true. +negative: + phase: early + type: SyntaxError +---*/ + +(async function*() { super(); }); diff --git a/test/language/expressions/async-generators/early-errors-expression-body-contains-super-property.js b/test/language/expressions/async-generators/early-errors-expression-body-contains-super-property.js new file mode 100644 index 00000000000..794125f52e4 --- /dev/null +++ b/test/language/expressions/async-generators/early-errors-expression-body-contains-super-property.js @@ -0,0 +1,14 @@ +// Copyright 2017 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +author: Caitlin Potter +esid: pending +description: > + It is a syntax error if AsyncGeneratorBody contains SuperProperty is true. +negative: + phase: early + type: SyntaxError +---*/ + +(async function*() { super.prop; }); diff --git a/test/language/expressions/async-generators/early-errors-expression-eval-in-formal-parameters.js b/test/language/expressions/async-generators/early-errors-expression-eval-in-formal-parameters.js new file mode 100644 index 00000000000..c87c23b6770 --- /dev/null +++ b/test/language/expressions/async-generators/early-errors-expression-eval-in-formal-parameters.js @@ -0,0 +1,15 @@ +// Copyright 2017 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +author: Caitlin Potter +esid: pending +description: > + It is a SyntaxError if FormalParameters contains eval in strict mode. +negative: + phase: early + type: SyntaxError +flags: [onlyStrict] +---*/ + +(async function*(eval) { }); diff --git a/test/language/expressions/async-generators/early-errors-expression-formals-body-duplicate-const.js b/test/language/expressions/async-generators/early-errors-expression-formals-body-duplicate-const.js new file mode 100644 index 00000000000..53e3a2365a6 --- /dev/null +++ b/test/language/expressions/async-generators/early-errors-expression-formals-body-duplicate-const.js @@ -0,0 +1,15 @@ +// Copyright 2017 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +author: Caitlin Potter +esid: pending +description: > + It is a SyntaxError if BoundNames of FormalParameters also occurs in the + LexicallyDeclaredNames of AsyncFunctionBody +negative: + phase: early + type: SyntaxError +---*/ + +(async function*(a) { const a = 0; }); diff --git a/test/language/expressions/async-generators/early-errors-expression-formals-body-duplicate-let.js b/test/language/expressions/async-generators/early-errors-expression-formals-body-duplicate-let.js new file mode 100644 index 00000000000..593d4325d53 --- /dev/null +++ b/test/language/expressions/async-generators/early-errors-expression-formals-body-duplicate-let.js @@ -0,0 +1,15 @@ +// Copyright 2017 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +author: Caitlin Potter +esid: pending +description: > + It is a SyntaxError if BoundNames of FormalParameters also occurs in the + LexicallyDeclaredNames of AsyncFunctionBody +negative: + phase: early + type: SyntaxError +---*/ + +(async function*(a) { let a; }); diff --git a/test/language/expressions/async-generators/early-errors-expression-formals-contains-await-expr.js b/test/language/expressions/async-generators/early-errors-expression-formals-contains-await-expr.js new file mode 100644 index 00000000000..1c94b75fc2a --- /dev/null +++ b/test/language/expressions/async-generators/early-errors-expression-formals-contains-await-expr.js @@ -0,0 +1,14 @@ +// Copyright 2017 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +author: Caitlin Potter +esid: pending +description: > + It is a Syntax Error if FormalParameters Contains AwaitExpression is true. +negative: + phase: early + type: SyntaxError +---*/ + +(async function*(x = await 1) { }); diff --git a/test/language/expressions/async-generators/early-errors-expression-formals-contains-await.js b/test/language/expressions/async-generators/early-errors-expression-formals-contains-await.js new file mode 100644 index 00000000000..bd038d0fe23 --- /dev/null +++ b/test/language/expressions/async-generators/early-errors-expression-formals-contains-await.js @@ -0,0 +1,15 @@ +// Copyright 2017 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +author: Caitlin Potter +esid: 12.1 +description: > + `await` is a reserved keyword within async generator function bodies and may + not be used as the binding identifier of a parameter. +negative: + phase: early + type: SyntaxError +---*/ + +(async function*(await) { }); diff --git a/test/language/expressions/async-generators/early-errors-expression-formals-contains-super-call.js b/test/language/expressions/async-generators/early-errors-expression-formals-contains-super-call.js new file mode 100644 index 00000000000..c25c59d2b81 --- /dev/null +++ b/test/language/expressions/async-generators/early-errors-expression-formals-contains-super-call.js @@ -0,0 +1,14 @@ +// Copyright 2017 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +author: Caitlin Potter +esid: pending +description: > + It is a syntax error if FormalParameters contains SuperCall is true. +negative: + phase: early + type: SyntaxError +---*/ + +(async function*(a = super()) { }); diff --git a/test/language/expressions/async-generators/early-errors-expression-formals-contains-super-property.js b/test/language/expressions/async-generators/early-errors-expression-formals-contains-super-property.js new file mode 100644 index 00000000000..a162eb58ec5 --- /dev/null +++ b/test/language/expressions/async-generators/early-errors-expression-formals-contains-super-property.js @@ -0,0 +1,14 @@ +// Copyright 2017 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +author: Caitlin Potter +esid: pending +description: > + It is a syntax error if FormalParameters contains SuperProperty is true. +negative: + phase: early + type: SyntaxError +---*/ + +(async function*(a = super.prop { }); diff --git a/test/language/expressions/async-generators/early-errors-expression-formals-contains-yield-expr.js b/test/language/expressions/async-generators/early-errors-expression-formals-contains-yield-expr.js new file mode 100644 index 00000000000..828f5a57ef7 --- /dev/null +++ b/test/language/expressions/async-generators/early-errors-expression-formals-contains-yield-expr.js @@ -0,0 +1,14 @@ +// Copyright 2017 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +author: Caitlin Potter +esid: pending +description: > + It is a Syntax Error if FormalParameters Contains YieldExpression is true. +negative: + phase: early + type: SyntaxError +---*/ + +(async function*(x = yield) { }); diff --git a/test/language/expressions/async-generators/early-errors-expression-formals-contains-yield.js b/test/language/expressions/async-generators/early-errors-expression-formals-contains-yield.js new file mode 100644 index 00000000000..cbc96a88360 --- /dev/null +++ b/test/language/expressions/async-generators/early-errors-expression-formals-contains-yield.js @@ -0,0 +1,15 @@ +// Copyright 2017 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +author: Caitlin Potter +esid: 12.1 +description: > + `await` is a reserved keyword within async generator function bodies and may + not be used as the binding identifier of a parameter. +negative: + phase: early + type: SyntaxError +---*/ + +(async function*(yield) { }); diff --git a/test/language/expressions/async-generators/early-errors-expression-label-name-await.js b/test/language/expressions/async-generators/early-errors-expression-label-name-await.js new file mode 100644 index 00000000000..050f8961541 --- /dev/null +++ b/test/language/expressions/async-generators/early-errors-expression-label-name-await.js @@ -0,0 +1,17 @@ +// Copyright 2017 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +author: Caitlin Potter +esid: 12.1.1 +description: > + `await` is a reserved keyword within async generator function bodies and may + not be used as a label. +negative: + phase: early + type: SyntaxError +---*/ + +(async function*() { + await: 1; +}); diff --git a/test/language/expressions/async-generators/early-errors-expression-label-name-yield.js b/test/language/expressions/async-generators/early-errors-expression-label-name-yield.js new file mode 100644 index 00000000000..453e33b1b64 --- /dev/null +++ b/test/language/expressions/async-generators/early-errors-expression-label-name-yield.js @@ -0,0 +1,17 @@ +// Copyright 2017 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +author: Caitlin Potter +esid: 12.1.1 +description: > + `yield` is a reserved keyword within async generator function bodies and may + not be used as a label. +negative: + phase: early + type: SyntaxError +---*/ + +(async function*() { + yield: 1; +}); diff --git a/test/language/expressions/async-generators/early-errors-expression-not-simple-assignment-target.js b/test/language/expressions/async-generators/early-errors-expression-not-simple-assignment-target.js new file mode 100644 index 00000000000..900b8277e1c --- /dev/null +++ b/test/language/expressions/async-generators/early-errors-expression-not-simple-assignment-target.js @@ -0,0 +1,14 @@ +// Copyright 2017 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +author: Caitlin Potter +esid: pending +description: > + Async generator function expressions are not a simple assignment target. +negative: + phase: early + type: ReferenceError +---*/ + +(async function*() { } = 1); diff --git a/test/language/expressions/async-generators/early-errors-expression-parameter-yield.js b/test/language/expressions/async-generators/early-errors-expression-parameter-yield.js new file mode 100644 index 00000000000..a2bef65f952 --- /dev/null +++ b/test/language/expressions/async-generators/early-errors-expression-parameter-yield.js @@ -0,0 +1,14 @@ +// Copyright 2017 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +author: Benjamin Gruenbaum +esid: pending +description: > + throw a SyntaxError if UniqueFormalParameters contains yield (invalid BindingIdentifier): +negative: + phase: early + type: SyntaxError +---*/ + +(async function* (yield) {}); \ No newline at end of file diff --git a/test/language/expressions/async-generators/early-errors-expression-yield-as-function-binding-identifier.js b/test/language/expressions/async-generators/early-errors-expression-yield-as-function-binding-identifier.js new file mode 100644 index 00000000000..ec54ee71828 --- /dev/null +++ b/test/language/expressions/async-generators/early-errors-expression-yield-as-function-binding-identifier.js @@ -0,0 +1,14 @@ +// Copyright 2017 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +author: Caitlin Potter +esid: 12.1.1 +description: > + `yield` is not a valid BindingIdentifier for AsyncGeneratorExpressions. +negative: + phase: early + type: SyntaxError +---*/ + +(async function* yield() { }); diff --git a/test/language/expressions/async-generators/early-errors-expression-yield-star-after-newline.js b/test/language/expressions/async-generators/early-errors-expression-yield-star-after-newline.js new file mode 100644 index 00000000000..2d2c83ab07a --- /dev/null +++ b/test/language/expressions/async-generators/early-errors-expression-yield-star-after-newline.js @@ -0,0 +1,17 @@ +// Copyright 2017 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +author: Caitlin Potter +esid: 14.4 +description: > + A newline may not precede the `*` token in a `yield` expression. +negative: + phase: early + type: SyntaxError +---*/ + +(async function*() { + yield + * 1; +}); diff --git a/test/language/expressions/async-generators/early-errors-next-receiver-not-async-iterator.js b/test/language/expressions/async-generators/early-errors-next-receiver-not-async-iterator.js new file mode 100644 index 00000000000..542b6b2993a --- /dev/null +++ b/test/language/expressions/async-generators/early-errors-next-receiver-not-async-iterator.js @@ -0,0 +1,15 @@ +// Copyright 2017 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +author: Benjamin Gruenbaum +esid: pending +description: > + next() rejects with a TypeError when receiver is not an AsyncGenerator instance: +---*/ + +(async function*() {})().next.call((function*() {})()).then(function() { + throw new Test262Error("should not have resolved"); +}, function(err) { + assert(err instanceof TypeError); +}).then($DONE, $DONE); \ No newline at end of file diff --git a/test/language/expressions/async-generators/expression-await-as-yield-operand.js b/test/language/expressions/async-generators/expression-await-as-yield-operand.js new file mode 100644 index 00000000000..cad8157bb7d --- /dev/null +++ b/test/language/expressions/async-generators/expression-await-as-yield-operand.js @@ -0,0 +1,24 @@ +// Copyright 2017 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +author: Caitlin Potter +esid: 14.4 +description: > + AwaitExpressions are valid operands to yield expressions. +flags: [async] +---*/ + +var iter = (async function*() { + yield await "a"; +})(); + +iter.next().then(function(result) { + assert.sameValue(result.value, "a", 'First result `value`'); + assert.sameValue(result.done, false, 'First result `done` flag'); +}).then(undefined, $DONE); + +iter.next().then(function(result) { + assert.sameValue(result.value, undefined, 'Second result `value`'); + assert.sameValue(result.done, true, 'Second result `done` flag'); +}).then($DONE, $DONE); diff --git a/test/language/expressions/async-generators/expression-await-promise-as-yield-operand.js b/test/language/expressions/async-generators/expression-await-promise-as-yield-operand.js new file mode 100644 index 00000000000..8f345472be7 --- /dev/null +++ b/test/language/expressions/async-generators/expression-await-promise-as-yield-operand.js @@ -0,0 +1,26 @@ +// Copyright 2017 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +author: Caitlin Potter +esid: 14.4 +description: > + AwaitExpressions are valid operands to yield expressions. +flags: [async] +---*/ + +var iter = (async function*() { + yield await new Promise(function(resolve) { + resolve("a"); + }); +})(); + +iter.next().then(function(result) { + assert.sameValue(result.value, "a", 'First result `value`'); + assert.sameValue(result.done, false, 'First result `done` flag'); +}).then(undefined, $DONE); + +iter.next().then(function(result) { + assert.sameValue(result.value, undefined, 'Second result `value`'); + assert.sameValue(result.done, true, 'Second result `done` flag'); +}).then($DONE, $DONE); diff --git a/test/language/expressions/async-generators/expression-await-thenable-as-yield-operand.js b/test/language/expressions/async-generators/expression-await-thenable-as-yield-operand.js new file mode 100644 index 00000000000..c436a94172a --- /dev/null +++ b/test/language/expressions/async-generators/expression-await-thenable-as-yield-operand.js @@ -0,0 +1,30 @@ +// Copyright 2017 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +author: Caitlin Potter +esid: 14.4 +description: > + AwaitExpressions are valid operands to yield expressions. +flags: [async] +---*/ + +var thenable = { + then: function(resolve, reject) { + resolve("a"); + } +}; + +var iter = (async function*() { + yield await thenable; +})(); + +iter.next().then(function(result) { + assert.sameValue(result.value, "a", 'First result `value`'); + assert.sameValue(result.done, false, 'First result `done` flag'); +}).then(undefined, $DONE); + +iter.next().then(function(result) { + assert.sameValue(result.value, undefined, 'Second result `value`'); + assert.sameValue(result.done, true, 'Second result `done` flag'); +}).then($DONE, $DONE); diff --git a/test/language/expressions/async-generators/expression-yield-as-operand.js b/test/language/expressions/async-generators/expression-yield-as-operand.js new file mode 100644 index 00000000000..c2a14ffcd38 --- /dev/null +++ b/test/language/expressions/async-generators/expression-yield-as-operand.js @@ -0,0 +1,31 @@ +// Copyright 2017 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +author: Caitlin Potter +esid: 14.4 +description: > + `yield` expressions may be used as the right-hand-side of other `yield` + expressions. +flags: [async] +---*/ + +var g = async function*() { + yield yield 1; +}; + +var iter = g(); +iter.next().then(function(result) { + assert.sameValue(result.value, 1, 'First result `value`'); + assert.sameValue(result.done, false, 'First result `done` flag'); +}).then(undefined, $DONE); + +iter.next().then(function(result) { + assert.sameValue(result.value, undefined, 'Second result `value`'); + assert.sameValue(result.done, false, 'Second result `done` flag'); +}).then(undefined, $DONE); + +iter.next().then(function(result) { + assert.sameValue(result.value, undefined, 'Third result `value`'); + assert.sameValue(result.done, true, 'Thid result `done` flag'); +}).then($DONE, $DONE); diff --git a/test/language/expressions/async-generators/expression-yield-as-statement.js b/test/language/expressions/async-generators/expression-yield-as-statement.js new file mode 100644 index 00000000000..9647c0bb397 --- /dev/null +++ b/test/language/expressions/async-generators/expression-yield-as-statement.js @@ -0,0 +1,41 @@ +// Copyright 2017 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +author: Caitlin Potter +esid: 14.4 +description: > + `yield` is a valid statement within async generator function bodies. +flags: [async] +---*/ + +var g1 = async function*() { yield; }; +var g2 = async function*() { yield 1; }; + +var iter1 = g1(); +iter1.next().then(function(result) { + assert.sameValue( + result.value, undefined, "Without right-hand-side: first result `value`"); + assert.sameValue( + result.done, false, "Without right-hand-side: first result `done` flag"); +}).then(undefined, $DONE); +iter1.next(function(result) { + assert.sameValue( + result.value, undefined, "Without right-hand-side: second result `value`"); + assert.sameValue( + result.done, true, "Without right-hand-side: second result `done` flag"); +}).then(undefined, $DONE); + +var iter2 = g2(); +iter2.next().then(function(result) { + assert.sameValue( + result.value, 1, "With right-hand-side: first result `value`"); + assert.sameValue( + result.done, false, "With right-hand-side: first result `done` flag"); +}).then(undefined, $DONE); +iter2.next(function(result) { + assert.sameValue( + result.value, undefined, "With right-hand-side: second result `value`"); + assert.sameValue( + result.done, true, "With right-hand-side: second result `done` flag"); +}).then($DONE, $DONE); diff --git a/test/language/expressions/async-generators/expression-yield-newline.js b/test/language/expressions/async-generators/expression-yield-newline.js new file mode 100644 index 00000000000..3b183a2b6b4 --- /dev/null +++ b/test/language/expressions/async-generators/expression-yield-newline.js @@ -0,0 +1,26 @@ +// Copyright 2017 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +author: Caitlin Potter +esid: 14.4 +description: > + Newlines terminate `yield` expressions. +flags: [async] +---*/ + +var g = async function*() { + yield + 1; +}; + +var iter = g(); +iter.next().then(function(result) { + assert.sameValue(result.value, undefined, 'First result `value`'); + assert.sameValue(result.done, false, 'First result `done` flag'); +}).then(undefined, $DONE); + +iter.next().then(function(result) { + assert.sameValue(result.value, undefined, 'Second result `value`'); + assert.sameValue(result.done, true, 'Second result `done` flag'); +}).then($DONE, $DONE); diff --git a/test/language/expressions/async-generators/expression-yield-star-before-newline.js b/test/language/expressions/async-generators/expression-yield-star-before-newline.js new file mode 100644 index 00000000000..d22ef2f88f8 --- /dev/null +++ b/test/language/expressions/async-generators/expression-yield-star-before-newline.js @@ -0,0 +1,20 @@ +// Copyright 2017 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +author: Caitlin Potter +esid: 14.4 +description: > + The right-hand side of a `yield *` expression may appear on a new line. +flags: [async] +---*/ + +var g = async function*() {}; + +(async function*() { + yield* + g(); +})().next().then(function(result) { + assert.sameValue(result.value, undefined); + assert.sameValue(result.done, true); +}).then($DONE, $DONE); diff --git a/test/language/module-code/namespace/Symbol.toStringTag.js b/test/language/module-code/namespace/Symbol.toStringTag.js index 7c6bd3bd7c3..290e64a4d5a 100644 --- a/test/language/module-code/namespace/Symbol.toStringTag.js +++ b/test/language/module-code/namespace/Symbol.toStringTag.js @@ -10,7 +10,7 @@ info: > "Module". This property has the attributes { [[Writable]]: false, [[Enumerable]]: - false, [[Configurable]]: true }. + false, [[Configurable]]: false }. flags: [module] features: [Symbol.toStringTag] ---*/ @@ -26,4 +26,4 @@ var desc = Object.getOwnPropertyDescriptor(ns, Symbol.toStringTag); assert.sameValue(desc.enumerable, false, 'reports as non-enumerable'); assert.sameValue(desc.writable, false, 'reports as non-writable'); -assert.sameValue(desc.configurable, true, 'reports as configurable'); +assert.sameValue(desc.configurable, false, 'reports as non-configurable'); diff --git a/test/language/module-code/namespace/internals/get-own-property-sym.js b/test/language/module-code/namespace/internals/get-own-property-sym.js index 40bc9978256..4dca2d28fd4 100644 --- a/test/language/module-code/namespace/internals/get-own-property-sym.js +++ b/test/language/module-code/namespace/internals/get-own-property-sym.js @@ -19,7 +19,7 @@ desc = Object.getOwnPropertyDescriptor(ns, Symbol.toStringTag); assert.sameValue(desc.value, ns[Symbol.toStringTag]); assert.sameValue(desc.enumerable, false, 'Symbol.toStringTag enumerable'); assert.sameValue(desc.writable, false, 'Symbol.toStringTag writable'); -assert.sameValue(desc.configurable, true, 'Symbol.toStringTag configurable'); +assert.sameValue(desc.configurable, false, 'Symbol.toStringTag configurable'); assert.sameValue(Object.prototype.hasOwnProperty.call(ns, notFound), false); desc = Object.getOwnPropertyDescriptor(ns, notFound); diff --git a/test/language/statements/async-function/early-error-declaration-parameters-contains-yield-nested-async-function-expression.js b/test/language/statements/async-function/early-error-declaration-parameters-contains-yield-nested-async-function-expression.js new file mode 100644 index 00000000000..d9d8fa33cf1 --- /dev/null +++ b/test/language/statements/async-function/early-error-declaration-parameters-contains-yield-nested-async-function-expression.js @@ -0,0 +1,16 @@ +// Copyright 2016 Microsoft, Inc. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- + author: Sasha Kruglyak + esid: pending + description: It is a syntax error if BindingIdentifier is "yield" + and function is nested inside AsyncFunctionExpression + negative: + phase: early + type: SyntaxError + ---*/ + +async function() { + async function* foo (yield) { } +} \ No newline at end of file diff --git a/test/language/statements/async-generator/early-error-declaration-parameters-contains-await-expression.js b/test/language/statements/async-generator/early-error-declaration-parameters-contains-await-expression.js new file mode 100644 index 00000000000..986f3c784ca --- /dev/null +++ b/test/language/statements/async-generator/early-error-declaration-parameters-contains-await-expression.js @@ -0,0 +1,13 @@ +// Copyright 2016 Microsoft, Inc. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- + author: Sasha Kruglyak + esid: pending + description: It is a syntax error if FormalParameters contains AwaitExpression + negative: + phase: early + type: SyntaxError + ---*/ + +async function* foo (await 1) { } diff --git a/test/language/statements/async-generator/early-error-declaration-parameters-contains-await.js b/test/language/statements/async-generator/early-error-declaration-parameters-contains-await.js new file mode 100644 index 00000000000..099b921770a --- /dev/null +++ b/test/language/statements/async-generator/early-error-declaration-parameters-contains-await.js @@ -0,0 +1,13 @@ +// Copyright 2016 Microsoft, Inc. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- + author: Sasha Kruglyak + esid: pending + description: It is a syntax error if FormalParameters contains await + negative: + phase: early + type: SyntaxError + ---*/ + +async function* foo (await) { } diff --git a/test/language/statements/async-generator/early-error-declaration-parameters-contains-super-call.js b/test/language/statements/async-generator/early-error-declaration-parameters-contains-super-call.js new file mode 100644 index 00000000000..4180ebbb484 --- /dev/null +++ b/test/language/statements/async-generator/early-error-declaration-parameters-contains-super-call.js @@ -0,0 +1,13 @@ +// Copyright 2016 Microsoft, Inc. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- + author: Sasha Kruglyak + esid: pending + description: It is a syntax error if FormalParameters contains SuperCall + negative: + phase: early + type: SyntaxError + ---*/ + +async function* foo (super()) { } diff --git a/test/language/statements/async-generator/early-error-declaration-parameters-contains-super-property.js b/test/language/statements/async-generator/early-error-declaration-parameters-contains-super-property.js new file mode 100644 index 00000000000..d864a6c4246 --- /dev/null +++ b/test/language/statements/async-generator/early-error-declaration-parameters-contains-super-property.js @@ -0,0 +1,13 @@ +// Copyright 2016 Microsoft, Inc. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- + author: Sasha Kruglyak + esid: pending + description: It is a syntax error if FormalParameters contains SuperProperty + negative: + phase: early + type: SyntaxError + ---*/ + +async function* foo (super) { } diff --git a/test/language/statements/async-generator/early-error-declaration-parameters-contains-yield-nested-generator-declaration.js b/test/language/statements/async-generator/early-error-declaration-parameters-contains-yield-nested-generator-declaration.js new file mode 100644 index 00000000000..bb1acc2b548 --- /dev/null +++ b/test/language/statements/async-generator/early-error-declaration-parameters-contains-yield-nested-generator-declaration.js @@ -0,0 +1,18 @@ +// Copyright 2016 Microsoft, Inc. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- + author: Sasha Kruglyak + esid: pending + description: It is a syntax error if BindingIdentifier is "yield" + and function is nested inside GeneratorDeclaration + negative: + phase: early + type: SyntaxError + ---*/ + +function* boo() { + async function* foo (yield) { } +} + + diff --git a/test/language/statements/async-generator/early-error-declaration-parameters-contains-yield-nested-generator-expression.js b/test/language/statements/async-generator/early-error-declaration-parameters-contains-yield-nested-generator-expression.js new file mode 100644 index 00000000000..dcb4f17ab8b --- /dev/null +++ b/test/language/statements/async-generator/early-error-declaration-parameters-contains-yield-nested-generator-expression.js @@ -0,0 +1,16 @@ +// Copyright 2016 Microsoft, Inc. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- + author: Sasha Kruglyak + esid: pending + description: It is a syntax error if BindingIdentifier is "yield" + and function is nested inside GeneratorExpression + negative: + phase: early + type: SyntaxError + ---*/ + +function*() { + async function* foo (yield) { } +} \ No newline at end of file diff --git a/test/language/statements/async-generator/early-error-declaration-parameters-contains-yield-nested-generator-method.js b/test/language/statements/async-generator/early-error-declaration-parameters-contains-yield-nested-generator-method.js new file mode 100644 index 00000000000..bbd84041775 --- /dev/null +++ b/test/language/statements/async-generator/early-error-declaration-parameters-contains-yield-nested-generator-method.js @@ -0,0 +1,18 @@ +// Copyright 2016 Microsoft, Inc. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- + author: Sasha Kruglyak + esid: pending + description: It is a syntax error if BindingIdentifier is "yield" + and function is nested inside GeneratorMethod + negative: + phase: early + type: SyntaxError + ---*/ + +class A { + *boo() { + async function* foo (yield) { } + } +} \ No newline at end of file diff --git a/test/language/statements/async-generator/early-error-declaration-parameters-contains-yield.js b/test/language/statements/async-generator/early-error-declaration-parameters-contains-yield.js new file mode 100644 index 00000000000..d3143c1a5b6 --- /dev/null +++ b/test/language/statements/async-generator/early-error-declaration-parameters-contains-yield.js @@ -0,0 +1,13 @@ +// Copyright 2016 Microsoft, Inc. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- + author: Sasha Kruglyak + esid: pending + description: It is a syntax error if FormalParameters contains yield + negative: + phase: early + type: SyntaxError + ---*/ + +async function* foo (yield) { } diff --git a/test/language/statements/async-generator/early-errors-decalaration-body-contains-super-property.js b/test/language/statements/async-generator/early-errors-decalaration-body-contains-super-property.js new file mode 100644 index 00000000000..065108573ac --- /dev/null +++ b/test/language/statements/async-generator/early-errors-decalaration-body-contains-super-property.js @@ -0,0 +1,13 @@ +// Copyright 2016 Microsoft, Inc. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- + author: Sasha Kruglyak + esid: pending + description: It is a syntax error if AsyncGeneratorBody contains SuperProperty + negative: + phase: early + type: SyntaxError + ---*/ + +async function* foo () { super.prop; } diff --git a/test/language/statements/async-generator/early-errors-declaration-body-contains-super-call.js b/test/language/statements/async-generator/early-errors-declaration-body-contains-super-call.js new file mode 100644 index 00000000000..ef9fe5f158d --- /dev/null +++ b/test/language/statements/async-generator/early-errors-declaration-body-contains-super-call.js @@ -0,0 +1,13 @@ +// Copyright 2016 Microsoft, Inc. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- + author: Sasha Kruglyak + esid: pending + description: It is a syntax error if AsyncGeneratorBody contains SuperCall + negative: + phase: early + type: SyntaxError + ---*/ + +async function* foo () { super(); } diff --git a/test/language/statements/async-generator/early-errors-declaration-parameters-contains-yield-expression.js b/test/language/statements/async-generator/early-errors-declaration-parameters-contains-yield-expression.js new file mode 100644 index 00000000000..76b08b42e72 --- /dev/null +++ b/test/language/statements/async-generator/early-errors-declaration-parameters-contains-yield-expression.js @@ -0,0 +1,13 @@ +// Copyright 2016 Microsoft, Inc. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- + author: Sasha Kruglyak + esid: pending + description: It is a syntax error if FormalParameters contains YieldExpression + negative: + phase: early + type: SyntaxError + ---*/ + +async function* foo (yield) { } diff --git a/test/language/statements/class/definition/early-errors-methods-async-generators-await-expression-in-params.js b/test/language/statements/class/definition/early-errors-methods-async-generators-await-expression-in-params.js new file mode 100644 index 00000000000..2988d636159 --- /dev/null +++ b/test/language/statements/class/definition/early-errors-methods-async-generators-await-expression-in-params.js @@ -0,0 +1,12 @@ +/*--- +author: Nitzan Uziely +esid: pending +description: > + Throws a Syntax Error if UniqueFormalParameters contains AwaitExpression +negative: + phase: early + type: SyntaxError +---*/ +class A { + async function* method(await 1){} +} \ No newline at end of file diff --git a/test/language/statements/class/definition/early-errors-methods-async-generators-await-in-params.js b/test/language/statements/class/definition/early-errors-methods-async-generators-await-in-params.js new file mode 100644 index 00000000000..f921769939b --- /dev/null +++ b/test/language/statements/class/definition/early-errors-methods-async-generators-await-in-params.js @@ -0,0 +1,13 @@ +/*--- +author: Nitzan Uziely +esid: pending +description: > + AsyncGeneratorMethod throw a SyntaxError if UniqueFormalParameters + contains await (invalid BindingIdentifier) +negative: + phase: early + type: SyntaxError +---*/ +class A { + async function* method(await){} +} \ No newline at end of file diff --git a/test/language/statements/class/definition/early-errors-methods-async-generators-duplicate-entries-params.js b/test/language/statements/class/definition/early-errors-methods-async-generators-duplicate-entries-params.js new file mode 100644 index 00000000000..32f9aa9651f --- /dev/null +++ b/test/language/statements/class/definition/early-errors-methods-async-generators-duplicate-entries-params.js @@ -0,0 +1,12 @@ +/*--- +author: Nitzan Uziely +esid: pending +description: > + AsyncGeneratorMethod throw a SyntaxError if UniqueFormalParameters contains duplicate entries. +negative: + phase: early + type: SyntaxError +---*/ +class A { + async function* method(param,param){} +} \ No newline at end of file diff --git a/test/language/statements/class/definition/early-errors-methods-async-generators-super-call-body.js b/test/language/statements/class/definition/early-errors-methods-async-generators-super-call-body.js new file mode 100644 index 00000000000..05124bcbaa8 --- /dev/null +++ b/test/language/statements/class/definition/early-errors-methods-async-generators-super-call-body.js @@ -0,0 +1,13 @@ +/*--- +author: Nitzan Uziely +esid: pending +description: > + Throws a Syntax Error if HasDirectSuper of AsyncGeneratorMethod is true, + in function body +negative: + phase: early + type: SyntaxError +---*/ +class A { + async function* method(){super();} +} \ No newline at end of file diff --git a/test/language/statements/class/definition/early-errors-methods-async-generators-super-call-param.js b/test/language/statements/class/definition/early-errors-methods-async-generators-super-call-param.js new file mode 100644 index 00000000000..9fa932d763c --- /dev/null +++ b/test/language/statements/class/definition/early-errors-methods-async-generators-super-call-param.js @@ -0,0 +1,13 @@ +/*--- +author: Nitzan Uziely +esid: pending +description: > + Throws a Syntax Error if HasDirectSuper of AsyncGeneratorMethod is true, + in UniqueFormalParameters +negative: + phase: early + type: SyntaxError +---*/ +class A { + async function* method(x = super()){} +} \ No newline at end of file diff --git a/test/language/statements/class/definition/early-errors-methods-async-generators-yield-expression-in-params.js b/test/language/statements/class/definition/early-errors-methods-async-generators-yield-expression-in-params.js new file mode 100644 index 00000000000..44e7785d03c --- /dev/null +++ b/test/language/statements/class/definition/early-errors-methods-async-generators-yield-expression-in-params.js @@ -0,0 +1,12 @@ +/*--- +author: Nitzan Uziely +esid: pending +description: > + Throws a Syntax Error if UniqueFormalParameters contains YieldExpression +negative: + phase: early + type: SyntaxError +---*/ +class A { + async function* method(yield 1){} +} \ No newline at end of file diff --git a/test/language/statements/class/definition/early-errors-methods-async-generators-yield-in-params.js b/test/language/statements/class/definition/early-errors-methods-async-generators-yield-in-params.js new file mode 100644 index 00000000000..4386a948163 --- /dev/null +++ b/test/language/statements/class/definition/early-errors-methods-async-generators-yield-in-params.js @@ -0,0 +1,13 @@ +/*--- +author: Nitzan Uziely +esid: pending +description: > + AsyncGeneratorMethod throw a SyntaxError if UniqueFormalParameters + contains yield (invalid BindingIdentifier) +negative: + phase: early + type: SyntaxError +---*/ +class A { + async function* method(yield){} +} \ No newline at end of file diff --git a/test/language/statements/class/definition/methods-async-super-call-body.js b/test/language/statements/class/definition/early-errors-methods-async-super-call-body.js similarity index 100% rename from test/language/statements/class/definition/methods-async-super-call-body.js rename to test/language/statements/class/definition/early-errors-methods-async-super-call-body.js diff --git a/test/language/statements/class/definition/methods-async-super-call-param.js b/test/language/statements/class/definition/early-errors-methods-async-super-call-param.js similarity index 100% rename from test/language/statements/class/definition/methods-async-super-call-param.js rename to test/language/statements/class/definition/early-errors-methods-async-super-call-param.js diff --git a/test/language/statements/class/subclass/class-definition-null-proto-missing-return-override.js b/test/language/statements/class/subclass/class-definition-null-proto-missing-return-override.js index ecbafd8c0ba..fdf78ae5a2d 100644 --- a/test/language/statements/class/subclass/class-definition-null-proto-missing-return-override.js +++ b/test/language/statements/class/subclass/class-definition-null-proto-missing-return-override.js @@ -38,4 +38,4 @@ class Foo extends null { var foo = new Foo(); -assert.sameValue(Object.getPrototypeOf(foo), Foo); +assert.sameValue(Object.getPrototypeOf(foo), Foo.prototype); From 1d2a91155ce0ef817d0534f4162241d41e995336 Mon Sep 17 00:00:00 2001 From: sasha Date: Sat, 14 Jan 2017 12:53:47 +0200 Subject: [PATCH 12/12] change %AsyncGeneratorPrototype%.next.[[Call]] exists (is callable) test --- test/built-ins/AsyncGenerator/AsyncGenerator-next-callable.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/built-ins/AsyncGenerator/AsyncGenerator-next-callable.js b/test/built-ins/AsyncGenerator/AsyncGenerator-next-callable.js index a0529ef3e3c..1100f69cbb0 100644 --- a/test/built-ins/AsyncGenerator/AsyncGenerator-next-callable.js +++ b/test/built-ins/AsyncGenerator/AsyncGenerator-next-callable.js @@ -6,5 +6,5 @@ ---*/ async function* foo() { }; -assert("next" in Object.getPrototypeOf(foo())); +assert.sameValue(foo.hasOwnProperty("next"), true); foo().next(); \ No newline at end of file