diff --git a/test/built-ins/AsyncIteratorPrototype/Symbol.asyncIterator/length.js b/test/built-ins/AsyncIteratorPrototype/Symbol.asyncIterator/length.js new file mode 100644 index 0000000000..ea8e7300a3 --- /dev/null +++ b/test/built-ins/AsyncIteratorPrototype/Symbol.asyncIterator/length.js @@ -0,0 +1,29 @@ +// Copyright (C) 2018 Valerie Young. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-asynciteratorprototype-asynciterator +description: Length of AsyncIteratorPrototype[ @@asyncIterator ] +info: | + ECMAScript Standard Built-in Objects + ... + Every built-in Function object, including constructors, has a length + property whose value is an integer. Unless otherwise specified, this value + is equal to the largest number of named arguments shown in the subclause + headings for the function description, including optional parameters. + ... + Unless otherwise specified, the length property of a built-in Function + object has the attributes { [[Writable]]: false, [[Enumerable]]: false, + [[Configurable]]: true }. +features: [Symbol.asyncIterator, async-iteration] +includes: [propertyHelper.js] +---*/ + +async function* generator() {} +var AsyncIteratorPrototype = Object.getPrototypeOf(Object.getPrototypeOf(generator.prototype)) + +verifyProperty(AsyncIteratorPrototype[Symbol.asyncIterator], "length", { + value: 0, + enumerable: false, + writable: false, + configurable: true, +}); diff --git a/test/built-ins/AsyncIteratorPrototype/Symbol.asyncIterator/name.js b/test/built-ins/AsyncIteratorPrototype/Symbol.asyncIterator/name.js new file mode 100644 index 0000000000..2c2a859619 --- /dev/null +++ b/test/built-ins/AsyncIteratorPrototype/Symbol.asyncIterator/name.js @@ -0,0 +1,33 @@ +// Copyright (C) 2018 Valerie Young. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-asynciteratorprototype-asynciterator +description: Descriptor for `name` property +info: | + %AsyncIteratorPrototype% [ @@asyncIterator ] ( ) + ... + The value of the name property of this function is "[Symbol.asyncIterator]". + + ECMAScript Standard Built-in Objects + ... + Every built-in Function object, including constructors, that is not + identified as an anonymous function has a name property whose value is a + String. Unless otherwise specified, this value is the name that is given to + the function in this specification. + ... + Unless otherwise specified, the name property of a built-in Function + object, if it exists, has the attributes { [[Writable]]: false, + [[Enumerable]]: false, [[Configurable]]: true }. +features: [Symbol.asyncIterator, async-iteration] +includes: [propertyHelper.js] +---*/ + +async function* generator() {} +var AsyncIteratorPrototype = Object.getPrototypeOf(Object.getPrototypeOf(generator.prototype)) + +verifyProperty(AsyncIteratorPrototype[Symbol.asyncIterator], "name", { + value: '[Symbol.asyncIterator]', + enumerable: false, + writable: false, + configurable: true, +}); diff --git a/test/built-ins/AsyncIteratorPrototype/Symbol.asyncIterator/prop-desc.js b/test/built-ins/AsyncIteratorPrototype/Symbol.asyncIterator/prop-desc.js new file mode 100644 index 0000000000..8da5c4a68e --- /dev/null +++ b/test/built-ins/AsyncIteratorPrototype/Symbol.asyncIterator/prop-desc.js @@ -0,0 +1,26 @@ +// Copyright (C) 2018 Valerie Young. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +es6id: sec-asynciteratorprototype +description: Property descriptor +info: | + ECMAScript Standard Built-in Objects + + Every other data property described in clauses 18 through 26 and in Annex + B.2 has the attributes { [[Writable]]: true, [[Enumerable]]: false, + [[Configurable]]: true } unless otherwise specified. +features: [Symbol.asyncIterator, async-iteration] +includes: [propertyHelper.js] +---*/ + +async function* generator() {} +var AsyncIteratorPrototype = Object.getPrototypeOf(Object.getPrototypeOf(generator.prototype)) + +assert.sameValue(typeof AsyncIteratorPrototype[Symbol.asyncIterator], 'function'); + +verifyProperty(AsyncIteratorPrototype, Symbol.asyncIterator, { + enumerable: false, + writable: true, + configurable: true, +}); + diff --git a/test/built-ins/AsyncIteratorPrototype/Symbol.asyncIterator/return-val.js b/test/built-ins/AsyncIteratorPrototype/Symbol.asyncIterator/return-val.js new file mode 100644 index 0000000000..506ddedc5f --- /dev/null +++ b/test/built-ins/AsyncIteratorPrototype/Symbol.asyncIterator/return-val.js @@ -0,0 +1,20 @@ +// Copyright (C) 2018 Valerie Young. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +es6id: sec-asynciteratorprototype-asynciterator +description: Return value of @@asyncIterator +info: | + %AsyncIteratorPrototype% [ @@asyncIterator ] ( ) + 1. Return the this value. +features: [Symbol.asyncIterator, async-iteration] +---*/ + +async function* generator() {} +var AsyncIteratorPrototype = Object.getPrototypeOf(Object.getPrototypeOf(generator.prototype)) + +var thisValue = {}; + +assert.sameValue( + AsyncIteratorPrototype[Symbol.asyncIterator].call(thisValue), + thisValue +);