mirror of
https://github.com/tc39/test262.git
synced 2025-07-01 11:14:52 +02:00
async-iteration: add tests for AsyncIteratorPrototype
This commit is contained in:
parent
510d6b7f44
commit
14d7bfeda2
@ -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,
|
||||||
|
});
|
@ -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,
|
||||||
|
});
|
@ -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,
|
||||||
|
});
|
||||||
|
|
@ -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
|
||||||
|
);
|
Loading…
x
Reference in New Issue
Block a user