mirror of https://github.com/tc39/test262.git
Generate tests
This commit is contained in:
parent
78388c5ac2
commit
8f0fd88ad9
|
@ -0,0 +1,53 @@
|
|||
// This file was procedurally generated from the following sources:
|
||||
// - src/async-generators/yield-star-expr-abrupt.case
|
||||
// - src/async-generators/default/async-expression-named.template
|
||||
/*---
|
||||
description: Abrupt completion while getting yield* operand (Named async generator expression)
|
||||
esid: prod-AsyncGeneratorExpression
|
||||
features: [async-iteration]
|
||||
flags: [generated, async]
|
||||
info: |
|
||||
Async Generator Function Definitions
|
||||
|
||||
AsyncGeneratorExpression :
|
||||
async [no LineTerminator here] function * BindingIdentifier ( FormalParameters ) {
|
||||
AsyncGeneratorBody }
|
||||
|
||||
|
||||
YieldExpression: yield * AssignmentExpression
|
||||
|
||||
1. Let exprRef be the result of evaluating AssignmentExpression.
|
||||
2. Let value be ? GetValue(exprRef).
|
||||
...
|
||||
|
||||
---*/
|
||||
var obj = {};
|
||||
var abrupt = function() {
|
||||
throw obj;
|
||||
};
|
||||
|
||||
|
||||
|
||||
var callCount = 0;
|
||||
|
||||
var gen = async function *g() {
|
||||
callCount += 1;
|
||||
yield* abrupt();
|
||||
throw new Test262Error('abrupt completion closes iter');
|
||||
|
||||
};
|
||||
|
||||
var iter = gen();
|
||||
|
||||
iter.next().then(() => {
|
||||
throw new Test262Error('Promise incorrectly fulfilled.');
|
||||
}, v => {
|
||||
assert.sameValue(v, obj, "reject reason");
|
||||
|
||||
iter.next().then(({ done, value }) => {
|
||||
assert.sameValue(done, true, 'the iterator is completed');
|
||||
assert.sameValue(value, undefined, 'value is undefined');
|
||||
}).then($DONE, $DONE);
|
||||
}).catch($DONE);
|
||||
|
||||
assert.sameValue(callCount, 1);
|
|
@ -0,0 +1,73 @@
|
|||
// This file was procedurally generated from the following sources:
|
||||
// - src/async-generators/yield-star-getiter-async-get-abrupt.case
|
||||
// - src/async-generators/default/async-expression-named.template
|
||||
/*---
|
||||
description: Abrupt completion while getting [Symbol.asyncIterator] (Named async generator expression)
|
||||
esid: prod-AsyncGeneratorExpression
|
||||
features: [Symbol.asyncIterator, async-iteration]
|
||||
flags: [generated, async]
|
||||
info: |
|
||||
Async Generator Function Definitions
|
||||
|
||||
AsyncGeneratorExpression :
|
||||
async [no LineTerminator here] function * BindingIdentifier ( FormalParameters ) {
|
||||
AsyncGeneratorBody }
|
||||
|
||||
|
||||
YieldExpression: yield * AssignmentExpression
|
||||
|
||||
1. Let exprRef be the result of evaluating AssignmentExpression.
|
||||
2. Let value be ? GetValue(exprRef).
|
||||
3. Let generatorKind be ! GetGeneratorKind().
|
||||
4. Let iterator be ? GetIterator(value, generatorKind).
|
||||
...
|
||||
|
||||
GetIterator ( obj [ , hint ] )
|
||||
|
||||
...
|
||||
3. If hint is async,
|
||||
a. Set method to ? GetMethod(obj, @@asyncIterator).
|
||||
...
|
||||
|
||||
GetMethod ( V, P )
|
||||
|
||||
...
|
||||
2. Let func be ? GetV(V, P).
|
||||
...
|
||||
|
||||
---*/
|
||||
var reason = {};
|
||||
var obj = {
|
||||
get [Symbol.iterator]() {
|
||||
throw new Test262Error('it should not get Symbol.iterator');
|
||||
},
|
||||
get [Symbol.asyncIterator]() {
|
||||
throw reason;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
|
||||
var callCount = 0;
|
||||
|
||||
var gen = async function *g() {
|
||||
callCount += 1;
|
||||
yield* obj;
|
||||
throw new Test262Error('abrupt completion closes iter');
|
||||
|
||||
};
|
||||
|
||||
var iter = gen();
|
||||
|
||||
iter.next().then(() => {
|
||||
throw new Test262Error('Promise incorrectly fulfilled.');
|
||||
}, v => {
|
||||
assert.sameValue(v, reason, "reject reason");
|
||||
|
||||
iter.next().then(({ done, value }) => {
|
||||
assert.sameValue(done, true, 'the iterator is completed');
|
||||
assert.sameValue(value, undefined, 'value is undefined');
|
||||
}).then($DONE, $DONE);
|
||||
}).catch($DONE);
|
||||
|
||||
assert.sameValue(callCount, 1);
|
|
@ -0,0 +1,72 @@
|
|||
// This file was procedurally generated from the following sources:
|
||||
// - src/async-generators/yield-star-getiter-async-not-callable-boolean-throw.case
|
||||
// - src/async-generators/default/async-expression-named.template
|
||||
/*---
|
||||
description: Throws a TypeError on a non-callable [Symbol.asyncIterator] (boolean) (Named async generator expression)
|
||||
esid: prod-AsyncGeneratorExpression
|
||||
features: [Symbol.asyncIterator, async-iteration]
|
||||
flags: [generated, async]
|
||||
info: |
|
||||
Async Generator Function Definitions
|
||||
|
||||
AsyncGeneratorExpression :
|
||||
async [no LineTerminator here] function * BindingIdentifier ( FormalParameters ) {
|
||||
AsyncGeneratorBody }
|
||||
|
||||
|
||||
YieldExpression: yield * AssignmentExpression
|
||||
|
||||
1. Let exprRef be the result of evaluating AssignmentExpression.
|
||||
2. Let value be ? GetValue(exprRef).
|
||||
3. Let generatorKind be ! GetGeneratorKind().
|
||||
4. Let iterator be ? GetIterator(value, generatorKind).
|
||||
...
|
||||
|
||||
GetIterator ( obj [ , hint ] )
|
||||
|
||||
...
|
||||
3. If hint is async,
|
||||
a. Set method to ? GetMethod(obj, @@asyncIterator).
|
||||
...
|
||||
|
||||
GetMethod ( V, P )
|
||||
|
||||
...
|
||||
2. Let func be ? GetV(V, P).
|
||||
3. If func is either undefined or null, return undefined.
|
||||
4. If IsCallable(func) is false, throw a TypeError exception.
|
||||
...
|
||||
|
||||
---*/
|
||||
var obj = {
|
||||
get [Symbol.iterator]() {
|
||||
throw new Test262Error('it should not get Symbol.iterator');
|
||||
},
|
||||
[Symbol.asyncIterator]: false
|
||||
};
|
||||
|
||||
|
||||
|
||||
var callCount = 0;
|
||||
|
||||
var gen = async function *g() {
|
||||
callCount += 1;
|
||||
yield* obj;
|
||||
throw new Test262Error('abrupt completion closes iter');
|
||||
|
||||
};
|
||||
|
||||
var iter = gen();
|
||||
|
||||
iter.next().then(() => {
|
||||
throw new Test262Error('Promise incorrectly fulfilled.');
|
||||
}, v => {
|
||||
assert.sameValue(v.constructor, TypeError, "TypeError");
|
||||
|
||||
iter.next().then(({ done, value }) => {
|
||||
assert.sameValue(done, true, 'the iterator is completed');
|
||||
assert.sameValue(value, undefined, 'value is undefined');
|
||||
}).then($DONE, $DONE);
|
||||
}).catch($DONE);
|
||||
|
||||
assert.sameValue(callCount, 1);
|
|
@ -0,0 +1,72 @@
|
|||
// This file was procedurally generated from the following sources:
|
||||
// - src/async-generators/yield-star-getiter-async-not-callable-number-throw.case
|
||||
// - src/async-generators/default/async-expression-named.template
|
||||
/*---
|
||||
description: Throws a TypeError on a non-callable [Symbol.asyncIterator] (number) (Named async generator expression)
|
||||
esid: prod-AsyncGeneratorExpression
|
||||
features: [Symbol.asyncIterator, async-iteration]
|
||||
flags: [generated, async]
|
||||
info: |
|
||||
Async Generator Function Definitions
|
||||
|
||||
AsyncGeneratorExpression :
|
||||
async [no LineTerminator here] function * BindingIdentifier ( FormalParameters ) {
|
||||
AsyncGeneratorBody }
|
||||
|
||||
|
||||
YieldExpression: yield * AssignmentExpression
|
||||
|
||||
1. Let exprRef be the result of evaluating AssignmentExpression.
|
||||
2. Let value be ? GetValue(exprRef).
|
||||
3. Let generatorKind be ! GetGeneratorKind().
|
||||
4. Let iterator be ? GetIterator(value, generatorKind).
|
||||
...
|
||||
|
||||
GetIterator ( obj [ , hint ] )
|
||||
|
||||
...
|
||||
3. If hint is async,
|
||||
a. Set method to ? GetMethod(obj, @@asyncIterator).
|
||||
...
|
||||
|
||||
GetMethod ( V, P )
|
||||
|
||||
...
|
||||
2. Let func be ? GetV(V, P).
|
||||
3. If func is either undefined or null, return undefined.
|
||||
4. If IsCallable(func) is false, throw a TypeError exception.
|
||||
...
|
||||
|
||||
---*/
|
||||
var obj = {
|
||||
get [Symbol.iterator]() {
|
||||
throw new Test262Error('it should not get Symbol.iterator');
|
||||
},
|
||||
[Symbol.asyncIterator]: 0
|
||||
};
|
||||
|
||||
|
||||
|
||||
var callCount = 0;
|
||||
|
||||
var gen = async function *g() {
|
||||
callCount += 1;
|
||||
yield* obj;
|
||||
throw new Test262Error('abrupt completion closes iter');
|
||||
|
||||
};
|
||||
|
||||
var iter = gen();
|
||||
|
||||
iter.next().then(() => {
|
||||
throw new Test262Error('Promise incorrectly fulfilled.');
|
||||
}, v => {
|
||||
assert.sameValue(v.constructor, TypeError, "TypeError");
|
||||
|
||||
iter.next().then(({ done, value }) => {
|
||||
assert.sameValue(done, true, 'the iterator is completed');
|
||||
assert.sameValue(value, undefined, 'value is undefined');
|
||||
}).then($DONE, $DONE);
|
||||
}).catch($DONE);
|
||||
|
||||
assert.sameValue(callCount, 1);
|
|
@ -0,0 +1,72 @@
|
|||
// This file was procedurally generated from the following sources:
|
||||
// - src/async-generators/yield-star-getiter-async-not-callable-object-throw.case
|
||||
// - src/async-generators/default/async-expression-named.template
|
||||
/*---
|
||||
description: Throws a TypeError on a non-callable [Symbol.asyncIterator] (object) (Named async generator expression)
|
||||
esid: prod-AsyncGeneratorExpression
|
||||
features: [Symbol.asyncIterator, async-iteration]
|
||||
flags: [generated, async]
|
||||
info: |
|
||||
Async Generator Function Definitions
|
||||
|
||||
AsyncGeneratorExpression :
|
||||
async [no LineTerminator here] function * BindingIdentifier ( FormalParameters ) {
|
||||
AsyncGeneratorBody }
|
||||
|
||||
|
||||
YieldExpression: yield * AssignmentExpression
|
||||
|
||||
1. Let exprRef be the result of evaluating AssignmentExpression.
|
||||
2. Let value be ? GetValue(exprRef).
|
||||
3. Let generatorKind be ! GetGeneratorKind().
|
||||
4. Let iterator be ? GetIterator(value, generatorKind).
|
||||
...
|
||||
|
||||
GetIterator ( obj [ , hint ] )
|
||||
|
||||
...
|
||||
3. If hint is async,
|
||||
a. Set method to ? GetMethod(obj, @@asyncIterator).
|
||||
...
|
||||
|
||||
GetMethod ( V, P )
|
||||
|
||||
...
|
||||
2. Let func be ? GetV(V, P).
|
||||
3. If func is either undefined or null, return undefined.
|
||||
4. If IsCallable(func) is false, throw a TypeError exception.
|
||||
...
|
||||
|
||||
---*/
|
||||
var obj = {
|
||||
get [Symbol.iterator]() {
|
||||
throw new Test262Error('it should not get Symbol.iterator');
|
||||
},
|
||||
[Symbol.asyncIterator]: {}
|
||||
};
|
||||
|
||||
|
||||
|
||||
var callCount = 0;
|
||||
|
||||
var gen = async function *g() {
|
||||
callCount += 1;
|
||||
yield* obj;
|
||||
throw new Test262Error('abrupt completion closes iter');
|
||||
|
||||
};
|
||||
|
||||
var iter = gen();
|
||||
|
||||
iter.next().then(() => {
|
||||
throw new Test262Error('Promise incorrectly fulfilled.');
|
||||
}, v => {
|
||||
assert.sameValue(v.constructor, TypeError, "TypeError");
|
||||
|
||||
iter.next().then(({ done, value }) => {
|
||||
assert.sameValue(done, true, 'the iterator is completed');
|
||||
assert.sameValue(value, undefined, 'value is undefined');
|
||||
}).then($DONE, $DONE);
|
||||
}).catch($DONE);
|
||||
|
||||
assert.sameValue(callCount, 1);
|
|
@ -0,0 +1,72 @@
|
|||
// This file was procedurally generated from the following sources:
|
||||
// - src/async-generators/yield-star-getiter-async-not-callable-string-throw.case
|
||||
// - src/async-generators/default/async-expression-named.template
|
||||
/*---
|
||||
description: Throws a TypeError on a non-callable [Symbol.asyncIterator] (string) (Named async generator expression)
|
||||
esid: prod-AsyncGeneratorExpression
|
||||
features: [Symbol.asyncIterator, async-iteration]
|
||||
flags: [generated, async]
|
||||
info: |
|
||||
Async Generator Function Definitions
|
||||
|
||||
AsyncGeneratorExpression :
|
||||
async [no LineTerminator here] function * BindingIdentifier ( FormalParameters ) {
|
||||
AsyncGeneratorBody }
|
||||
|
||||
|
||||
YieldExpression: yield * AssignmentExpression
|
||||
|
||||
1. Let exprRef be the result of evaluating AssignmentExpression.
|
||||
2. Let value be ? GetValue(exprRef).
|
||||
3. Let generatorKind be ! GetGeneratorKind().
|
||||
4. Let iterator be ? GetIterator(value, generatorKind).
|
||||
...
|
||||
|
||||
GetIterator ( obj [ , hint ] )
|
||||
|
||||
...
|
||||
3. If hint is async,
|
||||
a. Set method to ? GetMethod(obj, @@asyncIterator).
|
||||
...
|
||||
|
||||
GetMethod ( V, P )
|
||||
|
||||
...
|
||||
2. Let func be ? GetV(V, P).
|
||||
3. If func is either undefined or null, return undefined.
|
||||
4. If IsCallable(func) is false, throw a TypeError exception.
|
||||
...
|
||||
|
||||
---*/
|
||||
var obj = {
|
||||
get [Symbol.iterator]() {
|
||||
throw new Test262Error('it should not get Symbol.iterator');
|
||||
},
|
||||
[Symbol.asyncIterator]: ''
|
||||
};
|
||||
|
||||
|
||||
|
||||
var callCount = 0;
|
||||
|
||||
var gen = async function *g() {
|
||||
callCount += 1;
|
||||
yield* obj;
|
||||
throw new Test262Error('abrupt completion closes iter');
|
||||
|
||||
};
|
||||
|
||||
var iter = gen();
|
||||
|
||||
iter.next().then(() => {
|
||||
throw new Test262Error('Promise incorrectly fulfilled.');
|
||||
}, v => {
|
||||
assert.sameValue(v.constructor, TypeError, "TypeError");
|
||||
|
||||
iter.next().then(({ done, value }) => {
|
||||
assert.sameValue(done, true, 'the iterator is completed');
|
||||
assert.sameValue(value, undefined, 'value is undefined');
|
||||
}).then($DONE, $DONE);
|
||||
}).catch($DONE);
|
||||
|
||||
assert.sameValue(callCount, 1);
|
|
@ -0,0 +1,72 @@
|
|||
// This file was procedurally generated from the following sources:
|
||||
// - src/async-generators/yield-star-getiter-async-not-callable-symbol-throw.case
|
||||
// - src/async-generators/default/async-expression-named.template
|
||||
/*---
|
||||
description: Throws a TypeError on a non-callable [Symbol.asyncIterator] (symbol) (Named async generator expression)
|
||||
esid: prod-AsyncGeneratorExpression
|
||||
features: [Symbol.asyncIterator, async-iteration]
|
||||
flags: [generated, async]
|
||||
info: |
|
||||
Async Generator Function Definitions
|
||||
|
||||
AsyncGeneratorExpression :
|
||||
async [no LineTerminator here] function * BindingIdentifier ( FormalParameters ) {
|
||||
AsyncGeneratorBody }
|
||||
|
||||
|
||||
YieldExpression: yield * AssignmentExpression
|
||||
|
||||
1. Let exprRef be the result of evaluating AssignmentExpression.
|
||||
2. Let value be ? GetValue(exprRef).
|
||||
3. Let generatorKind be ! GetGeneratorKind().
|
||||
4. Let iterator be ? GetIterator(value, generatorKind).
|
||||
...
|
||||
|
||||
GetIterator ( obj [ , hint ] )
|
||||
|
||||
...
|
||||
3. If hint is async,
|
||||
a. Set method to ? GetMethod(obj, @@asyncIterator).
|
||||
...
|
||||
|
||||
GetMethod ( V, P )
|
||||
|
||||
...
|
||||
2. Let func be ? GetV(V, P).
|
||||
3. If func is either undefined or null, return undefined.
|
||||
4. If IsCallable(func) is false, throw a TypeError exception.
|
||||
...
|
||||
|
||||
---*/
|
||||
var obj = {
|
||||
get [Symbol.iterator]() {
|
||||
throw new Test262Error('it should not get Symbol.iterator');
|
||||
},
|
||||
[Symbol.asyncIterator]: Symbol.asyncIterator
|
||||
};
|
||||
|
||||
|
||||
|
||||
var callCount = 0;
|
||||
|
||||
var gen = async function *g() {
|
||||
callCount += 1;
|
||||
yield* obj;
|
||||
throw new Test262Error('abrupt completion closes iter');
|
||||
|
||||
};
|
||||
|
||||
var iter = gen();
|
||||
|
||||
iter.next().then(() => {
|
||||
throw new Test262Error('Promise incorrectly fulfilled.');
|
||||
}, v => {
|
||||
assert.sameValue(v.constructor, TypeError, "TypeError");
|
||||
|
||||
iter.next().then(({ done, value }) => {
|
||||
assert.sameValue(done, true, 'the iterator is completed');
|
||||
assert.sameValue(value, undefined, 'value is undefined');
|
||||
}).then($DONE, $DONE);
|
||||
}).catch($DONE);
|
||||
|
||||
assert.sameValue(callCount, 1);
|
|
@ -0,0 +1,78 @@
|
|||
// This file was procedurally generated from the following sources:
|
||||
// - src/async-generators/yield-star-getiter-async-null-sync-get-abrupt.case
|
||||
// - src/async-generators/default/async-expression-named.template
|
||||
/*---
|
||||
description: Abrupt completion while getting @@iterator after null @@asyncIterator (Named async generator expression)
|
||||
esid: prod-AsyncGeneratorExpression
|
||||
features: [Symbol.asyncIterator, async-iteration]
|
||||
flags: [generated, async]
|
||||
info: |
|
||||
Async Generator Function Definitions
|
||||
|
||||
AsyncGeneratorExpression :
|
||||
async [no LineTerminator here] function * BindingIdentifier ( FormalParameters ) {
|
||||
AsyncGeneratorBody }
|
||||
|
||||
|
||||
YieldExpression: yield * AssignmentExpression
|
||||
|
||||
1. Let exprRef be the result of evaluating AssignmentExpression.
|
||||
2. Let value be ? GetValue(exprRef).
|
||||
3. Let generatorKind be ! GetGeneratorKind().
|
||||
4. Let iterator be ? GetIterator(value, generatorKind).
|
||||
...
|
||||
|
||||
GetIterator ( obj [ , hint ] )
|
||||
|
||||
...
|
||||
3. If hint is async,
|
||||
a. Set method to ? GetMethod(obj, @@asyncIterator).
|
||||
b. If method is undefined,
|
||||
i. Let syncMethod be ? GetMethod(obj, @@iterator).
|
||||
...
|
||||
|
||||
GetMethod ( V, P )
|
||||
|
||||
...
|
||||
2. Let func be ? GetV(V, P).
|
||||
...
|
||||
|
||||
---*/
|
||||
var calls = 0;
|
||||
var reason = {};
|
||||
var obj = {
|
||||
get [Symbol.iterator]() {
|
||||
throw reason;
|
||||
},
|
||||
get [Symbol.asyncIterator]() {
|
||||
calls += 1;
|
||||
return null;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
|
||||
var callCount = 0;
|
||||
|
||||
var gen = async function *g() {
|
||||
callCount += 1;
|
||||
yield* obj;
|
||||
throw new Test262Error('abrupt completion closes iter');
|
||||
|
||||
};
|
||||
|
||||
var iter = gen();
|
||||
|
||||
iter.next().then(() => {
|
||||
throw new Test262Error('Promise incorrectly fulfilled.');
|
||||
}, v => {
|
||||
assert.sameValue(v, reason, 'reject reason');
|
||||
assert.sameValue(calls, 1);
|
||||
|
||||
iter.next().then(({ done, value }) => {
|
||||
assert.sameValue(done, true, 'the iterator is completed');
|
||||
assert.sameValue(value, undefined, 'value is undefined');
|
||||
}).then($DONE, $DONE);
|
||||
}).catch($DONE);
|
||||
|
||||
assert.sameValue(callCount, 1);
|
|
@ -0,0 +1,69 @@
|
|||
// This file was procedurally generated from the following sources:
|
||||
// - src/async-generators/yield-star-getiter-async-returns-abrupt.case
|
||||
// - src/async-generators/default/async-expression-named.template
|
||||
/*---
|
||||
description: Abrupt completion while calling [Symbol.asyncIterator] (Named async generator expression)
|
||||
esid: prod-AsyncGeneratorExpression
|
||||
features: [Symbol.asyncIterator, async-iteration]
|
||||
flags: [generated, async]
|
||||
info: |
|
||||
Async Generator Function Definitions
|
||||
|
||||
AsyncGeneratorExpression :
|
||||
async [no LineTerminator here] function * BindingIdentifier ( FormalParameters ) {
|
||||
AsyncGeneratorBody }
|
||||
|
||||
|
||||
YieldExpression: yield * AssignmentExpression
|
||||
|
||||
1. Let exprRef be the result of evaluating AssignmentExpression.
|
||||
2. Let value be ? GetValue(exprRef).
|
||||
3. Let generatorKind be ! GetGeneratorKind().
|
||||
4. Let iterator be ? GetIterator(value, generatorKind).
|
||||
...
|
||||
|
||||
GetIterator ( obj [ , hint ] )
|
||||
|
||||
...
|
||||
3. If hint is async,
|
||||
a. Set method to ? GetMethod(obj, @@asyncIterator).
|
||||
...
|
||||
6. Let iterator be ? Call(method, obj).
|
||||
...
|
||||
|
||||
---*/
|
||||
var reason = {};
|
||||
var obj = {
|
||||
get [Symbol.iterator]() {
|
||||
throw new Test262Error('it should not get Symbol.iterator');
|
||||
},
|
||||
[Symbol.asyncIterator]() {
|
||||
throw reason;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
|
||||
var callCount = 0;
|
||||
|
||||
var gen = async function *g() {
|
||||
callCount += 1;
|
||||
yield* obj;
|
||||
throw new Test262Error('abrupt completion closes iter');
|
||||
|
||||
};
|
||||
|
||||
var iter = gen();
|
||||
|
||||
iter.next().then(() => {
|
||||
throw new Test262Error('Promise incorrectly fulfilled.');
|
||||
}, v => {
|
||||
assert.sameValue(v, reason, "reject reason");
|
||||
|
||||
iter.next().then(({ done, value }) => {
|
||||
assert.sameValue(done, true, 'the iterator is completed');
|
||||
assert.sameValue(value, undefined, 'value is undefined');
|
||||
}).then($DONE, $DONE);
|
||||
}).catch($DONE);
|
||||
|
||||
assert.sameValue(callCount, 1);
|
|
@ -0,0 +1,69 @@
|
|||
// This file was procedurally generated from the following sources:
|
||||
// - src/async-generators/yield-star-getiter-async-returns-boolean-throw.case
|
||||
// - src/async-generators/default/async-expression-named.template
|
||||
/*---
|
||||
description: Non object returned by [Symbol.asyncIterator]() - boolean (Named async generator expression)
|
||||
esid: prod-AsyncGeneratorExpression
|
||||
features: [Symbol.asyncIterator, async-iteration]
|
||||
flags: [generated, async]
|
||||
info: |
|
||||
Async Generator Function Definitions
|
||||
|
||||
AsyncGeneratorExpression :
|
||||
async [no LineTerminator here] function * BindingIdentifier ( FormalParameters ) {
|
||||
AsyncGeneratorBody }
|
||||
|
||||
|
||||
YieldExpression: yield * AssignmentExpression
|
||||
|
||||
1. Let exprRef be the result of evaluating AssignmentExpression.
|
||||
2. Let value be ? GetValue(exprRef).
|
||||
3. Let generatorKind be ! GetGeneratorKind().
|
||||
4. Let iterator be ? GetIterator(value, generatorKind).
|
||||
...
|
||||
|
||||
GetIterator ( obj [ , hint ] )
|
||||
|
||||
...
|
||||
3. If hint is async,
|
||||
a. Set method to ? GetMethod(obj, @@asyncIterator).
|
||||
...
|
||||
6. Let iterator be ? Call(method, obj).
|
||||
7. If Type(iterator) is not Object, throw a TypeError exception.
|
||||
...
|
||||
|
||||
---*/
|
||||
var obj = {
|
||||
get [Symbol.iterator]() {
|
||||
throw new Test262Error('it should not get Symbol.iterator');
|
||||
},
|
||||
[Symbol.asyncIterator]() {
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
|
||||
var callCount = 0;
|
||||
|
||||
var gen = async function *g() {
|
||||
callCount += 1;
|
||||
yield* obj;
|
||||
throw new Test262Error('abrupt completion closes iter');
|
||||
|
||||
};
|
||||
|
||||
var iter = gen();
|
||||
|
||||
iter.next().then(() => {
|
||||
throw new Test262Error('Promise incorrectly fulfilled.');
|
||||
}, v => {
|
||||
assert.sameValue(v.constructor, TypeError, "TypeError");
|
||||
|
||||
iter.next().then(({ done, value }) => {
|
||||
assert.sameValue(done, true, 'the iterator is completed');
|
||||
assert.sameValue(value, undefined, 'value is undefined');
|
||||
}).then($DONE, $DONE);
|
||||
}).catch($DONE);
|
||||
|
||||
assert.sameValue(callCount, 1);
|
|
@ -0,0 +1,69 @@
|
|||
// This file was procedurally generated from the following sources:
|
||||
// - src/async-generators/yield-star-getiter-async-returns-null-throw.case
|
||||
// - src/async-generators/default/async-expression-named.template
|
||||
/*---
|
||||
description: Non object returned by [Symbol.asyncIterator]() - null (Named async generator expression)
|
||||
esid: prod-AsyncGeneratorExpression
|
||||
features: [Symbol.asyncIterator, async-iteration]
|
||||
flags: [generated, async]
|
||||
info: |
|
||||
Async Generator Function Definitions
|
||||
|
||||
AsyncGeneratorExpression :
|
||||
async [no LineTerminator here] function * BindingIdentifier ( FormalParameters ) {
|
||||
AsyncGeneratorBody }
|
||||
|
||||
|
||||
YieldExpression: yield * AssignmentExpression
|
||||
|
||||
1. Let exprRef be the result of evaluating AssignmentExpression.
|
||||
2. Let value be ? GetValue(exprRef).
|
||||
3. Let generatorKind be ! GetGeneratorKind().
|
||||
4. Let iterator be ? GetIterator(value, generatorKind).
|
||||
...
|
||||
|
||||
GetIterator ( obj [ , hint ] )
|
||||
|
||||
...
|
||||
3. If hint is async,
|
||||
a. Set method to ? GetMethod(obj, @@asyncIterator).
|
||||
...
|
||||
6. Let iterator be ? Call(method, obj).
|
||||
7. If Type(iterator) is not Object, throw a TypeError exception.
|
||||
...
|
||||
|
||||
---*/
|
||||
var obj = {
|
||||
get [Symbol.iterator]() {
|
||||
throw new Test262Error('it should not get Symbol.iterator');
|
||||
},
|
||||
[Symbol.asyncIterator]() {
|
||||
return null;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
|
||||
var callCount = 0;
|
||||
|
||||
var gen = async function *g() {
|
||||
callCount += 1;
|
||||
yield* obj;
|
||||
throw new Test262Error('abrupt completion closes iter');
|
||||
|
||||
};
|
||||
|
||||
var iter = gen();
|
||||
|
||||
iter.next().then(() => {
|
||||
throw new Test262Error('Promise incorrectly fulfilled.');
|
||||
}, v => {
|
||||
assert.sameValue(v.constructor, TypeError, "TypeError");
|
||||
|
||||
iter.next().then(({ done, value }) => {
|
||||
assert.sameValue(done, true, 'the iterator is completed');
|
||||
assert.sameValue(value, undefined, 'value is undefined');
|
||||
}).then($DONE, $DONE);
|
||||
}).catch($DONE);
|
||||
|
||||
assert.sameValue(callCount, 1);
|
|
@ -0,0 +1,69 @@
|
|||
// This file was procedurally generated from the following sources:
|
||||
// - src/async-generators/yield-star-getiter-async-returns-number-throw.case
|
||||
// - src/async-generators/default/async-expression-named.template
|
||||
/*---
|
||||
description: Non object returned by [Symbol.asyncIterator]() - number (Named async generator expression)
|
||||
esid: prod-AsyncGeneratorExpression
|
||||
features: [Symbol.asyncIterator, async-iteration]
|
||||
flags: [generated, async]
|
||||
info: |
|
||||
Async Generator Function Definitions
|
||||
|
||||
AsyncGeneratorExpression :
|
||||
async [no LineTerminator here] function * BindingIdentifier ( FormalParameters ) {
|
||||
AsyncGeneratorBody }
|
||||
|
||||
|
||||
YieldExpression: yield * AssignmentExpression
|
||||
|
||||
1. Let exprRef be the result of evaluating AssignmentExpression.
|
||||
2. Let value be ? GetValue(exprRef).
|
||||
3. Let generatorKind be ! GetGeneratorKind().
|
||||
4. Let iterator be ? GetIterator(value, generatorKind).
|
||||
...
|
||||
|
||||
GetIterator ( obj [ , hint ] )
|
||||
|
||||
...
|
||||
3. If hint is async,
|
||||
a. Set method to ? GetMethod(obj, @@asyncIterator).
|
||||
...
|
||||
6. Let iterator be ? Call(method, obj).
|
||||
7. If Type(iterator) is not Object, throw a TypeError exception.
|
||||
...
|
||||
|
||||
---*/
|
||||
var obj = {
|
||||
get [Symbol.iterator]() {
|
||||
throw new Test262Error('it should not get Symbol.iterator');
|
||||
},
|
||||
[Symbol.asyncIterator]() {
|
||||
return 42;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
|
||||
var callCount = 0;
|
||||
|
||||
var gen = async function *g() {
|
||||
callCount += 1;
|
||||
yield* obj;
|
||||
throw new Test262Error('abrupt completion closes iter');
|
||||
|
||||
};
|
||||
|
||||
var iter = gen();
|
||||
|
||||
iter.next().then(() => {
|
||||
throw new Test262Error('Promise incorrectly fulfilled.');
|
||||
}, v => {
|
||||
assert.sameValue(v.constructor, TypeError, "TypeError");
|
||||
|
||||
iter.next().then(({ done, value }) => {
|
||||
assert.sameValue(done, true, 'the iterator is completed');
|
||||
assert.sameValue(value, undefined, 'value is undefined');
|
||||
}).then($DONE, $DONE);
|
||||
}).catch($DONE);
|
||||
|
||||
assert.sameValue(callCount, 1);
|
|
@ -0,0 +1,69 @@
|
|||
// This file was procedurally generated from the following sources:
|
||||
// - src/async-generators/yield-star-getiter-async-returns-string-throw.case
|
||||
// - src/async-generators/default/async-expression-named.template
|
||||
/*---
|
||||
description: Non object returned by [Symbol.asyncIterator]() - string (Named async generator expression)
|
||||
esid: prod-AsyncGeneratorExpression
|
||||
features: [Symbol.asyncIterator, async-iteration]
|
||||
flags: [generated, async]
|
||||
info: |
|
||||
Async Generator Function Definitions
|
||||
|
||||
AsyncGeneratorExpression :
|
||||
async [no LineTerminator here] function * BindingIdentifier ( FormalParameters ) {
|
||||
AsyncGeneratorBody }
|
||||
|
||||
|
||||
YieldExpression: yield * AssignmentExpression
|
||||
|
||||
1. Let exprRef be the result of evaluating AssignmentExpression.
|
||||
2. Let value be ? GetValue(exprRef).
|
||||
3. Let generatorKind be ! GetGeneratorKind().
|
||||
4. Let iterator be ? GetIterator(value, generatorKind).
|
||||
...
|
||||
|
||||
GetIterator ( obj [ , hint ] )
|
||||
|
||||
...
|
||||
3. If hint is async,
|
||||
a. Set method to ? GetMethod(obj, @@asyncIterator).
|
||||
...
|
||||
6. Let iterator be ? Call(method, obj).
|
||||
7. If Type(iterator) is not Object, throw a TypeError exception.
|
||||
...
|
||||
|
||||
---*/
|
||||
var obj = {
|
||||
get [Symbol.iterator]() {
|
||||
throw new Test262Error('it should not get Symbol.iterator');
|
||||
},
|
||||
[Symbol.asyncIterator]() {
|
||||
return '42';
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
|
||||
var callCount = 0;
|
||||
|
||||
var gen = async function *g() {
|
||||
callCount += 1;
|
||||
yield* obj;
|
||||
throw new Test262Error('abrupt completion closes iter');
|
||||
|
||||
};
|
||||
|
||||
var iter = gen();
|
||||
|
||||
iter.next().then(() => {
|
||||
throw new Test262Error('Promise incorrectly fulfilled.');
|
||||
}, v => {
|
||||
assert.sameValue(v.constructor, TypeError, "TypeError");
|
||||
|
||||
iter.next().then(({ done, value }) => {
|
||||
assert.sameValue(done, true, 'the iterator is completed');
|
||||
assert.sameValue(value, undefined, 'value is undefined');
|
||||
}).then($DONE, $DONE);
|
||||
}).catch($DONE);
|
||||
|
||||
assert.sameValue(callCount, 1);
|
|
@ -0,0 +1,69 @@
|
|||
// This file was procedurally generated from the following sources:
|
||||
// - src/async-generators/yield-star-getiter-async-returns-symbol-throw.case
|
||||
// - src/async-generators/default/async-expression-named.template
|
||||
/*---
|
||||
description: Non object returned by [Symbol.asyncIterator]() - symbol (Named async generator expression)
|
||||
esid: prod-AsyncGeneratorExpression
|
||||
features: [Symbol.asyncIterator, async-iteration]
|
||||
flags: [generated, async]
|
||||
info: |
|
||||
Async Generator Function Definitions
|
||||
|
||||
AsyncGeneratorExpression :
|
||||
async [no LineTerminator here] function * BindingIdentifier ( FormalParameters ) {
|
||||
AsyncGeneratorBody }
|
||||
|
||||
|
||||
YieldExpression: yield * AssignmentExpression
|
||||
|
||||
1. Let exprRef be the result of evaluating AssignmentExpression.
|
||||
2. Let value be ? GetValue(exprRef).
|
||||
3. Let generatorKind be ! GetGeneratorKind().
|
||||
4. Let iterator be ? GetIterator(value, generatorKind).
|
||||
...
|
||||
|
||||
GetIterator ( obj [ , hint ] )
|
||||
|
||||
...
|
||||
3. If hint is async,
|
||||
a. Set method to ? GetMethod(obj, @@asyncIterator).
|
||||
...
|
||||
6. Let iterator be ? Call(method, obj).
|
||||
7. If Type(iterator) is not Object, throw a TypeError exception.
|
||||
...
|
||||
|
||||
---*/
|
||||
var obj = {
|
||||
get [Symbol.iterator]() {
|
||||
throw new Test262Error('it should not get Symbol.iterator');
|
||||
},
|
||||
[Symbol.asyncIterator]() {
|
||||
return Symbol.asyncIterator;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
|
||||
var callCount = 0;
|
||||
|
||||
var gen = async function *g() {
|
||||
callCount += 1;
|
||||
yield* obj;
|
||||
throw new Test262Error('abrupt completion closes iter');
|
||||
|
||||
};
|
||||
|
||||
var iter = gen();
|
||||
|
||||
iter.next().then(() => {
|
||||
throw new Test262Error('Promise incorrectly fulfilled.');
|
||||
}, v => {
|
||||
assert.sameValue(v.constructor, TypeError, "TypeError");
|
||||
|
||||
iter.next().then(({ done, value }) => {
|
||||
assert.sameValue(done, true, 'the iterator is completed');
|
||||
assert.sameValue(value, undefined, 'value is undefined');
|
||||
}).then($DONE, $DONE);
|
||||
}).catch($DONE);
|
||||
|
||||
assert.sameValue(callCount, 1);
|
|
@ -0,0 +1,69 @@
|
|||
// This file was procedurally generated from the following sources:
|
||||
// - src/async-generators/yield-star-getiter-async-returns-undefined-throw.case
|
||||
// - src/async-generators/default/async-expression-named.template
|
||||
/*---
|
||||
description: Non object returned by [Symbol.asyncIterator]() - undefined (Named async generator expression)
|
||||
esid: prod-AsyncGeneratorExpression
|
||||
features: [Symbol.asyncIterator, async-iteration]
|
||||
flags: [generated, async]
|
||||
info: |
|
||||
Async Generator Function Definitions
|
||||
|
||||
AsyncGeneratorExpression :
|
||||
async [no LineTerminator here] function * BindingIdentifier ( FormalParameters ) {
|
||||
AsyncGeneratorBody }
|
||||
|
||||
|
||||
YieldExpression: yield * AssignmentExpression
|
||||
|
||||
1. Let exprRef be the result of evaluating AssignmentExpression.
|
||||
2. Let value be ? GetValue(exprRef).
|
||||
3. Let generatorKind be ! GetGeneratorKind().
|
||||
4. Let iterator be ? GetIterator(value, generatorKind).
|
||||
...
|
||||
|
||||
GetIterator ( obj [ , hint ] )
|
||||
|
||||
...
|
||||
3. If hint is async,
|
||||
a. Set method to ? GetMethod(obj, @@asyncIterator).
|
||||
...
|
||||
6. Let iterator be ? Call(method, obj).
|
||||
7. If Type(iterator) is not Object, throw a TypeError exception.
|
||||
...
|
||||
|
||||
---*/
|
||||
var obj = {
|
||||
get [Symbol.iterator]() {
|
||||
throw new Test262Error('it should not get Symbol.iterator');
|
||||
},
|
||||
[Symbol.asyncIterator]() {
|
||||
return undefined;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
|
||||
var callCount = 0;
|
||||
|
||||
var gen = async function *g() {
|
||||
callCount += 1;
|
||||
yield* obj;
|
||||
throw new Test262Error('abrupt completion closes iter');
|
||||
|
||||
};
|
||||
|
||||
var iter = gen();
|
||||
|
||||
iter.next().then(() => {
|
||||
throw new Test262Error('Promise incorrectly fulfilled.');
|
||||
}, v => {
|
||||
assert.sameValue(v.constructor, TypeError, "TypeError");
|
||||
|
||||
iter.next().then(({ done, value }) => {
|
||||
assert.sameValue(done, true, 'the iterator is completed');
|
||||
assert.sameValue(value, undefined, 'value is undefined');
|
||||
}).then($DONE, $DONE);
|
||||
}).catch($DONE);
|
||||
|
||||
assert.sameValue(callCount, 1);
|
|
@ -0,0 +1,78 @@
|
|||
// This file was procedurally generated from the following sources:
|
||||
// - src/async-generators/yield-star-getiter-async-undefined-sync-get-abrupt.case
|
||||
// - src/async-generators/default/async-expression-named.template
|
||||
/*---
|
||||
description: Abrupt completion while getting @@iterator after undefined @@asyncIterator (Named async generator expression)
|
||||
esid: prod-AsyncGeneratorExpression
|
||||
features: [Symbol.asyncIterator, async-iteration]
|
||||
flags: [generated, async]
|
||||
info: |
|
||||
Async Generator Function Definitions
|
||||
|
||||
AsyncGeneratorExpression :
|
||||
async [no LineTerminator here] function * BindingIdentifier ( FormalParameters ) {
|
||||
AsyncGeneratorBody }
|
||||
|
||||
|
||||
YieldExpression: yield * AssignmentExpression
|
||||
|
||||
1. Let exprRef be the result of evaluating AssignmentExpression.
|
||||
2. Let value be ? GetValue(exprRef).
|
||||
3. Let generatorKind be ! GetGeneratorKind().
|
||||
4. Let iterator be ? GetIterator(value, generatorKind).
|
||||
...
|
||||
|
||||
GetIterator ( obj [ , hint ] )
|
||||
|
||||
...
|
||||
3. If hint is async,
|
||||
a. Set method to ? GetMethod(obj, @@asyncIterator).
|
||||
b. If method is undefined,
|
||||
i. Let syncMethod be ? GetMethod(obj, @@iterator).
|
||||
...
|
||||
|
||||
GetMethod ( V, P )
|
||||
|
||||
...
|
||||
2. Let func be ? GetV(V, P).
|
||||
...
|
||||
|
||||
---*/
|
||||
var calls = 0;
|
||||
var reason = {};
|
||||
var obj = {
|
||||
get [Symbol.iterator]() {
|
||||
throw reason;
|
||||
},
|
||||
get [Symbol.asyncIterator]() {
|
||||
calls += 1;
|
||||
return undefined;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
|
||||
var callCount = 0;
|
||||
|
||||
var gen = async function *g() {
|
||||
callCount += 1;
|
||||
yield* obj;
|
||||
throw new Test262Error('abrupt completion closes iter');
|
||||
|
||||
};
|
||||
|
||||
var iter = gen();
|
||||
|
||||
iter.next().then(() => {
|
||||
throw new Test262Error('Promise incorrectly fulfilled.');
|
||||
}, v => {
|
||||
assert.sameValue(v, reason, 'reject reason');
|
||||
assert.sameValue(calls, 1);
|
||||
|
||||
iter.next().then(({ done, value }) => {
|
||||
assert.sameValue(done, true, 'the iterator is completed');
|
||||
assert.sameValue(value, undefined, 'value is undefined');
|
||||
}).then($DONE, $DONE);
|
||||
}).catch($DONE);
|
||||
|
||||
assert.sameValue(callCount, 1);
|
|
@ -0,0 +1,72 @@
|
|||
// This file was procedurally generated from the following sources:
|
||||
// - src/async-generators/yield-star-getiter-sync-get-abrupt.case
|
||||
// - src/async-generators/default/async-expression-named.template
|
||||
/*---
|
||||
description: Abrupt completion while getting [Symbol.iterator] (Named async generator expression)
|
||||
esid: prod-AsyncGeneratorExpression
|
||||
features: [Symbol.asyncIterator, async-iteration]
|
||||
flags: [generated, async]
|
||||
info: |
|
||||
Async Generator Function Definitions
|
||||
|
||||
AsyncGeneratorExpression :
|
||||
async [no LineTerminator here] function * BindingIdentifier ( FormalParameters ) {
|
||||
AsyncGeneratorBody }
|
||||
|
||||
|
||||
YieldExpression: yield * AssignmentExpression
|
||||
|
||||
1. Let exprRef be the result of evaluating AssignmentExpression.
|
||||
2. Let value be ? GetValue(exprRef).
|
||||
3. Let generatorKind be ! GetGeneratorKind().
|
||||
4. Let iterator be ? GetIterator(value, generatorKind).
|
||||
...
|
||||
|
||||
GetIterator ( obj [ , hint ] )
|
||||
|
||||
...
|
||||
3. If hint is async,
|
||||
a. Set method to ? GetMethod(obj, @@asyncIterator).
|
||||
b. If method is undefined,
|
||||
i. Let syncMethod be ? GetMethod(obj, @@iterator).
|
||||
...
|
||||
|
||||
GetMethod ( V, P )
|
||||
|
||||
...
|
||||
2. Let func be ? GetV(V, P).
|
||||
...
|
||||
|
||||
---*/
|
||||
var reason = {};
|
||||
var obj = {
|
||||
get [Symbol.iterator]() {
|
||||
throw reason;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
|
||||
var callCount = 0;
|
||||
|
||||
var gen = async function *g() {
|
||||
callCount += 1;
|
||||
yield* obj;
|
||||
throw new Test262Error('abrupt completion closes iter');
|
||||
|
||||
};
|
||||
|
||||
var iter = gen();
|
||||
|
||||
iter.next().then(() => {
|
||||
throw new Test262Error('Promise incorrectly fulfilled.');
|
||||
}, v => {
|
||||
assert.sameValue(v, reason, "reject reason");
|
||||
|
||||
iter.next().then(({ done, value }) => {
|
||||
assert.sameValue(done, true, 'the iterator is completed');
|
||||
assert.sameValue(value, undefined, 'value is undefined');
|
||||
}).then($DONE, $DONE);
|
||||
}).catch($DONE);
|
||||
|
||||
assert.sameValue(callCount, 1);
|
|
@ -0,0 +1,71 @@
|
|||
// This file was procedurally generated from the following sources:
|
||||
// - src/async-generators/yield-star-getiter-sync-not-callable-boolean-throw.case
|
||||
// - src/async-generators/default/async-expression-named.template
|
||||
/*---
|
||||
description: Throws a TypeError on a non-callable [Symbol.iterator] (boolean) (Named async generator expression)
|
||||
esid: prod-AsyncGeneratorExpression
|
||||
features: [async-iteration]
|
||||
flags: [generated, async]
|
||||
info: |
|
||||
Async Generator Function Definitions
|
||||
|
||||
AsyncGeneratorExpression :
|
||||
async [no LineTerminator here] function * BindingIdentifier ( FormalParameters ) {
|
||||
AsyncGeneratorBody }
|
||||
|
||||
|
||||
YieldExpression: yield * AssignmentExpression
|
||||
|
||||
1. Let exprRef be the result of evaluating AssignmentExpression.
|
||||
2. Let value be ? GetValue(exprRef).
|
||||
3. Let generatorKind be ! GetGeneratorKind().
|
||||
4. Let iterator be ? GetIterator(value, generatorKind).
|
||||
...
|
||||
|
||||
GetIterator ( obj [ , hint ] )
|
||||
|
||||
...
|
||||
3. If hint is async,
|
||||
a. Set method to ? GetMethod(obj, @@asyncIterator).
|
||||
b. If method is undefined,
|
||||
i. Let syncMethod be ? GetMethod(obj, @@iterator).
|
||||
...
|
||||
|
||||
GetMethod ( V, P )
|
||||
|
||||
...
|
||||
2. Let func be ? GetV(V, P).
|
||||
...
|
||||
4. If IsCallable(func) is false, throw a TypeError exception.
|
||||
...
|
||||
|
||||
---*/
|
||||
var obj = {
|
||||
[Symbol.iterator]: false
|
||||
};
|
||||
|
||||
|
||||
|
||||
var callCount = 0;
|
||||
|
||||
var gen = async function *g() {
|
||||
callCount += 1;
|
||||
yield* obj;
|
||||
throw new Test262Error('abrupt completion closes iter');
|
||||
|
||||
};
|
||||
|
||||
var iter = gen();
|
||||
|
||||
iter.next().then(() => {
|
||||
throw new Test262Error('Promise incorrectly fulfilled.');
|
||||
}, v => {
|
||||
assert.sameValue(v.constructor, TypeError, "TypeError");
|
||||
|
||||
iter.next().then(({ done, value }) => {
|
||||
assert.sameValue(done, true, 'the iterator is completed');
|
||||
assert.sameValue(value, undefined, 'value is undefined');
|
||||
}).then($DONE, $DONE);
|
||||
}).catch($DONE);
|
||||
|
||||
assert.sameValue(callCount, 1);
|
|
@ -0,0 +1,71 @@
|
|||
// This file was procedurally generated from the following sources:
|
||||
// - src/async-generators/yield-star-getiter-sync-not-callable-number-throw.case
|
||||
// - src/async-generators/default/async-expression-named.template
|
||||
/*---
|
||||
description: Throws a TypeError on a non-callable [Symbol.iterator] (number) (Named async generator expression)
|
||||
esid: prod-AsyncGeneratorExpression
|
||||
features: [async-iteration]
|
||||
flags: [generated, async]
|
||||
info: |
|
||||
Async Generator Function Definitions
|
||||
|
||||
AsyncGeneratorExpression :
|
||||
async [no LineTerminator here] function * BindingIdentifier ( FormalParameters ) {
|
||||
AsyncGeneratorBody }
|
||||
|
||||
|
||||
YieldExpression: yield * AssignmentExpression
|
||||
|
||||
1. Let exprRef be the result of evaluating AssignmentExpression.
|
||||
2. Let value be ? GetValue(exprRef).
|
||||
3. Let generatorKind be ! GetGeneratorKind().
|
||||
4. Let iterator be ? GetIterator(value, generatorKind).
|
||||
...
|
||||
|
||||
GetIterator ( obj [ , hint ] )
|
||||
|
||||
...
|
||||
3. If hint is async,
|
||||
a. Set method to ? GetMethod(obj, @@asyncIterator).
|
||||
b. If method is undefined,
|
||||
i. Let syncMethod be ? GetMethod(obj, @@iterator).
|
||||
...
|
||||
|
||||
GetMethod ( V, P )
|
||||
|
||||
...
|
||||
2. Let func be ? GetV(V, P).
|
||||
...
|
||||
4. If IsCallable(func) is false, throw a TypeError exception.
|
||||
...
|
||||
|
||||
---*/
|
||||
var obj = {
|
||||
[Symbol.iterator]: 0
|
||||
};
|
||||
|
||||
|
||||
|
||||
var callCount = 0;
|
||||
|
||||
var gen = async function *g() {
|
||||
callCount += 1;
|
||||
yield* obj;
|
||||
throw new Test262Error('abrupt completion closes iter');
|
||||
|
||||
};
|
||||
|
||||
var iter = gen();
|
||||
|
||||
iter.next().then(() => {
|
||||
throw new Test262Error('Promise incorrectly fulfilled.');
|
||||
}, v => {
|
||||
assert.sameValue(v.constructor, TypeError, "TypeError");
|
||||
|
||||
iter.next().then(({ done, value }) => {
|
||||
assert.sameValue(done, true, 'the iterator is completed');
|
||||
assert.sameValue(value, undefined, 'value is undefined');
|
||||
}).then($DONE, $DONE);
|
||||
}).catch($DONE);
|
||||
|
||||
assert.sameValue(callCount, 1);
|
|
@ -0,0 +1,71 @@
|
|||
// This file was procedurally generated from the following sources:
|
||||
// - src/async-generators/yield-star-getiter-sync-not-callable-object-throw.case
|
||||
// - src/async-generators/default/async-expression-named.template
|
||||
/*---
|
||||
description: Throws a TypeError on a non-callable [Symbol.iterator] (object) (Named async generator expression)
|
||||
esid: prod-AsyncGeneratorExpression
|
||||
features: [async-iteration]
|
||||
flags: [generated, async]
|
||||
info: |
|
||||
Async Generator Function Definitions
|
||||
|
||||
AsyncGeneratorExpression :
|
||||
async [no LineTerminator here] function * BindingIdentifier ( FormalParameters ) {
|
||||
AsyncGeneratorBody }
|
||||
|
||||
|
||||
YieldExpression: yield * AssignmentExpression
|
||||
|
||||
1. Let exprRef be the result of evaluating AssignmentExpression.
|
||||
2. Let value be ? GetValue(exprRef).
|
||||
3. Let generatorKind be ! GetGeneratorKind().
|
||||
4. Let iterator be ? GetIterator(value, generatorKind).
|
||||
...
|
||||
|
||||
GetIterator ( obj [ , hint ] )
|
||||
|
||||
...
|
||||
3. If hint is async,
|
||||
a. Set method to ? GetMethod(obj, @@asyncIterator).
|
||||
b. If method is undefined,
|
||||
i. Let syncMethod be ? GetMethod(obj, @@iterator).
|
||||
...
|
||||
|
||||
GetMethod ( V, P )
|
||||
|
||||
...
|
||||
2. Let func be ? GetV(V, P).
|
||||
...
|
||||
4. If IsCallable(func) is false, throw a TypeError exception.
|
||||
...
|
||||
|
||||
---*/
|
||||
var obj = {
|
||||
[Symbol.iterator]: {}
|
||||
};
|
||||
|
||||
|
||||
|
||||
var callCount = 0;
|
||||
|
||||
var gen = async function *g() {
|
||||
callCount += 1;
|
||||
yield* obj;
|
||||
throw new Test262Error('abrupt completion closes iter');
|
||||
|
||||
};
|
||||
|
||||
var iter = gen();
|
||||
|
||||
iter.next().then(() => {
|
||||
throw new Test262Error('Promise incorrectly fulfilled.');
|
||||
}, v => {
|
||||
assert.sameValue(v.constructor, TypeError, "TypeError");
|
||||
|
||||
iter.next().then(({ done, value }) => {
|
||||
assert.sameValue(done, true, 'the iterator is completed');
|
||||
assert.sameValue(value, undefined, 'value is undefined');
|
||||
}).then($DONE, $DONE);
|
||||
}).catch($DONE);
|
||||
|
||||
assert.sameValue(callCount, 1);
|
|
@ -0,0 +1,71 @@
|
|||
// This file was procedurally generated from the following sources:
|
||||
// - src/async-generators/yield-star-getiter-sync-not-callable-string-throw.case
|
||||
// - src/async-generators/default/async-expression-named.template
|
||||
/*---
|
||||
description: Throws a TypeError on a non-callable [Symbol.iterator] (string) (Named async generator expression)
|
||||
esid: prod-AsyncGeneratorExpression
|
||||
features: [async-iteration]
|
||||
flags: [generated, async]
|
||||
info: |
|
||||
Async Generator Function Definitions
|
||||
|
||||
AsyncGeneratorExpression :
|
||||
async [no LineTerminator here] function * BindingIdentifier ( FormalParameters ) {
|
||||
AsyncGeneratorBody }
|
||||
|
||||
|
||||
YieldExpression: yield * AssignmentExpression
|
||||
|
||||
1. Let exprRef be the result of evaluating AssignmentExpression.
|
||||
2. Let value be ? GetValue(exprRef).
|
||||
3. Let generatorKind be ! GetGeneratorKind().
|
||||
4. Let iterator be ? GetIterator(value, generatorKind).
|
||||
...
|
||||
|
||||
GetIterator ( obj [ , hint ] )
|
||||
|
||||
...
|
||||
3. If hint is async,
|
||||
a. Set method to ? GetMethod(obj, @@asyncIterator).
|
||||
b. If method is undefined,
|
||||
i. Let syncMethod be ? GetMethod(obj, @@iterator).
|
||||
...
|
||||
|
||||
GetMethod ( V, P )
|
||||
|
||||
...
|
||||
2. Let func be ? GetV(V, P).
|
||||
...
|
||||
4. If IsCallable(func) is false, throw a TypeError exception.
|
||||
...
|
||||
|
||||
---*/
|
||||
var obj = {
|
||||
[Symbol.iterator]: ''
|
||||
};
|
||||
|
||||
|
||||
|
||||
var callCount = 0;
|
||||
|
||||
var gen = async function *g() {
|
||||
callCount += 1;
|
||||
yield* obj;
|
||||
throw new Test262Error('abrupt completion closes iter');
|
||||
|
||||
};
|
||||
|
||||
var iter = gen();
|
||||
|
||||
iter.next().then(() => {
|
||||
throw new Test262Error('Promise incorrectly fulfilled.');
|
||||
}, v => {
|
||||
assert.sameValue(v.constructor, TypeError, "TypeError");
|
||||
|
||||
iter.next().then(({ done, value }) => {
|
||||
assert.sameValue(done, true, 'the iterator is completed');
|
||||
assert.sameValue(value, undefined, 'value is undefined');
|
||||
}).then($DONE, $DONE);
|
||||
}).catch($DONE);
|
||||
|
||||
assert.sameValue(callCount, 1);
|
|
@ -0,0 +1,71 @@
|
|||
// This file was procedurally generated from the following sources:
|
||||
// - src/async-generators/yield-star-getiter-sync-not-callable-symbol-throw.case
|
||||
// - src/async-generators/default/async-expression-named.template
|
||||
/*---
|
||||
description: Throws a TypeError on a non-callable [Symbol.iterator] (symbol) (Named async generator expression)
|
||||
esid: prod-AsyncGeneratorExpression
|
||||
features: [Symbol.asyncIterator, async-iteration]
|
||||
flags: [generated, async]
|
||||
info: |
|
||||
Async Generator Function Definitions
|
||||
|
||||
AsyncGeneratorExpression :
|
||||
async [no LineTerminator here] function * BindingIdentifier ( FormalParameters ) {
|
||||
AsyncGeneratorBody }
|
||||
|
||||
|
||||
YieldExpression: yield * AssignmentExpression
|
||||
|
||||
1. Let exprRef be the result of evaluating AssignmentExpression.
|
||||
2. Let value be ? GetValue(exprRef).
|
||||
3. Let generatorKind be ! GetGeneratorKind().
|
||||
4. Let iterator be ? GetIterator(value, generatorKind).
|
||||
...
|
||||
|
||||
GetIterator ( obj [ , hint ] )
|
||||
|
||||
...
|
||||
3. If hint is async,
|
||||
a. Set method to ? GetMethod(obj, @@asyncIterator).
|
||||
b. If method is undefined,
|
||||
i. Let syncMethod be ? GetMethod(obj, @@iterator).
|
||||
...
|
||||
|
||||
GetMethod ( V, P )
|
||||
|
||||
...
|
||||
2. Let func be ? GetV(V, P).
|
||||
...
|
||||
4. If IsCallable(func) is false, throw a TypeError exception.
|
||||
...
|
||||
|
||||
---*/
|
||||
var obj = {
|
||||
[Symbol.iterator]: Symbol.iterator
|
||||
};
|
||||
|
||||
|
||||
|
||||
var callCount = 0;
|
||||
|
||||
var gen = async function *g() {
|
||||
callCount += 1;
|
||||
yield* obj;
|
||||
throw new Test262Error('abrupt completion closes iter');
|
||||
|
||||
};
|
||||
|
||||
var iter = gen();
|
||||
|
||||
iter.next().then(() => {
|
||||
throw new Test262Error('Promise incorrectly fulfilled.');
|
||||
}, v => {
|
||||
assert.sameValue(v.constructor, TypeError, "TypeError");
|
||||
|
||||
iter.next().then(({ done, value }) => {
|
||||
assert.sameValue(done, true, 'the iterator is completed');
|
||||
assert.sameValue(value, undefined, 'value is undefined');
|
||||
}).then($DONE, $DONE);
|
||||
}).catch($DONE);
|
||||
|
||||
assert.sameValue(callCount, 1);
|
|
@ -0,0 +1,66 @@
|
|||
// This file was procedurally generated from the following sources:
|
||||
// - src/async-generators/yield-star-getiter-sync-returns-abrupt.case
|
||||
// - src/async-generators/default/async-expression-named.template
|
||||
/*---
|
||||
description: Abrupt completion while calling [Symbol.iterator] (Named async generator expression)
|
||||
esid: prod-AsyncGeneratorExpression
|
||||
features: [Symbol.asyncIterator, async-iteration]
|
||||
flags: [generated, async]
|
||||
info: |
|
||||
Async Generator Function Definitions
|
||||
|
||||
AsyncGeneratorExpression :
|
||||
async [no LineTerminator here] function * BindingIdentifier ( FormalParameters ) {
|
||||
AsyncGeneratorBody }
|
||||
|
||||
|
||||
YieldExpression: yield * AssignmentExpression
|
||||
|
||||
1. Let exprRef be the result of evaluating AssignmentExpression.
|
||||
2. Let value be ? GetValue(exprRef).
|
||||
3. Let generatorKind be ! GetGeneratorKind().
|
||||
4. Let iterator be ? GetIterator(value, generatorKind).
|
||||
...
|
||||
|
||||
GetIterator ( obj [ , hint ] )
|
||||
|
||||
...
|
||||
3. If hint is async,
|
||||
a. Set method to ? GetMethod(obj, @@asyncIterator).
|
||||
i. Let syncMethod be ? GetMethod(obj, @@iterator).
|
||||
ii. Let syncIterator be ? Call(syncMethod, obj).
|
||||
...
|
||||
|
||||
---*/
|
||||
var reason = {};
|
||||
var obj = {
|
||||
[Symbol.iterator]() {
|
||||
throw reason;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
|
||||
var callCount = 0;
|
||||
|
||||
var gen = async function *g() {
|
||||
callCount += 1;
|
||||
yield* obj;
|
||||
throw new Test262Error('abrupt completion closes iter');
|
||||
|
||||
};
|
||||
|
||||
var iter = gen();
|
||||
|
||||
iter.next().then(() => {
|
||||
throw new Test262Error('Promise incorrectly fulfilled.');
|
||||
}, v => {
|
||||
assert.sameValue(v, reason, "reject reason");
|
||||
|
||||
iter.next().then(({ done, value }) => {
|
||||
assert.sameValue(done, true, 'the iterator is completed');
|
||||
assert.sameValue(value, undefined, 'value is undefined');
|
||||
}).then($DONE, $DONE);
|
||||
}).catch($DONE);
|
||||
|
||||
assert.sameValue(callCount, 1);
|
|
@ -0,0 +1,71 @@
|
|||
// This file was procedurally generated from the following sources:
|
||||
// - src/async-generators/yield-star-getiter-sync-returns-boolean-throw.case
|
||||
// - src/async-generators/default/async-expression-named.template
|
||||
/*---
|
||||
description: Non object returned by [Symbol.iterator]() - boolean (Named async generator expression)
|
||||
esid: prod-AsyncGeneratorExpression
|
||||
features: [async-iteration]
|
||||
flags: [generated, async]
|
||||
info: |
|
||||
Async Generator Function Definitions
|
||||
|
||||
AsyncGeneratorExpression :
|
||||
async [no LineTerminator here] function * BindingIdentifier ( FormalParameters ) {
|
||||
AsyncGeneratorBody }
|
||||
|
||||
|
||||
YieldExpression: yield * AssignmentExpression
|
||||
|
||||
1. Let exprRef be the result of evaluating AssignmentExpression.
|
||||
2. Let value be ? GetValue(exprRef).
|
||||
3. Let generatorKind be ! GetGeneratorKind().
|
||||
4. Let iterator be ? GetIterator(value, generatorKind).
|
||||
...
|
||||
|
||||
GetIterator ( obj [ , hint ] )
|
||||
|
||||
...
|
||||
3. If hint is async,
|
||||
a. Set method to ? GetMethod(obj, @@asyncIterator).
|
||||
i. Let syncMethod be ? GetMethod(obj, @@iterator).
|
||||
ii. Let syncIterator be ? Call(syncMethod, obj).
|
||||
iii. Return ? CreateAsyncFromSyncIterator(syncIterator).
|
||||
...
|
||||
|
||||
CreateAsyncFromSyncIterator(syncIterator)
|
||||
|
||||
1. If Type(syncIterator) is not Object, throw a TypeError exception.
|
||||
...
|
||||
|
||||
---*/
|
||||
var obj = {
|
||||
[Symbol.iterator]() {
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
|
||||
var callCount = 0;
|
||||
|
||||
var gen = async function *g() {
|
||||
callCount += 1;
|
||||
yield* obj;
|
||||
throw new Test262Error('abrupt completion closes iter');
|
||||
|
||||
};
|
||||
|
||||
var iter = gen();
|
||||
|
||||
iter.next().then(() => {
|
||||
throw new Test262Error('Promise incorrectly fulfilled.');
|
||||
}, v => {
|
||||
assert.sameValue(v.constructor, TypeError, "TypeError");
|
||||
|
||||
iter.next().then(({ done, value }) => {
|
||||
assert.sameValue(done, true, 'the iterator is completed');
|
||||
assert.sameValue(value, undefined, 'value is undefined');
|
||||
}).then($DONE, $DONE);
|
||||
}).catch($DONE);
|
||||
|
||||
assert.sameValue(callCount, 1);
|
|
@ -0,0 +1,71 @@
|
|||
// This file was procedurally generated from the following sources:
|
||||
// - src/async-generators/yield-star-getiter-sync-returns-null-throw.case
|
||||
// - src/async-generators/default/async-expression-named.template
|
||||
/*---
|
||||
description: Non object returned by [Symbol.iterator]() - null (Named async generator expression)
|
||||
esid: prod-AsyncGeneratorExpression
|
||||
features: [async-iteration]
|
||||
flags: [generated, async]
|
||||
info: |
|
||||
Async Generator Function Definitions
|
||||
|
||||
AsyncGeneratorExpression :
|
||||
async [no LineTerminator here] function * BindingIdentifier ( FormalParameters ) {
|
||||
AsyncGeneratorBody }
|
||||
|
||||
|
||||
YieldExpression: yield * AssignmentExpression
|
||||
|
||||
1. Let exprRef be the result of evaluating AssignmentExpression.
|
||||
2. Let value be ? GetValue(exprRef).
|
||||
3. Let generatorKind be ! GetGeneratorKind().
|
||||
4. Let iterator be ? GetIterator(value, generatorKind).
|
||||
...
|
||||
|
||||
GetIterator ( obj [ , hint ] )
|
||||
|
||||
...
|
||||
3. If hint is async,
|
||||
a. Set method to ? GetMethod(obj, @@asyncIterator).
|
||||
i. Let syncMethod be ? GetMethod(obj, @@iterator).
|
||||
ii. Let syncIterator be ? Call(syncMethod, obj).
|
||||
iii. Return ? CreateAsyncFromSyncIterator(syncIterator).
|
||||
...
|
||||
|
||||
CreateAsyncFromSyncIterator(syncIterator)
|
||||
|
||||
1. If Type(syncIterator) is not Object, throw a TypeError exception.
|
||||
...
|
||||
|
||||
---*/
|
||||
var obj = {
|
||||
[Symbol.iterator]() {
|
||||
return null;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
|
||||
var callCount = 0;
|
||||
|
||||
var gen = async function *g() {
|
||||
callCount += 1;
|
||||
yield* obj;
|
||||
throw new Test262Error('abrupt completion closes iter');
|
||||
|
||||
};
|
||||
|
||||
var iter = gen();
|
||||
|
||||
iter.next().then(() => {
|
||||
throw new Test262Error('Promise incorrectly fulfilled.');
|
||||
}, v => {
|
||||
assert.sameValue(v.constructor, TypeError, "TypeError");
|
||||
|
||||
iter.next().then(({ done, value }) => {
|
||||
assert.sameValue(done, true, 'the iterator is completed');
|
||||
assert.sameValue(value, undefined, 'value is undefined');
|
||||
}).then($DONE, $DONE);
|
||||
}).catch($DONE);
|
||||
|
||||
assert.sameValue(callCount, 1);
|
|
@ -0,0 +1,71 @@
|
|||
// This file was procedurally generated from the following sources:
|
||||
// - src/async-generators/yield-star-getiter-sync-returns-number-throw.case
|
||||
// - src/async-generators/default/async-expression-named.template
|
||||
/*---
|
||||
description: Non object returned by [Symbol.iterator]() - number (Named async generator expression)
|
||||
esid: prod-AsyncGeneratorExpression
|
||||
features: [async-iteration]
|
||||
flags: [generated, async]
|
||||
info: |
|
||||
Async Generator Function Definitions
|
||||
|
||||
AsyncGeneratorExpression :
|
||||
async [no LineTerminator here] function * BindingIdentifier ( FormalParameters ) {
|
||||
AsyncGeneratorBody }
|
||||
|
||||
|
||||
YieldExpression: yield * AssignmentExpression
|
||||
|
||||
1. Let exprRef be the result of evaluating AssignmentExpression.
|
||||
2. Let value be ? GetValue(exprRef).
|
||||
3. Let generatorKind be ! GetGeneratorKind().
|
||||
4. Let iterator be ? GetIterator(value, generatorKind).
|
||||
...
|
||||
|
||||
GetIterator ( obj [ , hint ] )
|
||||
|
||||
...
|
||||
3. If hint is async,
|
||||
a. Set method to ? GetMethod(obj, @@asyncIterator).
|
||||
i. Let syncMethod be ? GetMethod(obj, @@iterator).
|
||||
ii. Let syncIterator be ? Call(syncMethod, obj).
|
||||
iii. Return ? CreateAsyncFromSyncIterator(syncIterator).
|
||||
...
|
||||
|
||||
CreateAsyncFromSyncIterator(syncIterator)
|
||||
|
||||
1. If Type(syncIterator) is not Object, throw a TypeError exception.
|
||||
...
|
||||
|
||||
---*/
|
||||
var obj = {
|
||||
[Symbol.iterator]() {
|
||||
return 0;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
|
||||
var callCount = 0;
|
||||
|
||||
var gen = async function *g() {
|
||||
callCount += 1;
|
||||
yield* obj;
|
||||
throw new Test262Error('abrupt completion closes iter');
|
||||
|
||||
};
|
||||
|
||||
var iter = gen();
|
||||
|
||||
iter.next().then(() => {
|
||||
throw new Test262Error('Promise incorrectly fulfilled.');
|
||||
}, v => {
|
||||
assert.sameValue(v.constructor, TypeError, "TypeError");
|
||||
|
||||
iter.next().then(({ done, value }) => {
|
||||
assert.sameValue(done, true, 'the iterator is completed');
|
||||
assert.sameValue(value, undefined, 'value is undefined');
|
||||
}).then($DONE, $DONE);
|
||||
}).catch($DONE);
|
||||
|
||||
assert.sameValue(callCount, 1);
|
|
@ -0,0 +1,71 @@
|
|||
// This file was procedurally generated from the following sources:
|
||||
// - src/async-generators/yield-star-getiter-sync-returns-string-throw.case
|
||||
// - src/async-generators/default/async-expression-named.template
|
||||
/*---
|
||||
description: Non object returned by [Symbol.iterator]() - string (Named async generator expression)
|
||||
esid: prod-AsyncGeneratorExpression
|
||||
features: [async-iteration]
|
||||
flags: [generated, async]
|
||||
info: |
|
||||
Async Generator Function Definitions
|
||||
|
||||
AsyncGeneratorExpression :
|
||||
async [no LineTerminator here] function * BindingIdentifier ( FormalParameters ) {
|
||||
AsyncGeneratorBody }
|
||||
|
||||
|
||||
YieldExpression: yield * AssignmentExpression
|
||||
|
||||
1. Let exprRef be the result of evaluating AssignmentExpression.
|
||||
2. Let value be ? GetValue(exprRef).
|
||||
3. Let generatorKind be ! GetGeneratorKind().
|
||||
4. Let iterator be ? GetIterator(value, generatorKind).
|
||||
...
|
||||
|
||||
GetIterator ( obj [ , hint ] )
|
||||
|
||||
...
|
||||
3. If hint is async,
|
||||
a. Set method to ? GetMethod(obj, @@asyncIterator).
|
||||
i. Let syncMethod be ? GetMethod(obj, @@iterator).
|
||||
ii. Let syncIterator be ? Call(syncMethod, obj).
|
||||
iii. Return ? CreateAsyncFromSyncIterator(syncIterator).
|
||||
...
|
||||
|
||||
CreateAsyncFromSyncIterator(syncIterator)
|
||||
|
||||
1. If Type(syncIterator) is not Object, throw a TypeError exception.
|
||||
...
|
||||
|
||||
---*/
|
||||
var obj = {
|
||||
[Symbol.iterator]() {
|
||||
return '';
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
|
||||
var callCount = 0;
|
||||
|
||||
var gen = async function *g() {
|
||||
callCount += 1;
|
||||
yield* obj;
|
||||
throw new Test262Error('abrupt completion closes iter');
|
||||
|
||||
};
|
||||
|
||||
var iter = gen();
|
||||
|
||||
iter.next().then(() => {
|
||||
throw new Test262Error('Promise incorrectly fulfilled.');
|
||||
}, v => {
|
||||
assert.sameValue(v.constructor, TypeError, "TypeError");
|
||||
|
||||
iter.next().then(({ done, value }) => {
|
||||
assert.sameValue(done, true, 'the iterator is completed');
|
||||
assert.sameValue(value, undefined, 'value is undefined');
|
||||
}).then($DONE, $DONE);
|
||||
}).catch($DONE);
|
||||
|
||||
assert.sameValue(callCount, 1);
|
|
@ -0,0 +1,71 @@
|
|||
// This file was procedurally generated from the following sources:
|
||||
// - src/async-generators/yield-star-getiter-sync-returns-symbol-throw.case
|
||||
// - src/async-generators/default/async-expression-named.template
|
||||
/*---
|
||||
description: Non object returned by [Symbol.iterator]() - symbol (Named async generator expression)
|
||||
esid: prod-AsyncGeneratorExpression
|
||||
features: [async-iteration]
|
||||
flags: [generated, async]
|
||||
info: |
|
||||
Async Generator Function Definitions
|
||||
|
||||
AsyncGeneratorExpression :
|
||||
async [no LineTerminator here] function * BindingIdentifier ( FormalParameters ) {
|
||||
AsyncGeneratorBody }
|
||||
|
||||
|
||||
YieldExpression: yield * AssignmentExpression
|
||||
|
||||
1. Let exprRef be the result of evaluating AssignmentExpression.
|
||||
2. Let value be ? GetValue(exprRef).
|
||||
3. Let generatorKind be ! GetGeneratorKind().
|
||||
4. Let iterator be ? GetIterator(value, generatorKind).
|
||||
...
|
||||
|
||||
GetIterator ( obj [ , hint ] )
|
||||
|
||||
...
|
||||
3. If hint is async,
|
||||
a. Set method to ? GetMethod(obj, @@asyncIterator).
|
||||
i. Let syncMethod be ? GetMethod(obj, @@iterator).
|
||||
ii. Let syncIterator be ? Call(syncMethod, obj).
|
||||
iii. Return ? CreateAsyncFromSyncIterator(syncIterator).
|
||||
...
|
||||
|
||||
CreateAsyncFromSyncIterator(syncIterator)
|
||||
|
||||
1. If Type(syncIterator) is not Object, throw a TypeError exception.
|
||||
...
|
||||
|
||||
---*/
|
||||
var obj = {
|
||||
[Symbol.iterator]() {
|
||||
return Symbol.iterator;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
|
||||
var callCount = 0;
|
||||
|
||||
var gen = async function *g() {
|
||||
callCount += 1;
|
||||
yield* obj;
|
||||
throw new Test262Error('abrupt completion closes iter');
|
||||
|
||||
};
|
||||
|
||||
var iter = gen();
|
||||
|
||||
iter.next().then(() => {
|
||||
throw new Test262Error('Promise incorrectly fulfilled.');
|
||||
}, v => {
|
||||
assert.sameValue(v.constructor, TypeError, "TypeError");
|
||||
|
||||
iter.next().then(({ done, value }) => {
|
||||
assert.sameValue(done, true, 'the iterator is completed');
|
||||
assert.sameValue(value, undefined, 'value is undefined');
|
||||
}).then($DONE, $DONE);
|
||||
}).catch($DONE);
|
||||
|
||||
assert.sameValue(callCount, 1);
|
|
@ -0,0 +1,71 @@
|
|||
// This file was procedurally generated from the following sources:
|
||||
// - src/async-generators/yield-star-getiter-sync-returns-undefined-throw.case
|
||||
// - src/async-generators/default/async-expression-named.template
|
||||
/*---
|
||||
description: Non object returned by [Symbol.iterator]() - undefined (Named async generator expression)
|
||||
esid: prod-AsyncGeneratorExpression
|
||||
features: [async-iteration]
|
||||
flags: [generated, async]
|
||||
info: |
|
||||
Async Generator Function Definitions
|
||||
|
||||
AsyncGeneratorExpression :
|
||||
async [no LineTerminator here] function * BindingIdentifier ( FormalParameters ) {
|
||||
AsyncGeneratorBody }
|
||||
|
||||
|
||||
YieldExpression: yield * AssignmentExpression
|
||||
|
||||
1. Let exprRef be the result of evaluating AssignmentExpression.
|
||||
2. Let value be ? GetValue(exprRef).
|
||||
3. Let generatorKind be ! GetGeneratorKind().
|
||||
4. Let iterator be ? GetIterator(value, generatorKind).
|
||||
...
|
||||
|
||||
GetIterator ( obj [ , hint ] )
|
||||
|
||||
...
|
||||
3. If hint is async,
|
||||
a. Set method to ? GetMethod(obj, @@asyncIterator).
|
||||
i. Let syncMethod be ? GetMethod(obj, @@iterator).
|
||||
ii. Let syncIterator be ? Call(syncMethod, obj).
|
||||
iii. Return ? CreateAsyncFromSyncIterator(syncIterator).
|
||||
...
|
||||
|
||||
CreateAsyncFromSyncIterator(syncIterator)
|
||||
|
||||
1. If Type(syncIterator) is not Object, throw a TypeError exception.
|
||||
...
|
||||
|
||||
---*/
|
||||
var obj = {
|
||||
[Symbol.iterator]() {
|
||||
return undefined;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
|
||||
var callCount = 0;
|
||||
|
||||
var gen = async function *g() {
|
||||
callCount += 1;
|
||||
yield* obj;
|
||||
throw new Test262Error('abrupt completion closes iter');
|
||||
|
||||
};
|
||||
|
||||
var iter = gen();
|
||||
|
||||
iter.next().then(() => {
|
||||
throw new Test262Error('Promise incorrectly fulfilled.');
|
||||
}, v => {
|
||||
assert.sameValue(v.constructor, TypeError, "TypeError");
|
||||
|
||||
iter.next().then(({ done, value }) => {
|
||||
assert.sameValue(done, true, 'the iterator is completed');
|
||||
assert.sameValue(value, undefined, 'value is undefined');
|
||||
}).then($DONE, $DONE);
|
||||
}).catch($DONE);
|
||||
|
||||
assert.sameValue(callCount, 1);
|
|
@ -0,0 +1,53 @@
|
|||
// This file was procedurally generated from the following sources:
|
||||
// - src/async-generators/yield-star-expr-abrupt.case
|
||||
// - src/async-generators/default/async-expression.template
|
||||
/*---
|
||||
description: Abrupt completion while getting yield* operand (Unnamed async generator expression)
|
||||
esid: prod-AsyncGeneratorExpression
|
||||
features: [async-iteration]
|
||||
flags: [generated, async]
|
||||
info: |
|
||||
Async Generator Function Definitions
|
||||
|
||||
AsyncGeneratorExpression :
|
||||
async [no LineTerminator here] function * BindingIdentifier ( FormalParameters ) {
|
||||
AsyncGeneratorBody }
|
||||
|
||||
|
||||
YieldExpression: yield * AssignmentExpression
|
||||
|
||||
1. Let exprRef be the result of evaluating AssignmentExpression.
|
||||
2. Let value be ? GetValue(exprRef).
|
||||
...
|
||||
|
||||
---*/
|
||||
var obj = {};
|
||||
var abrupt = function() {
|
||||
throw obj;
|
||||
};
|
||||
|
||||
|
||||
|
||||
var callCount = 0;
|
||||
|
||||
var gen = async function *() {
|
||||
callCount += 1;
|
||||
yield* abrupt();
|
||||
throw new Test262Error('abrupt completion closes iter');
|
||||
|
||||
};
|
||||
|
||||
var iter = gen();
|
||||
|
||||
iter.next().then(() => {
|
||||
throw new Test262Error('Promise incorrectly fulfilled.');
|
||||
}, v => {
|
||||
assert.sameValue(v, obj, "reject reason");
|
||||
|
||||
iter.next().then(({ done, value }) => {
|
||||
assert.sameValue(done, true, 'the iterator is completed');
|
||||
assert.sameValue(value, undefined, 'value is undefined');
|
||||
}).then($DONE, $DONE);
|
||||
}).catch($DONE);
|
||||
|
||||
assert.sameValue(callCount, 1);
|
|
@ -0,0 +1,73 @@
|
|||
// This file was procedurally generated from the following sources:
|
||||
// - src/async-generators/yield-star-getiter-async-get-abrupt.case
|
||||
// - src/async-generators/default/async-expression.template
|
||||
/*---
|
||||
description: Abrupt completion while getting [Symbol.asyncIterator] (Unnamed async generator expression)
|
||||
esid: prod-AsyncGeneratorExpression
|
||||
features: [Symbol.asyncIterator, async-iteration]
|
||||
flags: [generated, async]
|
||||
info: |
|
||||
Async Generator Function Definitions
|
||||
|
||||
AsyncGeneratorExpression :
|
||||
async [no LineTerminator here] function * BindingIdentifier ( FormalParameters ) {
|
||||
AsyncGeneratorBody }
|
||||
|
||||
|
||||
YieldExpression: yield * AssignmentExpression
|
||||
|
||||
1. Let exprRef be the result of evaluating AssignmentExpression.
|
||||
2. Let value be ? GetValue(exprRef).
|
||||
3. Let generatorKind be ! GetGeneratorKind().
|
||||
4. Let iterator be ? GetIterator(value, generatorKind).
|
||||
...
|
||||
|
||||
GetIterator ( obj [ , hint ] )
|
||||
|
||||
...
|
||||
3. If hint is async,
|
||||
a. Set method to ? GetMethod(obj, @@asyncIterator).
|
||||
...
|
||||
|
||||
GetMethod ( V, P )
|
||||
|
||||
...
|
||||
2. Let func be ? GetV(V, P).
|
||||
...
|
||||
|
||||
---*/
|
||||
var reason = {};
|
||||
var obj = {
|
||||
get [Symbol.iterator]() {
|
||||
throw new Test262Error('it should not get Symbol.iterator');
|
||||
},
|
||||
get [Symbol.asyncIterator]() {
|
||||
throw reason;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
|
||||
var callCount = 0;
|
||||
|
||||
var gen = async function *() {
|
||||
callCount += 1;
|
||||
yield* obj;
|
||||
throw new Test262Error('abrupt completion closes iter');
|
||||
|
||||
};
|
||||
|
||||
var iter = gen();
|
||||
|
||||
iter.next().then(() => {
|
||||
throw new Test262Error('Promise incorrectly fulfilled.');
|
||||
}, v => {
|
||||
assert.sameValue(v, reason, "reject reason");
|
||||
|
||||
iter.next().then(({ done, value }) => {
|
||||
assert.sameValue(done, true, 'the iterator is completed');
|
||||
assert.sameValue(value, undefined, 'value is undefined');
|
||||
}).then($DONE, $DONE);
|
||||
}).catch($DONE);
|
||||
|
||||
assert.sameValue(callCount, 1);
|
|
@ -0,0 +1,72 @@
|
|||
// This file was procedurally generated from the following sources:
|
||||
// - src/async-generators/yield-star-getiter-async-not-callable-boolean-throw.case
|
||||
// - src/async-generators/default/async-expression.template
|
||||
/*---
|
||||
description: Throws a TypeError on a non-callable [Symbol.asyncIterator] (boolean) (Unnamed async generator expression)
|
||||
esid: prod-AsyncGeneratorExpression
|
||||
features: [Symbol.asyncIterator, async-iteration]
|
||||
flags: [generated, async]
|
||||
info: |
|
||||
Async Generator Function Definitions
|
||||
|
||||
AsyncGeneratorExpression :
|
||||
async [no LineTerminator here] function * BindingIdentifier ( FormalParameters ) {
|
||||
AsyncGeneratorBody }
|
||||
|
||||
|
||||
YieldExpression: yield * AssignmentExpression
|
||||
|
||||
1. Let exprRef be the result of evaluating AssignmentExpression.
|
||||
2. Let value be ? GetValue(exprRef).
|
||||
3. Let generatorKind be ! GetGeneratorKind().
|
||||
4. Let iterator be ? GetIterator(value, generatorKind).
|
||||
...
|
||||
|
||||
GetIterator ( obj [ , hint ] )
|
||||
|
||||
...
|
||||
3. If hint is async,
|
||||
a. Set method to ? GetMethod(obj, @@asyncIterator).
|
||||
...
|
||||
|
||||
GetMethod ( V, P )
|
||||
|
||||
...
|
||||
2. Let func be ? GetV(V, P).
|
||||
3. If func is either undefined or null, return undefined.
|
||||
4. If IsCallable(func) is false, throw a TypeError exception.
|
||||
...
|
||||
|
||||
---*/
|
||||
var obj = {
|
||||
get [Symbol.iterator]() {
|
||||
throw new Test262Error('it should not get Symbol.iterator');
|
||||
},
|
||||
[Symbol.asyncIterator]: false
|
||||
};
|
||||
|
||||
|
||||
|
||||
var callCount = 0;
|
||||
|
||||
var gen = async function *() {
|
||||
callCount += 1;
|
||||
yield* obj;
|
||||
throw new Test262Error('abrupt completion closes iter');
|
||||
|
||||
};
|
||||
|
||||
var iter = gen();
|
||||
|
||||
iter.next().then(() => {
|
||||
throw new Test262Error('Promise incorrectly fulfilled.');
|
||||
}, v => {
|
||||
assert.sameValue(v.constructor, TypeError, "TypeError");
|
||||
|
||||
iter.next().then(({ done, value }) => {
|
||||
assert.sameValue(done, true, 'the iterator is completed');
|
||||
assert.sameValue(value, undefined, 'value is undefined');
|
||||
}).then($DONE, $DONE);
|
||||
}).catch($DONE);
|
||||
|
||||
assert.sameValue(callCount, 1);
|
|
@ -0,0 +1,72 @@
|
|||
// This file was procedurally generated from the following sources:
|
||||
// - src/async-generators/yield-star-getiter-async-not-callable-number-throw.case
|
||||
// - src/async-generators/default/async-expression.template
|
||||
/*---
|
||||
description: Throws a TypeError on a non-callable [Symbol.asyncIterator] (number) (Unnamed async generator expression)
|
||||
esid: prod-AsyncGeneratorExpression
|
||||
features: [Symbol.asyncIterator, async-iteration]
|
||||
flags: [generated, async]
|
||||
info: |
|
||||
Async Generator Function Definitions
|
||||
|
||||
AsyncGeneratorExpression :
|
||||
async [no LineTerminator here] function * BindingIdentifier ( FormalParameters ) {
|
||||
AsyncGeneratorBody }
|
||||
|
||||
|
||||
YieldExpression: yield * AssignmentExpression
|
||||
|
||||
1. Let exprRef be the result of evaluating AssignmentExpression.
|
||||
2. Let value be ? GetValue(exprRef).
|
||||
3. Let generatorKind be ! GetGeneratorKind().
|
||||
4. Let iterator be ? GetIterator(value, generatorKind).
|
||||
...
|
||||
|
||||
GetIterator ( obj [ , hint ] )
|
||||
|
||||
...
|
||||
3. If hint is async,
|
||||
a. Set method to ? GetMethod(obj, @@asyncIterator).
|
||||
...
|
||||
|
||||
GetMethod ( V, P )
|
||||
|
||||
...
|
||||
2. Let func be ? GetV(V, P).
|
||||
3. If func is either undefined or null, return undefined.
|
||||
4. If IsCallable(func) is false, throw a TypeError exception.
|
||||
...
|
||||
|
||||
---*/
|
||||
var obj = {
|
||||
get [Symbol.iterator]() {
|
||||
throw new Test262Error('it should not get Symbol.iterator');
|
||||
},
|
||||
[Symbol.asyncIterator]: 0
|
||||
};
|
||||
|
||||
|
||||
|
||||
var callCount = 0;
|
||||
|
||||
var gen = async function *() {
|
||||
callCount += 1;
|
||||
yield* obj;
|
||||
throw new Test262Error('abrupt completion closes iter');
|
||||
|
||||
};
|
||||
|
||||
var iter = gen();
|
||||
|
||||
iter.next().then(() => {
|
||||
throw new Test262Error('Promise incorrectly fulfilled.');
|
||||
}, v => {
|
||||
assert.sameValue(v.constructor, TypeError, "TypeError");
|
||||
|
||||
iter.next().then(({ done, value }) => {
|
||||
assert.sameValue(done, true, 'the iterator is completed');
|
||||
assert.sameValue(value, undefined, 'value is undefined');
|
||||
}).then($DONE, $DONE);
|
||||
}).catch($DONE);
|
||||
|
||||
assert.sameValue(callCount, 1);
|
|
@ -0,0 +1,72 @@
|
|||
// This file was procedurally generated from the following sources:
|
||||
// - src/async-generators/yield-star-getiter-async-not-callable-object-throw.case
|
||||
// - src/async-generators/default/async-expression.template
|
||||
/*---
|
||||
description: Throws a TypeError on a non-callable [Symbol.asyncIterator] (object) (Unnamed async generator expression)
|
||||
esid: prod-AsyncGeneratorExpression
|
||||
features: [Symbol.asyncIterator, async-iteration]
|
||||
flags: [generated, async]
|
||||
info: |
|
||||
Async Generator Function Definitions
|
||||
|
||||
AsyncGeneratorExpression :
|
||||
async [no LineTerminator here] function * BindingIdentifier ( FormalParameters ) {
|
||||
AsyncGeneratorBody }
|
||||
|
||||
|
||||
YieldExpression: yield * AssignmentExpression
|
||||
|
||||
1. Let exprRef be the result of evaluating AssignmentExpression.
|
||||
2. Let value be ? GetValue(exprRef).
|
||||
3. Let generatorKind be ! GetGeneratorKind().
|
||||
4. Let iterator be ? GetIterator(value, generatorKind).
|
||||
...
|
||||
|
||||
GetIterator ( obj [ , hint ] )
|
||||
|
||||
...
|
||||
3. If hint is async,
|
||||
a. Set method to ? GetMethod(obj, @@asyncIterator).
|
||||
...
|
||||
|
||||
GetMethod ( V, P )
|
||||
|
||||
...
|
||||
2. Let func be ? GetV(V, P).
|
||||
3. If func is either undefined or null, return undefined.
|
||||
4. If IsCallable(func) is false, throw a TypeError exception.
|
||||
...
|
||||
|
||||
---*/
|
||||
var obj = {
|
||||
get [Symbol.iterator]() {
|
||||
throw new Test262Error('it should not get Symbol.iterator');
|
||||
},
|
||||
[Symbol.asyncIterator]: {}
|
||||
};
|
||||
|
||||
|
||||
|
||||
var callCount = 0;
|
||||
|
||||
var gen = async function *() {
|
||||
callCount += 1;
|
||||
yield* obj;
|
||||
throw new Test262Error('abrupt completion closes iter');
|
||||
|
||||
};
|
||||
|
||||
var iter = gen();
|
||||
|
||||
iter.next().then(() => {
|
||||
throw new Test262Error('Promise incorrectly fulfilled.');
|
||||
}, v => {
|
||||
assert.sameValue(v.constructor, TypeError, "TypeError");
|
||||
|
||||
iter.next().then(({ done, value }) => {
|
||||
assert.sameValue(done, true, 'the iterator is completed');
|
||||
assert.sameValue(value, undefined, 'value is undefined');
|
||||
}).then($DONE, $DONE);
|
||||
}).catch($DONE);
|
||||
|
||||
assert.sameValue(callCount, 1);
|
|
@ -0,0 +1,72 @@
|
|||
// This file was procedurally generated from the following sources:
|
||||
// - src/async-generators/yield-star-getiter-async-not-callable-string-throw.case
|
||||
// - src/async-generators/default/async-expression.template
|
||||
/*---
|
||||
description: Throws a TypeError on a non-callable [Symbol.asyncIterator] (string) (Unnamed async generator expression)
|
||||
esid: prod-AsyncGeneratorExpression
|
||||
features: [Symbol.asyncIterator, async-iteration]
|
||||
flags: [generated, async]
|
||||
info: |
|
||||
Async Generator Function Definitions
|
||||
|
||||
AsyncGeneratorExpression :
|
||||
async [no LineTerminator here] function * BindingIdentifier ( FormalParameters ) {
|
||||
AsyncGeneratorBody }
|
||||
|
||||
|
||||
YieldExpression: yield * AssignmentExpression
|
||||
|
||||
1. Let exprRef be the result of evaluating AssignmentExpression.
|
||||
2. Let value be ? GetValue(exprRef).
|
||||
3. Let generatorKind be ! GetGeneratorKind().
|
||||
4. Let iterator be ? GetIterator(value, generatorKind).
|
||||
...
|
||||
|
||||
GetIterator ( obj [ , hint ] )
|
||||
|
||||
...
|
||||
3. If hint is async,
|
||||
a. Set method to ? GetMethod(obj, @@asyncIterator).
|
||||
...
|
||||
|
||||
GetMethod ( V, P )
|
||||
|
||||
...
|
||||
2. Let func be ? GetV(V, P).
|
||||
3. If func is either undefined or null, return undefined.
|
||||
4. If IsCallable(func) is false, throw a TypeError exception.
|
||||
...
|
||||
|
||||
---*/
|
||||
var obj = {
|
||||
get [Symbol.iterator]() {
|
||||
throw new Test262Error('it should not get Symbol.iterator');
|
||||
},
|
||||
[Symbol.asyncIterator]: ''
|
||||
};
|
||||
|
||||
|
||||
|
||||
var callCount = 0;
|
||||
|
||||
var gen = async function *() {
|
||||
callCount += 1;
|
||||
yield* obj;
|
||||
throw new Test262Error('abrupt completion closes iter');
|
||||
|
||||
};
|
||||
|
||||
var iter = gen();
|
||||
|
||||
iter.next().then(() => {
|
||||
throw new Test262Error('Promise incorrectly fulfilled.');
|
||||
}, v => {
|
||||
assert.sameValue(v.constructor, TypeError, "TypeError");
|
||||
|
||||
iter.next().then(({ done, value }) => {
|
||||
assert.sameValue(done, true, 'the iterator is completed');
|
||||
assert.sameValue(value, undefined, 'value is undefined');
|
||||
}).then($DONE, $DONE);
|
||||
}).catch($DONE);
|
||||
|
||||
assert.sameValue(callCount, 1);
|
|
@ -0,0 +1,72 @@
|
|||
// This file was procedurally generated from the following sources:
|
||||
// - src/async-generators/yield-star-getiter-async-not-callable-symbol-throw.case
|
||||
// - src/async-generators/default/async-expression.template
|
||||
/*---
|
||||
description: Throws a TypeError on a non-callable [Symbol.asyncIterator] (symbol) (Unnamed async generator expression)
|
||||
esid: prod-AsyncGeneratorExpression
|
||||
features: [Symbol.asyncIterator, async-iteration]
|
||||
flags: [generated, async]
|
||||
info: |
|
||||
Async Generator Function Definitions
|
||||
|
||||
AsyncGeneratorExpression :
|
||||
async [no LineTerminator here] function * BindingIdentifier ( FormalParameters ) {
|
||||
AsyncGeneratorBody }
|
||||
|
||||
|
||||
YieldExpression: yield * AssignmentExpression
|
||||
|
||||
1. Let exprRef be the result of evaluating AssignmentExpression.
|
||||
2. Let value be ? GetValue(exprRef).
|
||||
3. Let generatorKind be ! GetGeneratorKind().
|
||||
4. Let iterator be ? GetIterator(value, generatorKind).
|
||||
...
|
||||
|
||||
GetIterator ( obj [ , hint ] )
|
||||
|
||||
...
|
||||
3. If hint is async,
|
||||
a. Set method to ? GetMethod(obj, @@asyncIterator).
|
||||
...
|
||||
|
||||
GetMethod ( V, P )
|
||||
|
||||
...
|
||||
2. Let func be ? GetV(V, P).
|
||||
3. If func is either undefined or null, return undefined.
|
||||
4. If IsCallable(func) is false, throw a TypeError exception.
|
||||
...
|
||||
|
||||
---*/
|
||||
var obj = {
|
||||
get [Symbol.iterator]() {
|
||||
throw new Test262Error('it should not get Symbol.iterator');
|
||||
},
|
||||
[Symbol.asyncIterator]: Symbol.asyncIterator
|
||||
};
|
||||
|
||||
|
||||
|
||||
var callCount = 0;
|
||||
|
||||
var gen = async function *() {
|
||||
callCount += 1;
|
||||
yield* obj;
|
||||
throw new Test262Error('abrupt completion closes iter');
|
||||
|
||||
};
|
||||
|
||||
var iter = gen();
|
||||
|
||||
iter.next().then(() => {
|
||||
throw new Test262Error('Promise incorrectly fulfilled.');
|
||||
}, v => {
|
||||
assert.sameValue(v.constructor, TypeError, "TypeError");
|
||||
|
||||
iter.next().then(({ done, value }) => {
|
||||
assert.sameValue(done, true, 'the iterator is completed');
|
||||
assert.sameValue(value, undefined, 'value is undefined');
|
||||
}).then($DONE, $DONE);
|
||||
}).catch($DONE);
|
||||
|
||||
assert.sameValue(callCount, 1);
|
|
@ -0,0 +1,78 @@
|
|||
// This file was procedurally generated from the following sources:
|
||||
// - src/async-generators/yield-star-getiter-async-null-sync-get-abrupt.case
|
||||
// - src/async-generators/default/async-expression.template
|
||||
/*---
|
||||
description: Abrupt completion while getting @@iterator after null @@asyncIterator (Unnamed async generator expression)
|
||||
esid: prod-AsyncGeneratorExpression
|
||||
features: [Symbol.asyncIterator, async-iteration]
|
||||
flags: [generated, async]
|
||||
info: |
|
||||
Async Generator Function Definitions
|
||||
|
||||
AsyncGeneratorExpression :
|
||||
async [no LineTerminator here] function * BindingIdentifier ( FormalParameters ) {
|
||||
AsyncGeneratorBody }
|
||||
|
||||
|
||||
YieldExpression: yield * AssignmentExpression
|
||||
|
||||
1. Let exprRef be the result of evaluating AssignmentExpression.
|
||||
2. Let value be ? GetValue(exprRef).
|
||||
3. Let generatorKind be ! GetGeneratorKind().
|
||||
4. Let iterator be ? GetIterator(value, generatorKind).
|
||||
...
|
||||
|
||||
GetIterator ( obj [ , hint ] )
|
||||
|
||||
...
|
||||
3. If hint is async,
|
||||
a. Set method to ? GetMethod(obj, @@asyncIterator).
|
||||
b. If method is undefined,
|
||||
i. Let syncMethod be ? GetMethod(obj, @@iterator).
|
||||
...
|
||||
|
||||
GetMethod ( V, P )
|
||||
|
||||
...
|
||||
2. Let func be ? GetV(V, P).
|
||||
...
|
||||
|
||||
---*/
|
||||
var calls = 0;
|
||||
var reason = {};
|
||||
var obj = {
|
||||
get [Symbol.iterator]() {
|
||||
throw reason;
|
||||
},
|
||||
get [Symbol.asyncIterator]() {
|
||||
calls += 1;
|
||||
return null;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
|
||||
var callCount = 0;
|
||||
|
||||
var gen = async function *() {
|
||||
callCount += 1;
|
||||
yield* obj;
|
||||
throw new Test262Error('abrupt completion closes iter');
|
||||
|
||||
};
|
||||
|
||||
var iter = gen();
|
||||
|
||||
iter.next().then(() => {
|
||||
throw new Test262Error('Promise incorrectly fulfilled.');
|
||||
}, v => {
|
||||
assert.sameValue(v, reason, 'reject reason');
|
||||
assert.sameValue(calls, 1);
|
||||
|
||||
iter.next().then(({ done, value }) => {
|
||||
assert.sameValue(done, true, 'the iterator is completed');
|
||||
assert.sameValue(value, undefined, 'value is undefined');
|
||||
}).then($DONE, $DONE);
|
||||
}).catch($DONE);
|
||||
|
||||
assert.sameValue(callCount, 1);
|
|
@ -0,0 +1,69 @@
|
|||
// This file was procedurally generated from the following sources:
|
||||
// - src/async-generators/yield-star-getiter-async-returns-abrupt.case
|
||||
// - src/async-generators/default/async-expression.template
|
||||
/*---
|
||||
description: Abrupt completion while calling [Symbol.asyncIterator] (Unnamed async generator expression)
|
||||
esid: prod-AsyncGeneratorExpression
|
||||
features: [Symbol.asyncIterator, async-iteration]
|
||||
flags: [generated, async]
|
||||
info: |
|
||||
Async Generator Function Definitions
|
||||
|
||||
AsyncGeneratorExpression :
|
||||
async [no LineTerminator here] function * BindingIdentifier ( FormalParameters ) {
|
||||
AsyncGeneratorBody }
|
||||
|
||||
|
||||
YieldExpression: yield * AssignmentExpression
|
||||
|
||||
1. Let exprRef be the result of evaluating AssignmentExpression.
|
||||
2. Let value be ? GetValue(exprRef).
|
||||
3. Let generatorKind be ! GetGeneratorKind().
|
||||
4. Let iterator be ? GetIterator(value, generatorKind).
|
||||
...
|
||||
|
||||
GetIterator ( obj [ , hint ] )
|
||||
|
||||
...
|
||||
3. If hint is async,
|
||||
a. Set method to ? GetMethod(obj, @@asyncIterator).
|
||||
...
|
||||
6. Let iterator be ? Call(method, obj).
|
||||
...
|
||||
|
||||
---*/
|
||||
var reason = {};
|
||||
var obj = {
|
||||
get [Symbol.iterator]() {
|
||||
throw new Test262Error('it should not get Symbol.iterator');
|
||||
},
|
||||
[Symbol.asyncIterator]() {
|
||||
throw reason;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
|
||||
var callCount = 0;
|
||||
|
||||
var gen = async function *() {
|
||||
callCount += 1;
|
||||
yield* obj;
|
||||
throw new Test262Error('abrupt completion closes iter');
|
||||
|
||||
};
|
||||
|
||||
var iter = gen();
|
||||
|
||||
iter.next().then(() => {
|
||||
throw new Test262Error('Promise incorrectly fulfilled.');
|
||||
}, v => {
|
||||
assert.sameValue(v, reason, "reject reason");
|
||||
|
||||
iter.next().then(({ done, value }) => {
|
||||
assert.sameValue(done, true, 'the iterator is completed');
|
||||
assert.sameValue(value, undefined, 'value is undefined');
|
||||
}).then($DONE, $DONE);
|
||||
}).catch($DONE);
|
||||
|
||||
assert.sameValue(callCount, 1);
|
|
@ -0,0 +1,69 @@
|
|||
// This file was procedurally generated from the following sources:
|
||||
// - src/async-generators/yield-star-getiter-async-returns-boolean-throw.case
|
||||
// - src/async-generators/default/async-expression.template
|
||||
/*---
|
||||
description: Non object returned by [Symbol.asyncIterator]() - boolean (Unnamed async generator expression)
|
||||
esid: prod-AsyncGeneratorExpression
|
||||
features: [Symbol.asyncIterator, async-iteration]
|
||||
flags: [generated, async]
|
||||
info: |
|
||||
Async Generator Function Definitions
|
||||
|
||||
AsyncGeneratorExpression :
|
||||
async [no LineTerminator here] function * BindingIdentifier ( FormalParameters ) {
|
||||
AsyncGeneratorBody }
|
||||
|
||||
|
||||
YieldExpression: yield * AssignmentExpression
|
||||
|
||||
1. Let exprRef be the result of evaluating AssignmentExpression.
|
||||
2. Let value be ? GetValue(exprRef).
|
||||
3. Let generatorKind be ! GetGeneratorKind().
|
||||
4. Let iterator be ? GetIterator(value, generatorKind).
|
||||
...
|
||||
|
||||
GetIterator ( obj [ , hint ] )
|
||||
|
||||
...
|
||||
3. If hint is async,
|
||||
a. Set method to ? GetMethod(obj, @@asyncIterator).
|
||||
...
|
||||
6. Let iterator be ? Call(method, obj).
|
||||
7. If Type(iterator) is not Object, throw a TypeError exception.
|
||||
...
|
||||
|
||||
---*/
|
||||
var obj = {
|
||||
get [Symbol.iterator]() {
|
||||
throw new Test262Error('it should not get Symbol.iterator');
|
||||
},
|
||||
[Symbol.asyncIterator]() {
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
|
||||
var callCount = 0;
|
||||
|
||||
var gen = async function *() {
|
||||
callCount += 1;
|
||||
yield* obj;
|
||||
throw new Test262Error('abrupt completion closes iter');
|
||||
|
||||
};
|
||||
|
||||
var iter = gen();
|
||||
|
||||
iter.next().then(() => {
|
||||
throw new Test262Error('Promise incorrectly fulfilled.');
|
||||
}, v => {
|
||||
assert.sameValue(v.constructor, TypeError, "TypeError");
|
||||
|
||||
iter.next().then(({ done, value }) => {
|
||||
assert.sameValue(done, true, 'the iterator is completed');
|
||||
assert.sameValue(value, undefined, 'value is undefined');
|
||||
}).then($DONE, $DONE);
|
||||
}).catch($DONE);
|
||||
|
||||
assert.sameValue(callCount, 1);
|
|
@ -0,0 +1,69 @@
|
|||
// This file was procedurally generated from the following sources:
|
||||
// - src/async-generators/yield-star-getiter-async-returns-null-throw.case
|
||||
// - src/async-generators/default/async-expression.template
|
||||
/*---
|
||||
description: Non object returned by [Symbol.asyncIterator]() - null (Unnamed async generator expression)
|
||||
esid: prod-AsyncGeneratorExpression
|
||||
features: [Symbol.asyncIterator, async-iteration]
|
||||
flags: [generated, async]
|
||||
info: |
|
||||
Async Generator Function Definitions
|
||||
|
||||
AsyncGeneratorExpression :
|
||||
async [no LineTerminator here] function * BindingIdentifier ( FormalParameters ) {
|
||||
AsyncGeneratorBody }
|
||||
|
||||
|
||||
YieldExpression: yield * AssignmentExpression
|
||||
|
||||
1. Let exprRef be the result of evaluating AssignmentExpression.
|
||||
2. Let value be ? GetValue(exprRef).
|
||||
3. Let generatorKind be ! GetGeneratorKind().
|
||||
4. Let iterator be ? GetIterator(value, generatorKind).
|
||||
...
|
||||
|
||||
GetIterator ( obj [ , hint ] )
|
||||
|
||||
...
|
||||
3. If hint is async,
|
||||
a. Set method to ? GetMethod(obj, @@asyncIterator).
|
||||
...
|
||||
6. Let iterator be ? Call(method, obj).
|
||||
7. If Type(iterator) is not Object, throw a TypeError exception.
|
||||
...
|
||||
|
||||
---*/
|
||||
var obj = {
|
||||
get [Symbol.iterator]() {
|
||||
throw new Test262Error('it should not get Symbol.iterator');
|
||||
},
|
||||
[Symbol.asyncIterator]() {
|
||||
return null;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
|
||||
var callCount = 0;
|
||||
|
||||
var gen = async function *() {
|
||||
callCount += 1;
|
||||
yield* obj;
|
||||
throw new Test262Error('abrupt completion closes iter');
|
||||
|
||||
};
|
||||
|
||||
var iter = gen();
|
||||
|
||||
iter.next().then(() => {
|
||||
throw new Test262Error('Promise incorrectly fulfilled.');
|
||||
}, v => {
|
||||
assert.sameValue(v.constructor, TypeError, "TypeError");
|
||||
|
||||
iter.next().then(({ done, value }) => {
|
||||
assert.sameValue(done, true, 'the iterator is completed');
|
||||
assert.sameValue(value, undefined, 'value is undefined');
|
||||
}).then($DONE, $DONE);
|
||||
}).catch($DONE);
|
||||
|
||||
assert.sameValue(callCount, 1);
|
|
@ -0,0 +1,69 @@
|
|||
// This file was procedurally generated from the following sources:
|
||||
// - src/async-generators/yield-star-getiter-async-returns-number-throw.case
|
||||
// - src/async-generators/default/async-expression.template
|
||||
/*---
|
||||
description: Non object returned by [Symbol.asyncIterator]() - number (Unnamed async generator expression)
|
||||
esid: prod-AsyncGeneratorExpression
|
||||
features: [Symbol.asyncIterator, async-iteration]
|
||||
flags: [generated, async]
|
||||
info: |
|
||||
Async Generator Function Definitions
|
||||
|
||||
AsyncGeneratorExpression :
|
||||
async [no LineTerminator here] function * BindingIdentifier ( FormalParameters ) {
|
||||
AsyncGeneratorBody }
|
||||
|
||||
|
||||
YieldExpression: yield * AssignmentExpression
|
||||
|
||||
1. Let exprRef be the result of evaluating AssignmentExpression.
|
||||
2. Let value be ? GetValue(exprRef).
|
||||
3. Let generatorKind be ! GetGeneratorKind().
|
||||
4. Let iterator be ? GetIterator(value, generatorKind).
|
||||
...
|
||||
|
||||
GetIterator ( obj [ , hint ] )
|
||||
|
||||
...
|
||||
3. If hint is async,
|
||||
a. Set method to ? GetMethod(obj, @@asyncIterator).
|
||||
...
|
||||
6. Let iterator be ? Call(method, obj).
|
||||
7. If Type(iterator) is not Object, throw a TypeError exception.
|
||||
...
|
||||
|
||||
---*/
|
||||
var obj = {
|
||||
get [Symbol.iterator]() {
|
||||
throw new Test262Error('it should not get Symbol.iterator');
|
||||
},
|
||||
[Symbol.asyncIterator]() {
|
||||
return 42;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
|
||||
var callCount = 0;
|
||||
|
||||
var gen = async function *() {
|
||||
callCount += 1;
|
||||
yield* obj;
|
||||
throw new Test262Error('abrupt completion closes iter');
|
||||
|
||||
};
|
||||
|
||||
var iter = gen();
|
||||
|
||||
iter.next().then(() => {
|
||||
throw new Test262Error('Promise incorrectly fulfilled.');
|
||||
}, v => {
|
||||
assert.sameValue(v.constructor, TypeError, "TypeError");
|
||||
|
||||
iter.next().then(({ done, value }) => {
|
||||
assert.sameValue(done, true, 'the iterator is completed');
|
||||
assert.sameValue(value, undefined, 'value is undefined');
|
||||
}).then($DONE, $DONE);
|
||||
}).catch($DONE);
|
||||
|
||||
assert.sameValue(callCount, 1);
|
|
@ -0,0 +1,69 @@
|
|||
// This file was procedurally generated from the following sources:
|
||||
// - src/async-generators/yield-star-getiter-async-returns-string-throw.case
|
||||
// - src/async-generators/default/async-expression.template
|
||||
/*---
|
||||
description: Non object returned by [Symbol.asyncIterator]() - string (Unnamed async generator expression)
|
||||
esid: prod-AsyncGeneratorExpression
|
||||
features: [Symbol.asyncIterator, async-iteration]
|
||||
flags: [generated, async]
|
||||
info: |
|
||||
Async Generator Function Definitions
|
||||
|
||||
AsyncGeneratorExpression :
|
||||
async [no LineTerminator here] function * BindingIdentifier ( FormalParameters ) {
|
||||
AsyncGeneratorBody }
|
||||
|
||||
|
||||
YieldExpression: yield * AssignmentExpression
|
||||
|
||||
1. Let exprRef be the result of evaluating AssignmentExpression.
|
||||
2. Let value be ? GetValue(exprRef).
|
||||
3. Let generatorKind be ! GetGeneratorKind().
|
||||
4. Let iterator be ? GetIterator(value, generatorKind).
|
||||
...
|
||||
|
||||
GetIterator ( obj [ , hint ] )
|
||||
|
||||
...
|
||||
3. If hint is async,
|
||||
a. Set method to ? GetMethod(obj, @@asyncIterator).
|
||||
...
|
||||
6. Let iterator be ? Call(method, obj).
|
||||
7. If Type(iterator) is not Object, throw a TypeError exception.
|
||||
...
|
||||
|
||||
---*/
|
||||
var obj = {
|
||||
get [Symbol.iterator]() {
|
||||
throw new Test262Error('it should not get Symbol.iterator');
|
||||
},
|
||||
[Symbol.asyncIterator]() {
|
||||
return '42';
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
|
||||
var callCount = 0;
|
||||
|
||||
var gen = async function *() {
|
||||
callCount += 1;
|
||||
yield* obj;
|
||||
throw new Test262Error('abrupt completion closes iter');
|
||||
|
||||
};
|
||||
|
||||
var iter = gen();
|
||||
|
||||
iter.next().then(() => {
|
||||
throw new Test262Error('Promise incorrectly fulfilled.');
|
||||
}, v => {
|
||||
assert.sameValue(v.constructor, TypeError, "TypeError");
|
||||
|
||||
iter.next().then(({ done, value }) => {
|
||||
assert.sameValue(done, true, 'the iterator is completed');
|
||||
assert.sameValue(value, undefined, 'value is undefined');
|
||||
}).then($DONE, $DONE);
|
||||
}).catch($DONE);
|
||||
|
||||
assert.sameValue(callCount, 1);
|
|
@ -0,0 +1,69 @@
|
|||
// This file was procedurally generated from the following sources:
|
||||
// - src/async-generators/yield-star-getiter-async-returns-symbol-throw.case
|
||||
// - src/async-generators/default/async-expression.template
|
||||
/*---
|
||||
description: Non object returned by [Symbol.asyncIterator]() - symbol (Unnamed async generator expression)
|
||||
esid: prod-AsyncGeneratorExpression
|
||||
features: [Symbol.asyncIterator, async-iteration]
|
||||
flags: [generated, async]
|
||||
info: |
|
||||
Async Generator Function Definitions
|
||||
|
||||
AsyncGeneratorExpression :
|
||||
async [no LineTerminator here] function * BindingIdentifier ( FormalParameters ) {
|
||||
AsyncGeneratorBody }
|
||||
|
||||
|
||||
YieldExpression: yield * AssignmentExpression
|
||||
|
||||
1. Let exprRef be the result of evaluating AssignmentExpression.
|
||||
2. Let value be ? GetValue(exprRef).
|
||||
3. Let generatorKind be ! GetGeneratorKind().
|
||||
4. Let iterator be ? GetIterator(value, generatorKind).
|
||||
...
|
||||
|
||||
GetIterator ( obj [ , hint ] )
|
||||
|
||||
...
|
||||
3. If hint is async,
|
||||
a. Set method to ? GetMethod(obj, @@asyncIterator).
|
||||
...
|
||||
6. Let iterator be ? Call(method, obj).
|
||||
7. If Type(iterator) is not Object, throw a TypeError exception.
|
||||
...
|
||||
|
||||
---*/
|
||||
var obj = {
|
||||
get [Symbol.iterator]() {
|
||||
throw new Test262Error('it should not get Symbol.iterator');
|
||||
},
|
||||
[Symbol.asyncIterator]() {
|
||||
return Symbol.asyncIterator;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
|
||||
var callCount = 0;
|
||||
|
||||
var gen = async function *() {
|
||||
callCount += 1;
|
||||
yield* obj;
|
||||
throw new Test262Error('abrupt completion closes iter');
|
||||
|
||||
};
|
||||
|
||||
var iter = gen();
|
||||
|
||||
iter.next().then(() => {
|
||||
throw new Test262Error('Promise incorrectly fulfilled.');
|
||||
}, v => {
|
||||
assert.sameValue(v.constructor, TypeError, "TypeError");
|
||||
|
||||
iter.next().then(({ done, value }) => {
|
||||
assert.sameValue(done, true, 'the iterator is completed');
|
||||
assert.sameValue(value, undefined, 'value is undefined');
|
||||
}).then($DONE, $DONE);
|
||||
}).catch($DONE);
|
||||
|
||||
assert.sameValue(callCount, 1);
|
|
@ -0,0 +1,69 @@
|
|||
// This file was procedurally generated from the following sources:
|
||||
// - src/async-generators/yield-star-getiter-async-returns-undefined-throw.case
|
||||
// - src/async-generators/default/async-expression.template
|
||||
/*---
|
||||
description: Non object returned by [Symbol.asyncIterator]() - undefined (Unnamed async generator expression)
|
||||
esid: prod-AsyncGeneratorExpression
|
||||
features: [Symbol.asyncIterator, async-iteration]
|
||||
flags: [generated, async]
|
||||
info: |
|
||||
Async Generator Function Definitions
|
||||
|
||||
AsyncGeneratorExpression :
|
||||
async [no LineTerminator here] function * BindingIdentifier ( FormalParameters ) {
|
||||
AsyncGeneratorBody }
|
||||
|
||||
|
||||
YieldExpression: yield * AssignmentExpression
|
||||
|
||||
1. Let exprRef be the result of evaluating AssignmentExpression.
|
||||
2. Let value be ? GetValue(exprRef).
|
||||
3. Let generatorKind be ! GetGeneratorKind().
|
||||
4. Let iterator be ? GetIterator(value, generatorKind).
|
||||
...
|
||||
|
||||
GetIterator ( obj [ , hint ] )
|
||||
|
||||
...
|
||||
3. If hint is async,
|
||||
a. Set method to ? GetMethod(obj, @@asyncIterator).
|
||||
...
|
||||
6. Let iterator be ? Call(method, obj).
|
||||
7. If Type(iterator) is not Object, throw a TypeError exception.
|
||||
...
|
||||
|
||||
---*/
|
||||
var obj = {
|
||||
get [Symbol.iterator]() {
|
||||
throw new Test262Error('it should not get Symbol.iterator');
|
||||
},
|
||||
[Symbol.asyncIterator]() {
|
||||
return undefined;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
|
||||
var callCount = 0;
|
||||
|
||||
var gen = async function *() {
|
||||
callCount += 1;
|
||||
yield* obj;
|
||||
throw new Test262Error('abrupt completion closes iter');
|
||||
|
||||
};
|
||||
|
||||
var iter = gen();
|
||||
|
||||
iter.next().then(() => {
|
||||
throw new Test262Error('Promise incorrectly fulfilled.');
|
||||
}, v => {
|
||||
assert.sameValue(v.constructor, TypeError, "TypeError");
|
||||
|
||||
iter.next().then(({ done, value }) => {
|
||||
assert.sameValue(done, true, 'the iterator is completed');
|
||||
assert.sameValue(value, undefined, 'value is undefined');
|
||||
}).then($DONE, $DONE);
|
||||
}).catch($DONE);
|
||||
|
||||
assert.sameValue(callCount, 1);
|
|
@ -0,0 +1,78 @@
|
|||
// This file was procedurally generated from the following sources:
|
||||
// - src/async-generators/yield-star-getiter-async-undefined-sync-get-abrupt.case
|
||||
// - src/async-generators/default/async-expression.template
|
||||
/*---
|
||||
description: Abrupt completion while getting @@iterator after undefined @@asyncIterator (Unnamed async generator expression)
|
||||
esid: prod-AsyncGeneratorExpression
|
||||
features: [Symbol.asyncIterator, async-iteration]
|
||||
flags: [generated, async]
|
||||
info: |
|
||||
Async Generator Function Definitions
|
||||
|
||||
AsyncGeneratorExpression :
|
||||
async [no LineTerminator here] function * BindingIdentifier ( FormalParameters ) {
|
||||
AsyncGeneratorBody }
|
||||
|
||||
|
||||
YieldExpression: yield * AssignmentExpression
|
||||
|
||||
1. Let exprRef be the result of evaluating AssignmentExpression.
|
||||
2. Let value be ? GetValue(exprRef).
|
||||
3. Let generatorKind be ! GetGeneratorKind().
|
||||
4. Let iterator be ? GetIterator(value, generatorKind).
|
||||
...
|
||||
|
||||
GetIterator ( obj [ , hint ] )
|
||||
|
||||
...
|
||||
3. If hint is async,
|
||||
a. Set method to ? GetMethod(obj, @@asyncIterator).
|
||||
b. If method is undefined,
|
||||
i. Let syncMethod be ? GetMethod(obj, @@iterator).
|
||||
...
|
||||
|
||||
GetMethod ( V, P )
|
||||
|
||||
...
|
||||
2. Let func be ? GetV(V, P).
|
||||
...
|
||||
|
||||
---*/
|
||||
var calls = 0;
|
||||
var reason = {};
|
||||
var obj = {
|
||||
get [Symbol.iterator]() {
|
||||
throw reason;
|
||||
},
|
||||
get [Symbol.asyncIterator]() {
|
||||
calls += 1;
|
||||
return undefined;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
|
||||
var callCount = 0;
|
||||
|
||||
var gen = async function *() {
|
||||
callCount += 1;
|
||||
yield* obj;
|
||||
throw new Test262Error('abrupt completion closes iter');
|
||||
|
||||
};
|
||||
|
||||
var iter = gen();
|
||||
|
||||
iter.next().then(() => {
|
||||
throw new Test262Error('Promise incorrectly fulfilled.');
|
||||
}, v => {
|
||||
assert.sameValue(v, reason, 'reject reason');
|
||||
assert.sameValue(calls, 1);
|
||||
|
||||
iter.next().then(({ done, value }) => {
|
||||
assert.sameValue(done, true, 'the iterator is completed');
|
||||
assert.sameValue(value, undefined, 'value is undefined');
|
||||
}).then($DONE, $DONE);
|
||||
}).catch($DONE);
|
||||
|
||||
assert.sameValue(callCount, 1);
|
|
@ -0,0 +1,72 @@
|
|||
// This file was procedurally generated from the following sources:
|
||||
// - src/async-generators/yield-star-getiter-sync-get-abrupt.case
|
||||
// - src/async-generators/default/async-expression.template
|
||||
/*---
|
||||
description: Abrupt completion while getting [Symbol.iterator] (Unnamed async generator expression)
|
||||
esid: prod-AsyncGeneratorExpression
|
||||
features: [Symbol.asyncIterator, async-iteration]
|
||||
flags: [generated, async]
|
||||
info: |
|
||||
Async Generator Function Definitions
|
||||
|
||||
AsyncGeneratorExpression :
|
||||
async [no LineTerminator here] function * BindingIdentifier ( FormalParameters ) {
|
||||
AsyncGeneratorBody }
|
||||
|
||||
|
||||
YieldExpression: yield * AssignmentExpression
|
||||
|
||||
1. Let exprRef be the result of evaluating AssignmentExpression.
|
||||
2. Let value be ? GetValue(exprRef).
|
||||
3. Let generatorKind be ! GetGeneratorKind().
|
||||
4. Let iterator be ? GetIterator(value, generatorKind).
|
||||
...
|
||||
|
||||
GetIterator ( obj [ , hint ] )
|
||||
|
||||
...
|
||||
3. If hint is async,
|
||||
a. Set method to ? GetMethod(obj, @@asyncIterator).
|
||||
b. If method is undefined,
|
||||
i. Let syncMethod be ? GetMethod(obj, @@iterator).
|
||||
...
|
||||
|
||||
GetMethod ( V, P )
|
||||
|
||||
...
|
||||
2. Let func be ? GetV(V, P).
|
||||
...
|
||||
|
||||
---*/
|
||||
var reason = {};
|
||||
var obj = {
|
||||
get [Symbol.iterator]() {
|
||||
throw reason;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
|
||||
var callCount = 0;
|
||||
|
||||
var gen = async function *() {
|
||||
callCount += 1;
|
||||
yield* obj;
|
||||
throw new Test262Error('abrupt completion closes iter');
|
||||
|
||||
};
|
||||
|
||||
var iter = gen();
|
||||
|
||||
iter.next().then(() => {
|
||||
throw new Test262Error('Promise incorrectly fulfilled.');
|
||||
}, v => {
|
||||
assert.sameValue(v, reason, "reject reason");
|
||||
|
||||
iter.next().then(({ done, value }) => {
|
||||
assert.sameValue(done, true, 'the iterator is completed');
|
||||
assert.sameValue(value, undefined, 'value is undefined');
|
||||
}).then($DONE, $DONE);
|
||||
}).catch($DONE);
|
||||
|
||||
assert.sameValue(callCount, 1);
|
|
@ -0,0 +1,71 @@
|
|||
// This file was procedurally generated from the following sources:
|
||||
// - src/async-generators/yield-star-getiter-sync-not-callable-boolean-throw.case
|
||||
// - src/async-generators/default/async-expression.template
|
||||
/*---
|
||||
description: Throws a TypeError on a non-callable [Symbol.iterator] (boolean) (Unnamed async generator expression)
|
||||
esid: prod-AsyncGeneratorExpression
|
||||
features: [async-iteration]
|
||||
flags: [generated, async]
|
||||
info: |
|
||||
Async Generator Function Definitions
|
||||
|
||||
AsyncGeneratorExpression :
|
||||
async [no LineTerminator here] function * BindingIdentifier ( FormalParameters ) {
|
||||
AsyncGeneratorBody }
|
||||
|
||||
|
||||
YieldExpression: yield * AssignmentExpression
|
||||
|
||||
1. Let exprRef be the result of evaluating AssignmentExpression.
|
||||
2. Let value be ? GetValue(exprRef).
|
||||
3. Let generatorKind be ! GetGeneratorKind().
|
||||
4. Let iterator be ? GetIterator(value, generatorKind).
|
||||
...
|
||||
|
||||
GetIterator ( obj [ , hint ] )
|
||||
|
||||
...
|
||||
3. If hint is async,
|
||||
a. Set method to ? GetMethod(obj, @@asyncIterator).
|
||||
b. If method is undefined,
|
||||
i. Let syncMethod be ? GetMethod(obj, @@iterator).
|
||||
...
|
||||
|
||||
GetMethod ( V, P )
|
||||
|
||||
...
|
||||
2. Let func be ? GetV(V, P).
|
||||
...
|
||||
4. If IsCallable(func) is false, throw a TypeError exception.
|
||||
...
|
||||
|
||||
---*/
|
||||
var obj = {
|
||||
[Symbol.iterator]: false
|
||||
};
|
||||
|
||||
|
||||
|
||||
var callCount = 0;
|
||||
|
||||
var gen = async function *() {
|
||||
callCount += 1;
|
||||
yield* obj;
|
||||
throw new Test262Error('abrupt completion closes iter');
|
||||
|
||||
};
|
||||
|
||||
var iter = gen();
|
||||
|
||||
iter.next().then(() => {
|
||||
throw new Test262Error('Promise incorrectly fulfilled.');
|
||||
}, v => {
|
||||
assert.sameValue(v.constructor, TypeError, "TypeError");
|
||||
|
||||
iter.next().then(({ done, value }) => {
|
||||
assert.sameValue(done, true, 'the iterator is completed');
|
||||
assert.sameValue(value, undefined, 'value is undefined');
|
||||
}).then($DONE, $DONE);
|
||||
}).catch($DONE);
|
||||
|
||||
assert.sameValue(callCount, 1);
|
|
@ -0,0 +1,71 @@
|
|||
// This file was procedurally generated from the following sources:
|
||||
// - src/async-generators/yield-star-getiter-sync-not-callable-number-throw.case
|
||||
// - src/async-generators/default/async-expression.template
|
||||
/*---
|
||||
description: Throws a TypeError on a non-callable [Symbol.iterator] (number) (Unnamed async generator expression)
|
||||
esid: prod-AsyncGeneratorExpression
|
||||
features: [async-iteration]
|
||||
flags: [generated, async]
|
||||
info: |
|
||||
Async Generator Function Definitions
|
||||
|
||||
AsyncGeneratorExpression :
|
||||
async [no LineTerminator here] function * BindingIdentifier ( FormalParameters ) {
|
||||
AsyncGeneratorBody }
|
||||
|
||||
|
||||
YieldExpression: yield * AssignmentExpression
|
||||
|
||||
1. Let exprRef be the result of evaluating AssignmentExpression.
|
||||
2. Let value be ? GetValue(exprRef).
|
||||
3. Let generatorKind be ! GetGeneratorKind().
|
||||
4. Let iterator be ? GetIterator(value, generatorKind).
|
||||
...
|
||||
|
||||
GetIterator ( obj [ , hint ] )
|
||||
|
||||
...
|
||||
3. If hint is async,
|
||||
a. Set method to ? GetMethod(obj, @@asyncIterator).
|
||||
b. If method is undefined,
|
||||
i. Let syncMethod be ? GetMethod(obj, @@iterator).
|
||||
...
|
||||
|
||||
GetMethod ( V, P )
|
||||
|
||||
...
|
||||
2. Let func be ? GetV(V, P).
|
||||
...
|
||||
4. If IsCallable(func) is false, throw a TypeError exception.
|
||||
...
|
||||
|
||||
---*/
|
||||
var obj = {
|
||||
[Symbol.iterator]: 0
|
||||
};
|
||||
|
||||
|
||||
|
||||
var callCount = 0;
|
||||
|
||||
var gen = async function *() {
|
||||
callCount += 1;
|
||||
yield* obj;
|
||||
throw new Test262Error('abrupt completion closes iter');
|
||||
|
||||
};
|
||||
|
||||
var iter = gen();
|
||||
|
||||
iter.next().then(() => {
|
||||
throw new Test262Error('Promise incorrectly fulfilled.');
|
||||
}, v => {
|
||||
assert.sameValue(v.constructor, TypeError, "TypeError");
|
||||
|
||||
iter.next().then(({ done, value }) => {
|
||||
assert.sameValue(done, true, 'the iterator is completed');
|
||||
assert.sameValue(value, undefined, 'value is undefined');
|
||||
}).then($DONE, $DONE);
|
||||
}).catch($DONE);
|
||||
|
||||
assert.sameValue(callCount, 1);
|
|
@ -0,0 +1,71 @@
|
|||
// This file was procedurally generated from the following sources:
|
||||
// - src/async-generators/yield-star-getiter-sync-not-callable-object-throw.case
|
||||
// - src/async-generators/default/async-expression.template
|
||||
/*---
|
||||
description: Throws a TypeError on a non-callable [Symbol.iterator] (object) (Unnamed async generator expression)
|
||||
esid: prod-AsyncGeneratorExpression
|
||||
features: [async-iteration]
|
||||
flags: [generated, async]
|
||||
info: |
|
||||
Async Generator Function Definitions
|
||||
|
||||
AsyncGeneratorExpression :
|
||||
async [no LineTerminator here] function * BindingIdentifier ( FormalParameters ) {
|
||||
AsyncGeneratorBody }
|
||||
|
||||
|
||||
YieldExpression: yield * AssignmentExpression
|
||||
|
||||
1. Let exprRef be the result of evaluating AssignmentExpression.
|
||||
2. Let value be ? GetValue(exprRef).
|
||||
3. Let generatorKind be ! GetGeneratorKind().
|
||||
4. Let iterator be ? GetIterator(value, generatorKind).
|
||||
...
|
||||
|
||||
GetIterator ( obj [ , hint ] )
|
||||
|
||||
...
|
||||
3. If hint is async,
|
||||
a. Set method to ? GetMethod(obj, @@asyncIterator).
|
||||
b. If method is undefined,
|
||||
i. Let syncMethod be ? GetMethod(obj, @@iterator).
|
||||
...
|
||||
|
||||
GetMethod ( V, P )
|
||||
|
||||
...
|
||||
2. Let func be ? GetV(V, P).
|
||||
...
|
||||
4. If IsCallable(func) is false, throw a TypeError exception.
|
||||
...
|
||||
|
||||
---*/
|
||||
var obj = {
|
||||
[Symbol.iterator]: {}
|
||||
};
|
||||
|
||||
|
||||
|
||||
var callCount = 0;
|
||||
|
||||
var gen = async function *() {
|
||||
callCount += 1;
|
||||
yield* obj;
|
||||
throw new Test262Error('abrupt completion closes iter');
|
||||
|
||||
};
|
||||
|
||||
var iter = gen();
|
||||
|
||||
iter.next().then(() => {
|
||||
throw new Test262Error('Promise incorrectly fulfilled.');
|
||||
}, v => {
|
||||
assert.sameValue(v.constructor, TypeError, "TypeError");
|
||||
|
||||
iter.next().then(({ done, value }) => {
|
||||
assert.sameValue(done, true, 'the iterator is completed');
|
||||
assert.sameValue(value, undefined, 'value is undefined');
|
||||
}).then($DONE, $DONE);
|
||||
}).catch($DONE);
|
||||
|
||||
assert.sameValue(callCount, 1);
|
|
@ -0,0 +1,71 @@
|
|||
// This file was procedurally generated from the following sources:
|
||||
// - src/async-generators/yield-star-getiter-sync-not-callable-string-throw.case
|
||||
// - src/async-generators/default/async-expression.template
|
||||
/*---
|
||||
description: Throws a TypeError on a non-callable [Symbol.iterator] (string) (Unnamed async generator expression)
|
||||
esid: prod-AsyncGeneratorExpression
|
||||
features: [async-iteration]
|
||||
flags: [generated, async]
|
||||
info: |
|
||||
Async Generator Function Definitions
|
||||
|
||||
AsyncGeneratorExpression :
|
||||
async [no LineTerminator here] function * BindingIdentifier ( FormalParameters ) {
|
||||
AsyncGeneratorBody }
|
||||
|
||||
|
||||
YieldExpression: yield * AssignmentExpression
|
||||
|
||||
1. Let exprRef be the result of evaluating AssignmentExpression.
|
||||
2. Let value be ? GetValue(exprRef).
|
||||
3. Let generatorKind be ! GetGeneratorKind().
|
||||
4. Let iterator be ? GetIterator(value, generatorKind).
|
||||
...
|
||||
|
||||
GetIterator ( obj [ , hint ] )
|
||||
|
||||
...
|
||||
3. If hint is async,
|
||||
a. Set method to ? GetMethod(obj, @@asyncIterator).
|
||||
b. If method is undefined,
|
||||
i. Let syncMethod be ? GetMethod(obj, @@iterator).
|
||||
...
|
||||
|
||||
GetMethod ( V, P )
|
||||
|
||||
...
|
||||
2. Let func be ? GetV(V, P).
|
||||
...
|
||||
4. If IsCallable(func) is false, throw a TypeError exception.
|
||||
...
|
||||
|
||||
---*/
|
||||
var obj = {
|
||||
[Symbol.iterator]: ''
|
||||
};
|
||||
|
||||
|
||||
|
||||
var callCount = 0;
|
||||
|
||||
var gen = async function *() {
|
||||
callCount += 1;
|
||||
yield* obj;
|
||||
throw new Test262Error('abrupt completion closes iter');
|
||||
|
||||
};
|
||||
|
||||
var iter = gen();
|
||||
|
||||
iter.next().then(() => {
|
||||
throw new Test262Error('Promise incorrectly fulfilled.');
|
||||
}, v => {
|
||||
assert.sameValue(v.constructor, TypeError, "TypeError");
|
||||
|
||||
iter.next().then(({ done, value }) => {
|
||||
assert.sameValue(done, true, 'the iterator is completed');
|
||||
assert.sameValue(value, undefined, 'value is undefined');
|
||||
}).then($DONE, $DONE);
|
||||
}).catch($DONE);
|
||||
|
||||
assert.sameValue(callCount, 1);
|
|
@ -0,0 +1,71 @@
|
|||
// This file was procedurally generated from the following sources:
|
||||
// - src/async-generators/yield-star-getiter-sync-not-callable-symbol-throw.case
|
||||
// - src/async-generators/default/async-expression.template
|
||||
/*---
|
||||
description: Throws a TypeError on a non-callable [Symbol.iterator] (symbol) (Unnamed async generator expression)
|
||||
esid: prod-AsyncGeneratorExpression
|
||||
features: [Symbol.asyncIterator, async-iteration]
|
||||
flags: [generated, async]
|
||||
info: |
|
||||
Async Generator Function Definitions
|
||||
|
||||
AsyncGeneratorExpression :
|
||||
async [no LineTerminator here] function * BindingIdentifier ( FormalParameters ) {
|
||||
AsyncGeneratorBody }
|
||||
|
||||
|
||||
YieldExpression: yield * AssignmentExpression
|
||||
|
||||
1. Let exprRef be the result of evaluating AssignmentExpression.
|
||||
2. Let value be ? GetValue(exprRef).
|
||||
3. Let generatorKind be ! GetGeneratorKind().
|
||||
4. Let iterator be ? GetIterator(value, generatorKind).
|
||||
...
|
||||
|
||||
GetIterator ( obj [ , hint ] )
|
||||
|
||||
...
|
||||
3. If hint is async,
|
||||
a. Set method to ? GetMethod(obj, @@asyncIterator).
|
||||
b. If method is undefined,
|
||||
i. Let syncMethod be ? GetMethod(obj, @@iterator).
|
||||
...
|
||||
|
||||
GetMethod ( V, P )
|
||||
|
||||
...
|
||||
2. Let func be ? GetV(V, P).
|
||||
...
|
||||
4. If IsCallable(func) is false, throw a TypeError exception.
|
||||
...
|
||||
|
||||
---*/
|
||||
var obj = {
|
||||
[Symbol.iterator]: Symbol.iterator
|
||||
};
|
||||
|
||||
|
||||
|
||||
var callCount = 0;
|
||||
|
||||
var gen = async function *() {
|
||||
callCount += 1;
|
||||
yield* obj;
|
||||
throw new Test262Error('abrupt completion closes iter');
|
||||
|
||||
};
|
||||
|
||||
var iter = gen();
|
||||
|
||||
iter.next().then(() => {
|
||||
throw new Test262Error('Promise incorrectly fulfilled.');
|
||||
}, v => {
|
||||
assert.sameValue(v.constructor, TypeError, "TypeError");
|
||||
|
||||
iter.next().then(({ done, value }) => {
|
||||
assert.sameValue(done, true, 'the iterator is completed');
|
||||
assert.sameValue(value, undefined, 'value is undefined');
|
||||
}).then($DONE, $DONE);
|
||||
}).catch($DONE);
|
||||
|
||||
assert.sameValue(callCount, 1);
|
|
@ -0,0 +1,66 @@
|
|||
// This file was procedurally generated from the following sources:
|
||||
// - src/async-generators/yield-star-getiter-sync-returns-abrupt.case
|
||||
// - src/async-generators/default/async-expression.template
|
||||
/*---
|
||||
description: Abrupt completion while calling [Symbol.iterator] (Unnamed async generator expression)
|
||||
esid: prod-AsyncGeneratorExpression
|
||||
features: [Symbol.asyncIterator, async-iteration]
|
||||
flags: [generated, async]
|
||||
info: |
|
||||
Async Generator Function Definitions
|
||||
|
||||
AsyncGeneratorExpression :
|
||||
async [no LineTerminator here] function * BindingIdentifier ( FormalParameters ) {
|
||||
AsyncGeneratorBody }
|
||||
|
||||
|
||||
YieldExpression: yield * AssignmentExpression
|
||||
|
||||
1. Let exprRef be the result of evaluating AssignmentExpression.
|
||||
2. Let value be ? GetValue(exprRef).
|
||||
3. Let generatorKind be ! GetGeneratorKind().
|
||||
4. Let iterator be ? GetIterator(value, generatorKind).
|
||||
...
|
||||
|
||||
GetIterator ( obj [ , hint ] )
|
||||
|
||||
...
|
||||
3. If hint is async,
|
||||
a. Set method to ? GetMethod(obj, @@asyncIterator).
|
||||
i. Let syncMethod be ? GetMethod(obj, @@iterator).
|
||||
ii. Let syncIterator be ? Call(syncMethod, obj).
|
||||
...
|
||||
|
||||
---*/
|
||||
var reason = {};
|
||||
var obj = {
|
||||
[Symbol.iterator]() {
|
||||
throw reason;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
|
||||
var callCount = 0;
|
||||
|
||||
var gen = async function *() {
|
||||
callCount += 1;
|
||||
yield* obj;
|
||||
throw new Test262Error('abrupt completion closes iter');
|
||||
|
||||
};
|
||||
|
||||
var iter = gen();
|
||||
|
||||
iter.next().then(() => {
|
||||
throw new Test262Error('Promise incorrectly fulfilled.');
|
||||
}, v => {
|
||||
assert.sameValue(v, reason, "reject reason");
|
||||
|
||||
iter.next().then(({ done, value }) => {
|
||||
assert.sameValue(done, true, 'the iterator is completed');
|
||||
assert.sameValue(value, undefined, 'value is undefined');
|
||||
}).then($DONE, $DONE);
|
||||
}).catch($DONE);
|
||||
|
||||
assert.sameValue(callCount, 1);
|
|
@ -0,0 +1,71 @@
|
|||
// This file was procedurally generated from the following sources:
|
||||
// - src/async-generators/yield-star-getiter-sync-returns-boolean-throw.case
|
||||
// - src/async-generators/default/async-expression.template
|
||||
/*---
|
||||
description: Non object returned by [Symbol.iterator]() - boolean (Unnamed async generator expression)
|
||||
esid: prod-AsyncGeneratorExpression
|
||||
features: [async-iteration]
|
||||
flags: [generated, async]
|
||||
info: |
|
||||
Async Generator Function Definitions
|
||||
|
||||
AsyncGeneratorExpression :
|
||||
async [no LineTerminator here] function * BindingIdentifier ( FormalParameters ) {
|
||||
AsyncGeneratorBody }
|
||||
|
||||
|
||||
YieldExpression: yield * AssignmentExpression
|
||||
|
||||
1. Let exprRef be the result of evaluating AssignmentExpression.
|
||||
2. Let value be ? GetValue(exprRef).
|
||||
3. Let generatorKind be ! GetGeneratorKind().
|
||||
4. Let iterator be ? GetIterator(value, generatorKind).
|
||||
...
|
||||
|
||||
GetIterator ( obj [ , hint ] )
|
||||
|
||||
...
|
||||
3. If hint is async,
|
||||
a. Set method to ? GetMethod(obj, @@asyncIterator).
|
||||
i. Let syncMethod be ? GetMethod(obj, @@iterator).
|
||||
ii. Let syncIterator be ? Call(syncMethod, obj).
|
||||
iii. Return ? CreateAsyncFromSyncIterator(syncIterator).
|
||||
...
|
||||
|
||||
CreateAsyncFromSyncIterator(syncIterator)
|
||||
|
||||
1. If Type(syncIterator) is not Object, throw a TypeError exception.
|
||||
...
|
||||
|
||||
---*/
|
||||
var obj = {
|
||||
[Symbol.iterator]() {
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
|
||||
var callCount = 0;
|
||||
|
||||
var gen = async function *() {
|
||||
callCount += 1;
|
||||
yield* obj;
|
||||
throw new Test262Error('abrupt completion closes iter');
|
||||
|
||||
};
|
||||
|
||||
var iter = gen();
|
||||
|
||||
iter.next().then(() => {
|
||||
throw new Test262Error('Promise incorrectly fulfilled.');
|
||||
}, v => {
|
||||
assert.sameValue(v.constructor, TypeError, "TypeError");
|
||||
|
||||
iter.next().then(({ done, value }) => {
|
||||
assert.sameValue(done, true, 'the iterator is completed');
|
||||
assert.sameValue(value, undefined, 'value is undefined');
|
||||
}).then($DONE, $DONE);
|
||||
}).catch($DONE);
|
||||
|
||||
assert.sameValue(callCount, 1);
|
|
@ -0,0 +1,71 @@
|
|||
// This file was procedurally generated from the following sources:
|
||||
// - src/async-generators/yield-star-getiter-sync-returns-null-throw.case
|
||||
// - src/async-generators/default/async-expression.template
|
||||
/*---
|
||||
description: Non object returned by [Symbol.iterator]() - null (Unnamed async generator expression)
|
||||
esid: prod-AsyncGeneratorExpression
|
||||
features: [async-iteration]
|
||||
flags: [generated, async]
|
||||
info: |
|
||||
Async Generator Function Definitions
|
||||
|
||||
AsyncGeneratorExpression :
|
||||
async [no LineTerminator here] function * BindingIdentifier ( FormalParameters ) {
|
||||
AsyncGeneratorBody }
|
||||
|
||||
|
||||
YieldExpression: yield * AssignmentExpression
|
||||
|
||||
1. Let exprRef be the result of evaluating AssignmentExpression.
|
||||
2. Let value be ? GetValue(exprRef).
|
||||
3. Let generatorKind be ! GetGeneratorKind().
|
||||
4. Let iterator be ? GetIterator(value, generatorKind).
|
||||
...
|
||||
|
||||
GetIterator ( obj [ , hint ] )
|
||||
|
||||
...
|
||||
3. If hint is async,
|
||||
a. Set method to ? GetMethod(obj, @@asyncIterator).
|
||||
i. Let syncMethod be ? GetMethod(obj, @@iterator).
|
||||
ii. Let syncIterator be ? Call(syncMethod, obj).
|
||||
iii. Return ? CreateAsyncFromSyncIterator(syncIterator).
|
||||
...
|
||||
|
||||
CreateAsyncFromSyncIterator(syncIterator)
|
||||
|
||||
1. If Type(syncIterator) is not Object, throw a TypeError exception.
|
||||
...
|
||||
|
||||
---*/
|
||||
var obj = {
|
||||
[Symbol.iterator]() {
|
||||
return null;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
|
||||
var callCount = 0;
|
||||
|
||||
var gen = async function *() {
|
||||
callCount += 1;
|
||||
yield* obj;
|
||||
throw new Test262Error('abrupt completion closes iter');
|
||||
|
||||
};
|
||||
|
||||
var iter = gen();
|
||||
|
||||
iter.next().then(() => {
|
||||
throw new Test262Error('Promise incorrectly fulfilled.');
|
||||
}, v => {
|
||||
assert.sameValue(v.constructor, TypeError, "TypeError");
|
||||
|
||||
iter.next().then(({ done, value }) => {
|
||||
assert.sameValue(done, true, 'the iterator is completed');
|
||||
assert.sameValue(value, undefined, 'value is undefined');
|
||||
}).then($DONE, $DONE);
|
||||
}).catch($DONE);
|
||||
|
||||
assert.sameValue(callCount, 1);
|
|
@ -0,0 +1,71 @@
|
|||
// This file was procedurally generated from the following sources:
|
||||
// - src/async-generators/yield-star-getiter-sync-returns-number-throw.case
|
||||
// - src/async-generators/default/async-expression.template
|
||||
/*---
|
||||
description: Non object returned by [Symbol.iterator]() - number (Unnamed async generator expression)
|
||||
esid: prod-AsyncGeneratorExpression
|
||||
features: [async-iteration]
|
||||
flags: [generated, async]
|
||||
info: |
|
||||
Async Generator Function Definitions
|
||||
|
||||
AsyncGeneratorExpression :
|
||||
async [no LineTerminator here] function * BindingIdentifier ( FormalParameters ) {
|
||||
AsyncGeneratorBody }
|
||||
|
||||
|
||||
YieldExpression: yield * AssignmentExpression
|
||||
|
||||
1. Let exprRef be the result of evaluating AssignmentExpression.
|
||||
2. Let value be ? GetValue(exprRef).
|
||||
3. Let generatorKind be ! GetGeneratorKind().
|
||||
4. Let iterator be ? GetIterator(value, generatorKind).
|
||||
...
|
||||
|
||||
GetIterator ( obj [ , hint ] )
|
||||
|
||||
...
|
||||
3. If hint is async,
|
||||
a. Set method to ? GetMethod(obj, @@asyncIterator).
|
||||
i. Let syncMethod be ? GetMethod(obj, @@iterator).
|
||||
ii. Let syncIterator be ? Call(syncMethod, obj).
|
||||
iii. Return ? CreateAsyncFromSyncIterator(syncIterator).
|
||||
...
|
||||
|
||||
CreateAsyncFromSyncIterator(syncIterator)
|
||||
|
||||
1. If Type(syncIterator) is not Object, throw a TypeError exception.
|
||||
...
|
||||
|
||||
---*/
|
||||
var obj = {
|
||||
[Symbol.iterator]() {
|
||||
return 0;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
|
||||
var callCount = 0;
|
||||
|
||||
var gen = async function *() {
|
||||
callCount += 1;
|
||||
yield* obj;
|
||||
throw new Test262Error('abrupt completion closes iter');
|
||||
|
||||
};
|
||||
|
||||
var iter = gen();
|
||||
|
||||
iter.next().then(() => {
|
||||
throw new Test262Error('Promise incorrectly fulfilled.');
|
||||
}, v => {
|
||||
assert.sameValue(v.constructor, TypeError, "TypeError");
|
||||
|
||||
iter.next().then(({ done, value }) => {
|
||||
assert.sameValue(done, true, 'the iterator is completed');
|
||||
assert.sameValue(value, undefined, 'value is undefined');
|
||||
}).then($DONE, $DONE);
|
||||
}).catch($DONE);
|
||||
|
||||
assert.sameValue(callCount, 1);
|
|
@ -0,0 +1,71 @@
|
|||
// This file was procedurally generated from the following sources:
|
||||
// - src/async-generators/yield-star-getiter-sync-returns-string-throw.case
|
||||
// - src/async-generators/default/async-expression.template
|
||||
/*---
|
||||
description: Non object returned by [Symbol.iterator]() - string (Unnamed async generator expression)
|
||||
esid: prod-AsyncGeneratorExpression
|
||||
features: [async-iteration]
|
||||
flags: [generated, async]
|
||||
info: |
|
||||
Async Generator Function Definitions
|
||||
|
||||
AsyncGeneratorExpression :
|
||||
async [no LineTerminator here] function * BindingIdentifier ( FormalParameters ) {
|
||||
AsyncGeneratorBody }
|
||||
|
||||
|
||||
YieldExpression: yield * AssignmentExpression
|
||||
|
||||
1. Let exprRef be the result of evaluating AssignmentExpression.
|
||||
2. Let value be ? GetValue(exprRef).
|
||||
3. Let generatorKind be ! GetGeneratorKind().
|
||||
4. Let iterator be ? GetIterator(value, generatorKind).
|
||||
...
|
||||
|
||||
GetIterator ( obj [ , hint ] )
|
||||
|
||||
...
|
||||
3. If hint is async,
|
||||
a. Set method to ? GetMethod(obj, @@asyncIterator).
|
||||
i. Let syncMethod be ? GetMethod(obj, @@iterator).
|
||||
ii. Let syncIterator be ? Call(syncMethod, obj).
|
||||
iii. Return ? CreateAsyncFromSyncIterator(syncIterator).
|
||||
...
|
||||
|
||||
CreateAsyncFromSyncIterator(syncIterator)
|
||||
|
||||
1. If Type(syncIterator) is not Object, throw a TypeError exception.
|
||||
...
|
||||
|
||||
---*/
|
||||
var obj = {
|
||||
[Symbol.iterator]() {
|
||||
return '';
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
|
||||
var callCount = 0;
|
||||
|
||||
var gen = async function *() {
|
||||
callCount += 1;
|
||||
yield* obj;
|
||||
throw new Test262Error('abrupt completion closes iter');
|
||||
|
||||
};
|
||||
|
||||
var iter = gen();
|
||||
|
||||
iter.next().then(() => {
|
||||
throw new Test262Error('Promise incorrectly fulfilled.');
|
||||
}, v => {
|
||||
assert.sameValue(v.constructor, TypeError, "TypeError");
|
||||
|
||||
iter.next().then(({ done, value }) => {
|
||||
assert.sameValue(done, true, 'the iterator is completed');
|
||||
assert.sameValue(value, undefined, 'value is undefined');
|
||||
}).then($DONE, $DONE);
|
||||
}).catch($DONE);
|
||||
|
||||
assert.sameValue(callCount, 1);
|
|
@ -0,0 +1,71 @@
|
|||
// This file was procedurally generated from the following sources:
|
||||
// - src/async-generators/yield-star-getiter-sync-returns-symbol-throw.case
|
||||
// - src/async-generators/default/async-expression.template
|
||||
/*---
|
||||
description: Non object returned by [Symbol.iterator]() - symbol (Unnamed async generator expression)
|
||||
esid: prod-AsyncGeneratorExpression
|
||||
features: [async-iteration]
|
||||
flags: [generated, async]
|
||||
info: |
|
||||
Async Generator Function Definitions
|
||||
|
||||
AsyncGeneratorExpression :
|
||||
async [no LineTerminator here] function * BindingIdentifier ( FormalParameters ) {
|
||||
AsyncGeneratorBody }
|
||||
|
||||
|
||||
YieldExpression: yield * AssignmentExpression
|
||||
|
||||
1. Let exprRef be the result of evaluating AssignmentExpression.
|
||||
2. Let value be ? GetValue(exprRef).
|
||||
3. Let generatorKind be ! GetGeneratorKind().
|
||||
4. Let iterator be ? GetIterator(value, generatorKind).
|
||||
...
|
||||
|
||||
GetIterator ( obj [ , hint ] )
|
||||
|
||||
...
|
||||
3. If hint is async,
|
||||
a. Set method to ? GetMethod(obj, @@asyncIterator).
|
||||
i. Let syncMethod be ? GetMethod(obj, @@iterator).
|
||||
ii. Let syncIterator be ? Call(syncMethod, obj).
|
||||
iii. Return ? CreateAsyncFromSyncIterator(syncIterator).
|
||||
...
|
||||
|
||||
CreateAsyncFromSyncIterator(syncIterator)
|
||||
|
||||
1. If Type(syncIterator) is not Object, throw a TypeError exception.
|
||||
...
|
||||
|
||||
---*/
|
||||
var obj = {
|
||||
[Symbol.iterator]() {
|
||||
return Symbol.iterator;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
|
||||
var callCount = 0;
|
||||
|
||||
var gen = async function *() {
|
||||
callCount += 1;
|
||||
yield* obj;
|
||||
throw new Test262Error('abrupt completion closes iter');
|
||||
|
||||
};
|
||||
|
||||
var iter = gen();
|
||||
|
||||
iter.next().then(() => {
|
||||
throw new Test262Error('Promise incorrectly fulfilled.');
|
||||
}, v => {
|
||||
assert.sameValue(v.constructor, TypeError, "TypeError");
|
||||
|
||||
iter.next().then(({ done, value }) => {
|
||||
assert.sameValue(done, true, 'the iterator is completed');
|
||||
assert.sameValue(value, undefined, 'value is undefined');
|
||||
}).then($DONE, $DONE);
|
||||
}).catch($DONE);
|
||||
|
||||
assert.sameValue(callCount, 1);
|
|
@ -0,0 +1,71 @@
|
|||
// This file was procedurally generated from the following sources:
|
||||
// - src/async-generators/yield-star-getiter-sync-returns-undefined-throw.case
|
||||
// - src/async-generators/default/async-expression.template
|
||||
/*---
|
||||
description: Non object returned by [Symbol.iterator]() - undefined (Unnamed async generator expression)
|
||||
esid: prod-AsyncGeneratorExpression
|
||||
features: [async-iteration]
|
||||
flags: [generated, async]
|
||||
info: |
|
||||
Async Generator Function Definitions
|
||||
|
||||
AsyncGeneratorExpression :
|
||||
async [no LineTerminator here] function * BindingIdentifier ( FormalParameters ) {
|
||||
AsyncGeneratorBody }
|
||||
|
||||
|
||||
YieldExpression: yield * AssignmentExpression
|
||||
|
||||
1. Let exprRef be the result of evaluating AssignmentExpression.
|
||||
2. Let value be ? GetValue(exprRef).
|
||||
3. Let generatorKind be ! GetGeneratorKind().
|
||||
4. Let iterator be ? GetIterator(value, generatorKind).
|
||||
...
|
||||
|
||||
GetIterator ( obj [ , hint ] )
|
||||
|
||||
...
|
||||
3. If hint is async,
|
||||
a. Set method to ? GetMethod(obj, @@asyncIterator).
|
||||
i. Let syncMethod be ? GetMethod(obj, @@iterator).
|
||||
ii. Let syncIterator be ? Call(syncMethod, obj).
|
||||
iii. Return ? CreateAsyncFromSyncIterator(syncIterator).
|
||||
...
|
||||
|
||||
CreateAsyncFromSyncIterator(syncIterator)
|
||||
|
||||
1. If Type(syncIterator) is not Object, throw a TypeError exception.
|
||||
...
|
||||
|
||||
---*/
|
||||
var obj = {
|
||||
[Symbol.iterator]() {
|
||||
return undefined;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
|
||||
var callCount = 0;
|
||||
|
||||
var gen = async function *() {
|
||||
callCount += 1;
|
||||
yield* obj;
|
||||
throw new Test262Error('abrupt completion closes iter');
|
||||
|
||||
};
|
||||
|
||||
var iter = gen();
|
||||
|
||||
iter.next().then(() => {
|
||||
throw new Test262Error('Promise incorrectly fulfilled.');
|
||||
}, v => {
|
||||
assert.sameValue(v.constructor, TypeError, "TypeError");
|
||||
|
||||
iter.next().then(({ done, value }) => {
|
||||
assert.sameValue(done, true, 'the iterator is completed');
|
||||
assert.sameValue(value, undefined, 'value is undefined');
|
||||
}).then($DONE, $DONE);
|
||||
}).catch($DONE);
|
||||
|
||||
assert.sameValue(callCount, 1);
|
|
@ -0,0 +1,60 @@
|
|||
// This file was procedurally generated from the following sources:
|
||||
// - src/async-generators/yield-star-expr-abrupt.case
|
||||
// - src/async-generators/default/async-class-expr-static-method.template
|
||||
/*---
|
||||
description: Abrupt completion while getting yield* operand (Static async generator method as a ClassExpression element)
|
||||
esid: prod-AsyncGeneratorMethod
|
||||
features: [async-iteration]
|
||||
flags: [generated, async]
|
||||
info: |
|
||||
ClassElement :
|
||||
static MethodDefinition
|
||||
|
||||
MethodDefinition :
|
||||
AsyncGeneratorMethod
|
||||
|
||||
Async Generator Function Definitions
|
||||
|
||||
AsyncGeneratorMethod :
|
||||
async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody }
|
||||
|
||||
|
||||
YieldExpression: yield * AssignmentExpression
|
||||
|
||||
1. Let exprRef be the result of evaluating AssignmentExpression.
|
||||
2. Let value be ? GetValue(exprRef).
|
||||
...
|
||||
|
||||
---*/
|
||||
var obj = {};
|
||||
var abrupt = function() {
|
||||
throw obj;
|
||||
};
|
||||
|
||||
|
||||
|
||||
var callCount = 0;
|
||||
|
||||
var C = class { static async *gen() {
|
||||
callCount += 1;
|
||||
yield* abrupt();
|
||||
throw new Test262Error('abrupt completion closes iter');
|
||||
|
||||
}}
|
||||
|
||||
var gen = C.gen;
|
||||
|
||||
var iter = gen();
|
||||
|
||||
iter.next().then(() => {
|
||||
throw new Test262Error('Promise incorrectly fulfilled.');
|
||||
}, v => {
|
||||
assert.sameValue(v, obj, "reject reason");
|
||||
|
||||
iter.next().then(({ done, value }) => {
|
||||
assert.sameValue(done, true, 'the iterator is completed');
|
||||
assert.sameValue(value, undefined, 'value is undefined');
|
||||
}).then($DONE, $DONE);
|
||||
}).catch($DONE);
|
||||
|
||||
assert.sameValue(callCount, 1);
|
|
@ -0,0 +1,80 @@
|
|||
// This file was procedurally generated from the following sources:
|
||||
// - src/async-generators/yield-star-getiter-async-get-abrupt.case
|
||||
// - src/async-generators/default/async-class-expr-static-method.template
|
||||
/*---
|
||||
description: Abrupt completion while getting [Symbol.asyncIterator] (Static async generator method as a ClassExpression element)
|
||||
esid: prod-AsyncGeneratorMethod
|
||||
features: [Symbol.asyncIterator, async-iteration]
|
||||
flags: [generated, async]
|
||||
info: |
|
||||
ClassElement :
|
||||
static MethodDefinition
|
||||
|
||||
MethodDefinition :
|
||||
AsyncGeneratorMethod
|
||||
|
||||
Async Generator Function Definitions
|
||||
|
||||
AsyncGeneratorMethod :
|
||||
async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody }
|
||||
|
||||
|
||||
YieldExpression: yield * AssignmentExpression
|
||||
|
||||
1. Let exprRef be the result of evaluating AssignmentExpression.
|
||||
2. Let value be ? GetValue(exprRef).
|
||||
3. Let generatorKind be ! GetGeneratorKind().
|
||||
4. Let iterator be ? GetIterator(value, generatorKind).
|
||||
...
|
||||
|
||||
GetIterator ( obj [ , hint ] )
|
||||
|
||||
...
|
||||
3. If hint is async,
|
||||
a. Set method to ? GetMethod(obj, @@asyncIterator).
|
||||
...
|
||||
|
||||
GetMethod ( V, P )
|
||||
|
||||
...
|
||||
2. Let func be ? GetV(V, P).
|
||||
...
|
||||
|
||||
---*/
|
||||
var reason = {};
|
||||
var obj = {
|
||||
get [Symbol.iterator]() {
|
||||
throw new Test262Error('it should not get Symbol.iterator');
|
||||
},
|
||||
get [Symbol.asyncIterator]() {
|
||||
throw reason;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
|
||||
var callCount = 0;
|
||||
|
||||
var C = class { static async *gen() {
|
||||
callCount += 1;
|
||||
yield* obj;
|
||||
throw new Test262Error('abrupt completion closes iter');
|
||||
|
||||
}}
|
||||
|
||||
var gen = C.gen;
|
||||
|
||||
var iter = gen();
|
||||
|
||||
iter.next().then(() => {
|
||||
throw new Test262Error('Promise incorrectly fulfilled.');
|
||||
}, v => {
|
||||
assert.sameValue(v, reason, "reject reason");
|
||||
|
||||
iter.next().then(({ done, value }) => {
|
||||
assert.sameValue(done, true, 'the iterator is completed');
|
||||
assert.sameValue(value, undefined, 'value is undefined');
|
||||
}).then($DONE, $DONE);
|
||||
}).catch($DONE);
|
||||
|
||||
assert.sameValue(callCount, 1);
|
|
@ -0,0 +1,79 @@
|
|||
// This file was procedurally generated from the following sources:
|
||||
// - src/async-generators/yield-star-getiter-async-not-callable-boolean-throw.case
|
||||
// - src/async-generators/default/async-class-expr-static-method.template
|
||||
/*---
|
||||
description: Throws a TypeError on a non-callable [Symbol.asyncIterator] (boolean) (Static async generator method as a ClassExpression element)
|
||||
esid: prod-AsyncGeneratorMethod
|
||||
features: [Symbol.asyncIterator, async-iteration]
|
||||
flags: [generated, async]
|
||||
info: |
|
||||
ClassElement :
|
||||
static MethodDefinition
|
||||
|
||||
MethodDefinition :
|
||||
AsyncGeneratorMethod
|
||||
|
||||
Async Generator Function Definitions
|
||||
|
||||
AsyncGeneratorMethod :
|
||||
async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody }
|
||||
|
||||
|
||||
YieldExpression: yield * AssignmentExpression
|
||||
|
||||
1. Let exprRef be the result of evaluating AssignmentExpression.
|
||||
2. Let value be ? GetValue(exprRef).
|
||||
3. Let generatorKind be ! GetGeneratorKind().
|
||||
4. Let iterator be ? GetIterator(value, generatorKind).
|
||||
...
|
||||
|
||||
GetIterator ( obj [ , hint ] )
|
||||
|
||||
...
|
||||
3. If hint is async,
|
||||
a. Set method to ? GetMethod(obj, @@asyncIterator).
|
||||
...
|
||||
|
||||
GetMethod ( V, P )
|
||||
|
||||
...
|
||||
2. Let func be ? GetV(V, P).
|
||||
3. If func is either undefined or null, return undefined.
|
||||
4. If IsCallable(func) is false, throw a TypeError exception.
|
||||
...
|
||||
|
||||
---*/
|
||||
var obj = {
|
||||
get [Symbol.iterator]() {
|
||||
throw new Test262Error('it should not get Symbol.iterator');
|
||||
},
|
||||
[Symbol.asyncIterator]: false
|
||||
};
|
||||
|
||||
|
||||
|
||||
var callCount = 0;
|
||||
|
||||
var C = class { static async *gen() {
|
||||
callCount += 1;
|
||||
yield* obj;
|
||||
throw new Test262Error('abrupt completion closes iter');
|
||||
|
||||
}}
|
||||
|
||||
var gen = C.gen;
|
||||
|
||||
var iter = gen();
|
||||
|
||||
iter.next().then(() => {
|
||||
throw new Test262Error('Promise incorrectly fulfilled.');
|
||||
}, v => {
|
||||
assert.sameValue(v.constructor, TypeError, "TypeError");
|
||||
|
||||
iter.next().then(({ done, value }) => {
|
||||
assert.sameValue(done, true, 'the iterator is completed');
|
||||
assert.sameValue(value, undefined, 'value is undefined');
|
||||
}).then($DONE, $DONE);
|
||||
}).catch($DONE);
|
||||
|
||||
assert.sameValue(callCount, 1);
|
|
@ -0,0 +1,79 @@
|
|||
// This file was procedurally generated from the following sources:
|
||||
// - src/async-generators/yield-star-getiter-async-not-callable-number-throw.case
|
||||
// - src/async-generators/default/async-class-expr-static-method.template
|
||||
/*---
|
||||
description: Throws a TypeError on a non-callable [Symbol.asyncIterator] (number) (Static async generator method as a ClassExpression element)
|
||||
esid: prod-AsyncGeneratorMethod
|
||||
features: [Symbol.asyncIterator, async-iteration]
|
||||
flags: [generated, async]
|
||||
info: |
|
||||
ClassElement :
|
||||
static MethodDefinition
|
||||
|
||||
MethodDefinition :
|
||||
AsyncGeneratorMethod
|
||||
|
||||
Async Generator Function Definitions
|
||||
|
||||
AsyncGeneratorMethod :
|
||||
async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody }
|
||||
|
||||
|
||||
YieldExpression: yield * AssignmentExpression
|
||||
|
||||
1. Let exprRef be the result of evaluating AssignmentExpression.
|
||||
2. Let value be ? GetValue(exprRef).
|
||||
3. Let generatorKind be ! GetGeneratorKind().
|
||||
4. Let iterator be ? GetIterator(value, generatorKind).
|
||||
...
|
||||
|
||||
GetIterator ( obj [ , hint ] )
|
||||
|
||||
...
|
||||
3. If hint is async,
|
||||
a. Set method to ? GetMethod(obj, @@asyncIterator).
|
||||
...
|
||||
|
||||
GetMethod ( V, P )
|
||||
|
||||
...
|
||||
2. Let func be ? GetV(V, P).
|
||||
3. If func is either undefined or null, return undefined.
|
||||
4. If IsCallable(func) is false, throw a TypeError exception.
|
||||
...
|
||||
|
||||
---*/
|
||||
var obj = {
|
||||
get [Symbol.iterator]() {
|
||||
throw new Test262Error('it should not get Symbol.iterator');
|
||||
},
|
||||
[Symbol.asyncIterator]: 0
|
||||
};
|
||||
|
||||
|
||||
|
||||
var callCount = 0;
|
||||
|
||||
var C = class { static async *gen() {
|
||||
callCount += 1;
|
||||
yield* obj;
|
||||
throw new Test262Error('abrupt completion closes iter');
|
||||
|
||||
}}
|
||||
|
||||
var gen = C.gen;
|
||||
|
||||
var iter = gen();
|
||||
|
||||
iter.next().then(() => {
|
||||
throw new Test262Error('Promise incorrectly fulfilled.');
|
||||
}, v => {
|
||||
assert.sameValue(v.constructor, TypeError, "TypeError");
|
||||
|
||||
iter.next().then(({ done, value }) => {
|
||||
assert.sameValue(done, true, 'the iterator is completed');
|
||||
assert.sameValue(value, undefined, 'value is undefined');
|
||||
}).then($DONE, $DONE);
|
||||
}).catch($DONE);
|
||||
|
||||
assert.sameValue(callCount, 1);
|
|
@ -0,0 +1,79 @@
|
|||
// This file was procedurally generated from the following sources:
|
||||
// - src/async-generators/yield-star-getiter-async-not-callable-object-throw.case
|
||||
// - src/async-generators/default/async-class-expr-static-method.template
|
||||
/*---
|
||||
description: Throws a TypeError on a non-callable [Symbol.asyncIterator] (object) (Static async generator method as a ClassExpression element)
|
||||
esid: prod-AsyncGeneratorMethod
|
||||
features: [Symbol.asyncIterator, async-iteration]
|
||||
flags: [generated, async]
|
||||
info: |
|
||||
ClassElement :
|
||||
static MethodDefinition
|
||||
|
||||
MethodDefinition :
|
||||
AsyncGeneratorMethod
|
||||
|
||||
Async Generator Function Definitions
|
||||
|
||||
AsyncGeneratorMethod :
|
||||
async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody }
|
||||
|
||||
|
||||
YieldExpression: yield * AssignmentExpression
|
||||
|
||||
1. Let exprRef be the result of evaluating AssignmentExpression.
|
||||
2. Let value be ? GetValue(exprRef).
|
||||
3. Let generatorKind be ! GetGeneratorKind().
|
||||
4. Let iterator be ? GetIterator(value, generatorKind).
|
||||
...
|
||||
|
||||
GetIterator ( obj [ , hint ] )
|
||||
|
||||
...
|
||||
3. If hint is async,
|
||||
a. Set method to ? GetMethod(obj, @@asyncIterator).
|
||||
...
|
||||
|
||||
GetMethod ( V, P )
|
||||
|
||||
...
|
||||
2. Let func be ? GetV(V, P).
|
||||
3. If func is either undefined or null, return undefined.
|
||||
4. If IsCallable(func) is false, throw a TypeError exception.
|
||||
...
|
||||
|
||||
---*/
|
||||
var obj = {
|
||||
get [Symbol.iterator]() {
|
||||
throw new Test262Error('it should not get Symbol.iterator');
|
||||
},
|
||||
[Symbol.asyncIterator]: {}
|
||||
};
|
||||
|
||||
|
||||
|
||||
var callCount = 0;
|
||||
|
||||
var C = class { static async *gen() {
|
||||
callCount += 1;
|
||||
yield* obj;
|
||||
throw new Test262Error('abrupt completion closes iter');
|
||||
|
||||
}}
|
||||
|
||||
var gen = C.gen;
|
||||
|
||||
var iter = gen();
|
||||
|
||||
iter.next().then(() => {
|
||||
throw new Test262Error('Promise incorrectly fulfilled.');
|
||||
}, v => {
|
||||
assert.sameValue(v.constructor, TypeError, "TypeError");
|
||||
|
||||
iter.next().then(({ done, value }) => {
|
||||
assert.sameValue(done, true, 'the iterator is completed');
|
||||
assert.sameValue(value, undefined, 'value is undefined');
|
||||
}).then($DONE, $DONE);
|
||||
}).catch($DONE);
|
||||
|
||||
assert.sameValue(callCount, 1);
|
|
@ -0,0 +1,79 @@
|
|||
// This file was procedurally generated from the following sources:
|
||||
// - src/async-generators/yield-star-getiter-async-not-callable-string-throw.case
|
||||
// - src/async-generators/default/async-class-expr-static-method.template
|
||||
/*---
|
||||
description: Throws a TypeError on a non-callable [Symbol.asyncIterator] (string) (Static async generator method as a ClassExpression element)
|
||||
esid: prod-AsyncGeneratorMethod
|
||||
features: [Symbol.asyncIterator, async-iteration]
|
||||
flags: [generated, async]
|
||||
info: |
|
||||
ClassElement :
|
||||
static MethodDefinition
|
||||
|
||||
MethodDefinition :
|
||||
AsyncGeneratorMethod
|
||||
|
||||
Async Generator Function Definitions
|
||||
|
||||
AsyncGeneratorMethod :
|
||||
async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody }
|
||||
|
||||
|
||||
YieldExpression: yield * AssignmentExpression
|
||||
|
||||
1. Let exprRef be the result of evaluating AssignmentExpression.
|
||||
2. Let value be ? GetValue(exprRef).
|
||||
3. Let generatorKind be ! GetGeneratorKind().
|
||||
4. Let iterator be ? GetIterator(value, generatorKind).
|
||||
...
|
||||
|
||||
GetIterator ( obj [ , hint ] )
|
||||
|
||||
...
|
||||
3. If hint is async,
|
||||
a. Set method to ? GetMethod(obj, @@asyncIterator).
|
||||
...
|
||||
|
||||
GetMethod ( V, P )
|
||||
|
||||
...
|
||||
2. Let func be ? GetV(V, P).
|
||||
3. If func is either undefined or null, return undefined.
|
||||
4. If IsCallable(func) is false, throw a TypeError exception.
|
||||
...
|
||||
|
||||
---*/
|
||||
var obj = {
|
||||
get [Symbol.iterator]() {
|
||||
throw new Test262Error('it should not get Symbol.iterator');
|
||||
},
|
||||
[Symbol.asyncIterator]: ''
|
||||
};
|
||||
|
||||
|
||||
|
||||
var callCount = 0;
|
||||
|
||||
var C = class { static async *gen() {
|
||||
callCount += 1;
|
||||
yield* obj;
|
||||
throw new Test262Error('abrupt completion closes iter');
|
||||
|
||||
}}
|
||||
|
||||
var gen = C.gen;
|
||||
|
||||
var iter = gen();
|
||||
|
||||
iter.next().then(() => {
|
||||
throw new Test262Error('Promise incorrectly fulfilled.');
|
||||
}, v => {
|
||||
assert.sameValue(v.constructor, TypeError, "TypeError");
|
||||
|
||||
iter.next().then(({ done, value }) => {
|
||||
assert.sameValue(done, true, 'the iterator is completed');
|
||||
assert.sameValue(value, undefined, 'value is undefined');
|
||||
}).then($DONE, $DONE);
|
||||
}).catch($DONE);
|
||||
|
||||
assert.sameValue(callCount, 1);
|
|
@ -0,0 +1,79 @@
|
|||
// This file was procedurally generated from the following sources:
|
||||
// - src/async-generators/yield-star-getiter-async-not-callable-symbol-throw.case
|
||||
// - src/async-generators/default/async-class-expr-static-method.template
|
||||
/*---
|
||||
description: Throws a TypeError on a non-callable [Symbol.asyncIterator] (symbol) (Static async generator method as a ClassExpression element)
|
||||
esid: prod-AsyncGeneratorMethod
|
||||
features: [Symbol.asyncIterator, async-iteration]
|
||||
flags: [generated, async]
|
||||
info: |
|
||||
ClassElement :
|
||||
static MethodDefinition
|
||||
|
||||
MethodDefinition :
|
||||
AsyncGeneratorMethod
|
||||
|
||||
Async Generator Function Definitions
|
||||
|
||||
AsyncGeneratorMethod :
|
||||
async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody }
|
||||
|
||||
|
||||
YieldExpression: yield * AssignmentExpression
|
||||
|
||||
1. Let exprRef be the result of evaluating AssignmentExpression.
|
||||
2. Let value be ? GetValue(exprRef).
|
||||
3. Let generatorKind be ! GetGeneratorKind().
|
||||
4. Let iterator be ? GetIterator(value, generatorKind).
|
||||
...
|
||||
|
||||
GetIterator ( obj [ , hint ] )
|
||||
|
||||
...
|
||||
3. If hint is async,
|
||||
a. Set method to ? GetMethod(obj, @@asyncIterator).
|
||||
...
|
||||
|
||||
GetMethod ( V, P )
|
||||
|
||||
...
|
||||
2. Let func be ? GetV(V, P).
|
||||
3. If func is either undefined or null, return undefined.
|
||||
4. If IsCallable(func) is false, throw a TypeError exception.
|
||||
...
|
||||
|
||||
---*/
|
||||
var obj = {
|
||||
get [Symbol.iterator]() {
|
||||
throw new Test262Error('it should not get Symbol.iterator');
|
||||
},
|
||||
[Symbol.asyncIterator]: Symbol.asyncIterator
|
||||
};
|
||||
|
||||
|
||||
|
||||
var callCount = 0;
|
||||
|
||||
var C = class { static async *gen() {
|
||||
callCount += 1;
|
||||
yield* obj;
|
||||
throw new Test262Error('abrupt completion closes iter');
|
||||
|
||||
}}
|
||||
|
||||
var gen = C.gen;
|
||||
|
||||
var iter = gen();
|
||||
|
||||
iter.next().then(() => {
|
||||
throw new Test262Error('Promise incorrectly fulfilled.');
|
||||
}, v => {
|
||||
assert.sameValue(v.constructor, TypeError, "TypeError");
|
||||
|
||||
iter.next().then(({ done, value }) => {
|
||||
assert.sameValue(done, true, 'the iterator is completed');
|
||||
assert.sameValue(value, undefined, 'value is undefined');
|
||||
}).then($DONE, $DONE);
|
||||
}).catch($DONE);
|
||||
|
||||
assert.sameValue(callCount, 1);
|
|
@ -0,0 +1,85 @@
|
|||
// This file was procedurally generated from the following sources:
|
||||
// - src/async-generators/yield-star-getiter-async-null-sync-get-abrupt.case
|
||||
// - src/async-generators/default/async-class-expr-static-method.template
|
||||
/*---
|
||||
description: Abrupt completion while getting @@iterator after null @@asyncIterator (Static async generator method as a ClassExpression element)
|
||||
esid: prod-AsyncGeneratorMethod
|
||||
features: [Symbol.asyncIterator, async-iteration]
|
||||
flags: [generated, async]
|
||||
info: |
|
||||
ClassElement :
|
||||
static MethodDefinition
|
||||
|
||||
MethodDefinition :
|
||||
AsyncGeneratorMethod
|
||||
|
||||
Async Generator Function Definitions
|
||||
|
||||
AsyncGeneratorMethod :
|
||||
async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody }
|
||||
|
||||
|
||||
YieldExpression: yield * AssignmentExpression
|
||||
|
||||
1. Let exprRef be the result of evaluating AssignmentExpression.
|
||||
2. Let value be ? GetValue(exprRef).
|
||||
3. Let generatorKind be ! GetGeneratorKind().
|
||||
4. Let iterator be ? GetIterator(value, generatorKind).
|
||||
...
|
||||
|
||||
GetIterator ( obj [ , hint ] )
|
||||
|
||||
...
|
||||
3. If hint is async,
|
||||
a. Set method to ? GetMethod(obj, @@asyncIterator).
|
||||
b. If method is undefined,
|
||||
i. Let syncMethod be ? GetMethod(obj, @@iterator).
|
||||
...
|
||||
|
||||
GetMethod ( V, P )
|
||||
|
||||
...
|
||||
2. Let func be ? GetV(V, P).
|
||||
...
|
||||
|
||||
---*/
|
||||
var calls = 0;
|
||||
var reason = {};
|
||||
var obj = {
|
||||
get [Symbol.iterator]() {
|
||||
throw reason;
|
||||
},
|
||||
get [Symbol.asyncIterator]() {
|
||||
calls += 1;
|
||||
return null;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
|
||||
var callCount = 0;
|
||||
|
||||
var C = class { static async *gen() {
|
||||
callCount += 1;
|
||||
yield* obj;
|
||||
throw new Test262Error('abrupt completion closes iter');
|
||||
|
||||
}}
|
||||
|
||||
var gen = C.gen;
|
||||
|
||||
var iter = gen();
|
||||
|
||||
iter.next().then(() => {
|
||||
throw new Test262Error('Promise incorrectly fulfilled.');
|
||||
}, v => {
|
||||
assert.sameValue(v, reason, 'reject reason');
|
||||
assert.sameValue(calls, 1);
|
||||
|
||||
iter.next().then(({ done, value }) => {
|
||||
assert.sameValue(done, true, 'the iterator is completed');
|
||||
assert.sameValue(value, undefined, 'value is undefined');
|
||||
}).then($DONE, $DONE);
|
||||
}).catch($DONE);
|
||||
|
||||
assert.sameValue(callCount, 1);
|
|
@ -0,0 +1,76 @@
|
|||
// This file was procedurally generated from the following sources:
|
||||
// - src/async-generators/yield-star-getiter-async-returns-abrupt.case
|
||||
// - src/async-generators/default/async-class-expr-static-method.template
|
||||
/*---
|
||||
description: Abrupt completion while calling [Symbol.asyncIterator] (Static async generator method as a ClassExpression element)
|
||||
esid: prod-AsyncGeneratorMethod
|
||||
features: [Symbol.asyncIterator, async-iteration]
|
||||
flags: [generated, async]
|
||||
info: |
|
||||
ClassElement :
|
||||
static MethodDefinition
|
||||
|
||||
MethodDefinition :
|
||||
AsyncGeneratorMethod
|
||||
|
||||
Async Generator Function Definitions
|
||||
|
||||
AsyncGeneratorMethod :
|
||||
async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody }
|
||||
|
||||
|
||||
YieldExpression: yield * AssignmentExpression
|
||||
|
||||
1. Let exprRef be the result of evaluating AssignmentExpression.
|
||||
2. Let value be ? GetValue(exprRef).
|
||||
3. Let generatorKind be ! GetGeneratorKind().
|
||||
4. Let iterator be ? GetIterator(value, generatorKind).
|
||||
...
|
||||
|
||||
GetIterator ( obj [ , hint ] )
|
||||
|
||||
...
|
||||
3. If hint is async,
|
||||
a. Set method to ? GetMethod(obj, @@asyncIterator).
|
||||
...
|
||||
6. Let iterator be ? Call(method, obj).
|
||||
...
|
||||
|
||||
---*/
|
||||
var reason = {};
|
||||
var obj = {
|
||||
get [Symbol.iterator]() {
|
||||
throw new Test262Error('it should not get Symbol.iterator');
|
||||
},
|
||||
[Symbol.asyncIterator]() {
|
||||
throw reason;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
|
||||
var callCount = 0;
|
||||
|
||||
var C = class { static async *gen() {
|
||||
callCount += 1;
|
||||
yield* obj;
|
||||
throw new Test262Error('abrupt completion closes iter');
|
||||
|
||||
}}
|
||||
|
||||
var gen = C.gen;
|
||||
|
||||
var iter = gen();
|
||||
|
||||
iter.next().then(() => {
|
||||
throw new Test262Error('Promise incorrectly fulfilled.');
|
||||
}, v => {
|
||||
assert.sameValue(v, reason, "reject reason");
|
||||
|
||||
iter.next().then(({ done, value }) => {
|
||||
assert.sameValue(done, true, 'the iterator is completed');
|
||||
assert.sameValue(value, undefined, 'value is undefined');
|
||||
}).then($DONE, $DONE);
|
||||
}).catch($DONE);
|
||||
|
||||
assert.sameValue(callCount, 1);
|
|
@ -0,0 +1,76 @@
|
|||
// This file was procedurally generated from the following sources:
|
||||
// - src/async-generators/yield-star-getiter-async-returns-boolean-throw.case
|
||||
// - src/async-generators/default/async-class-expr-static-method.template
|
||||
/*---
|
||||
description: Non object returned by [Symbol.asyncIterator]() - boolean (Static async generator method as a ClassExpression element)
|
||||
esid: prod-AsyncGeneratorMethod
|
||||
features: [Symbol.asyncIterator, async-iteration]
|
||||
flags: [generated, async]
|
||||
info: |
|
||||
ClassElement :
|
||||
static MethodDefinition
|
||||
|
||||
MethodDefinition :
|
||||
AsyncGeneratorMethod
|
||||
|
||||
Async Generator Function Definitions
|
||||
|
||||
AsyncGeneratorMethod :
|
||||
async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody }
|
||||
|
||||
|
||||
YieldExpression: yield * AssignmentExpression
|
||||
|
||||
1. Let exprRef be the result of evaluating AssignmentExpression.
|
||||
2. Let value be ? GetValue(exprRef).
|
||||
3. Let generatorKind be ! GetGeneratorKind().
|
||||
4. Let iterator be ? GetIterator(value, generatorKind).
|
||||
...
|
||||
|
||||
GetIterator ( obj [ , hint ] )
|
||||
|
||||
...
|
||||
3. If hint is async,
|
||||
a. Set method to ? GetMethod(obj, @@asyncIterator).
|
||||
...
|
||||
6. Let iterator be ? Call(method, obj).
|
||||
7. If Type(iterator) is not Object, throw a TypeError exception.
|
||||
...
|
||||
|
||||
---*/
|
||||
var obj = {
|
||||
get [Symbol.iterator]() {
|
||||
throw new Test262Error('it should not get Symbol.iterator');
|
||||
},
|
||||
[Symbol.asyncIterator]() {
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
|
||||
var callCount = 0;
|
||||
|
||||
var C = class { static async *gen() {
|
||||
callCount += 1;
|
||||
yield* obj;
|
||||
throw new Test262Error('abrupt completion closes iter');
|
||||
|
||||
}}
|
||||
|
||||
var gen = C.gen;
|
||||
|
||||
var iter = gen();
|
||||
|
||||
iter.next().then(() => {
|
||||
throw new Test262Error('Promise incorrectly fulfilled.');
|
||||
}, v => {
|
||||
assert.sameValue(v.constructor, TypeError, "TypeError");
|
||||
|
||||
iter.next().then(({ done, value }) => {
|
||||
assert.sameValue(done, true, 'the iterator is completed');
|
||||
assert.sameValue(value, undefined, 'value is undefined');
|
||||
}).then($DONE, $DONE);
|
||||
}).catch($DONE);
|
||||
|
||||
assert.sameValue(callCount, 1);
|
|
@ -0,0 +1,76 @@
|
|||
// This file was procedurally generated from the following sources:
|
||||
// - src/async-generators/yield-star-getiter-async-returns-null-throw.case
|
||||
// - src/async-generators/default/async-class-expr-static-method.template
|
||||
/*---
|
||||
description: Non object returned by [Symbol.asyncIterator]() - null (Static async generator method as a ClassExpression element)
|
||||
esid: prod-AsyncGeneratorMethod
|
||||
features: [Symbol.asyncIterator, async-iteration]
|
||||
flags: [generated, async]
|
||||
info: |
|
||||
ClassElement :
|
||||
static MethodDefinition
|
||||
|
||||
MethodDefinition :
|
||||
AsyncGeneratorMethod
|
||||
|
||||
Async Generator Function Definitions
|
||||
|
||||
AsyncGeneratorMethod :
|
||||
async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody }
|
||||
|
||||
|
||||
YieldExpression: yield * AssignmentExpression
|
||||
|
||||
1. Let exprRef be the result of evaluating AssignmentExpression.
|
||||
2. Let value be ? GetValue(exprRef).
|
||||
3. Let generatorKind be ! GetGeneratorKind().
|
||||
4. Let iterator be ? GetIterator(value, generatorKind).
|
||||
...
|
||||
|
||||
GetIterator ( obj [ , hint ] )
|
||||
|
||||
...
|
||||
3. If hint is async,
|
||||
a. Set method to ? GetMethod(obj, @@asyncIterator).
|
||||
...
|
||||
6. Let iterator be ? Call(method, obj).
|
||||
7. If Type(iterator) is not Object, throw a TypeError exception.
|
||||
...
|
||||
|
||||
---*/
|
||||
var obj = {
|
||||
get [Symbol.iterator]() {
|
||||
throw new Test262Error('it should not get Symbol.iterator');
|
||||
},
|
||||
[Symbol.asyncIterator]() {
|
||||
return null;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
|
||||
var callCount = 0;
|
||||
|
||||
var C = class { static async *gen() {
|
||||
callCount += 1;
|
||||
yield* obj;
|
||||
throw new Test262Error('abrupt completion closes iter');
|
||||
|
||||
}}
|
||||
|
||||
var gen = C.gen;
|
||||
|
||||
var iter = gen();
|
||||
|
||||
iter.next().then(() => {
|
||||
throw new Test262Error('Promise incorrectly fulfilled.');
|
||||
}, v => {
|
||||
assert.sameValue(v.constructor, TypeError, "TypeError");
|
||||
|
||||
iter.next().then(({ done, value }) => {
|
||||
assert.sameValue(done, true, 'the iterator is completed');
|
||||
assert.sameValue(value, undefined, 'value is undefined');
|
||||
}).then($DONE, $DONE);
|
||||
}).catch($DONE);
|
||||
|
||||
assert.sameValue(callCount, 1);
|
|
@ -0,0 +1,76 @@
|
|||
// This file was procedurally generated from the following sources:
|
||||
// - src/async-generators/yield-star-getiter-async-returns-number-throw.case
|
||||
// - src/async-generators/default/async-class-expr-static-method.template
|
||||
/*---
|
||||
description: Non object returned by [Symbol.asyncIterator]() - number (Static async generator method as a ClassExpression element)
|
||||
esid: prod-AsyncGeneratorMethod
|
||||
features: [Symbol.asyncIterator, async-iteration]
|
||||
flags: [generated, async]
|
||||
info: |
|
||||
ClassElement :
|
||||
static MethodDefinition
|
||||
|
||||
MethodDefinition :
|
||||
AsyncGeneratorMethod
|
||||
|
||||
Async Generator Function Definitions
|
||||
|
||||
AsyncGeneratorMethod :
|
||||
async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody }
|
||||
|
||||
|
||||
YieldExpression: yield * AssignmentExpression
|
||||
|
||||
1. Let exprRef be the result of evaluating AssignmentExpression.
|
||||
2. Let value be ? GetValue(exprRef).
|
||||
3. Let generatorKind be ! GetGeneratorKind().
|
||||
4. Let iterator be ? GetIterator(value, generatorKind).
|
||||
...
|
||||
|
||||
GetIterator ( obj [ , hint ] )
|
||||
|
||||
...
|
||||
3. If hint is async,
|
||||
a. Set method to ? GetMethod(obj, @@asyncIterator).
|
||||
...
|
||||
6. Let iterator be ? Call(method, obj).
|
||||
7. If Type(iterator) is not Object, throw a TypeError exception.
|
||||
...
|
||||
|
||||
---*/
|
||||
var obj = {
|
||||
get [Symbol.iterator]() {
|
||||
throw new Test262Error('it should not get Symbol.iterator');
|
||||
},
|
||||
[Symbol.asyncIterator]() {
|
||||
return 42;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
|
||||
var callCount = 0;
|
||||
|
||||
var C = class { static async *gen() {
|
||||
callCount += 1;
|
||||
yield* obj;
|
||||
throw new Test262Error('abrupt completion closes iter');
|
||||
|
||||
}}
|
||||
|
||||
var gen = C.gen;
|
||||
|
||||
var iter = gen();
|
||||
|
||||
iter.next().then(() => {
|
||||
throw new Test262Error('Promise incorrectly fulfilled.');
|
||||
}, v => {
|
||||
assert.sameValue(v.constructor, TypeError, "TypeError");
|
||||
|
||||
iter.next().then(({ done, value }) => {
|
||||
assert.sameValue(done, true, 'the iterator is completed');
|
||||
assert.sameValue(value, undefined, 'value is undefined');
|
||||
}).then($DONE, $DONE);
|
||||
}).catch($DONE);
|
||||
|
||||
assert.sameValue(callCount, 1);
|
|
@ -0,0 +1,76 @@
|
|||
// This file was procedurally generated from the following sources:
|
||||
// - src/async-generators/yield-star-getiter-async-returns-string-throw.case
|
||||
// - src/async-generators/default/async-class-expr-static-method.template
|
||||
/*---
|
||||
description: Non object returned by [Symbol.asyncIterator]() - string (Static async generator method as a ClassExpression element)
|
||||
esid: prod-AsyncGeneratorMethod
|
||||
features: [Symbol.asyncIterator, async-iteration]
|
||||
flags: [generated, async]
|
||||
info: |
|
||||
ClassElement :
|
||||
static MethodDefinition
|
||||
|
||||
MethodDefinition :
|
||||
AsyncGeneratorMethod
|
||||
|
||||
Async Generator Function Definitions
|
||||
|
||||
AsyncGeneratorMethod :
|
||||
async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody }
|
||||
|
||||
|
||||
YieldExpression: yield * AssignmentExpression
|
||||
|
||||
1. Let exprRef be the result of evaluating AssignmentExpression.
|
||||
2. Let value be ? GetValue(exprRef).
|
||||
3. Let generatorKind be ! GetGeneratorKind().
|
||||
4. Let iterator be ? GetIterator(value, generatorKind).
|
||||
...
|
||||
|
||||
GetIterator ( obj [ , hint ] )
|
||||
|
||||
...
|
||||
3. If hint is async,
|
||||
a. Set method to ? GetMethod(obj, @@asyncIterator).
|
||||
...
|
||||
6. Let iterator be ? Call(method, obj).
|
||||
7. If Type(iterator) is not Object, throw a TypeError exception.
|
||||
...
|
||||
|
||||
---*/
|
||||
var obj = {
|
||||
get [Symbol.iterator]() {
|
||||
throw new Test262Error('it should not get Symbol.iterator');
|
||||
},
|
||||
[Symbol.asyncIterator]() {
|
||||
return '42';
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
|
||||
var callCount = 0;
|
||||
|
||||
var C = class { static async *gen() {
|
||||
callCount += 1;
|
||||
yield* obj;
|
||||
throw new Test262Error('abrupt completion closes iter');
|
||||
|
||||
}}
|
||||
|
||||
var gen = C.gen;
|
||||
|
||||
var iter = gen();
|
||||
|
||||
iter.next().then(() => {
|
||||
throw new Test262Error('Promise incorrectly fulfilled.');
|
||||
}, v => {
|
||||
assert.sameValue(v.constructor, TypeError, "TypeError");
|
||||
|
||||
iter.next().then(({ done, value }) => {
|
||||
assert.sameValue(done, true, 'the iterator is completed');
|
||||
assert.sameValue(value, undefined, 'value is undefined');
|
||||
}).then($DONE, $DONE);
|
||||
}).catch($DONE);
|
||||
|
||||
assert.sameValue(callCount, 1);
|
|
@ -0,0 +1,76 @@
|
|||
// This file was procedurally generated from the following sources:
|
||||
// - src/async-generators/yield-star-getiter-async-returns-symbol-throw.case
|
||||
// - src/async-generators/default/async-class-expr-static-method.template
|
||||
/*---
|
||||
description: Non object returned by [Symbol.asyncIterator]() - symbol (Static async generator method as a ClassExpression element)
|
||||
esid: prod-AsyncGeneratorMethod
|
||||
features: [Symbol.asyncIterator, async-iteration]
|
||||
flags: [generated, async]
|
||||
info: |
|
||||
ClassElement :
|
||||
static MethodDefinition
|
||||
|
||||
MethodDefinition :
|
||||
AsyncGeneratorMethod
|
||||
|
||||
Async Generator Function Definitions
|
||||
|
||||
AsyncGeneratorMethod :
|
||||
async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody }
|
||||
|
||||
|
||||
YieldExpression: yield * AssignmentExpression
|
||||
|
||||
1. Let exprRef be the result of evaluating AssignmentExpression.
|
||||
2. Let value be ? GetValue(exprRef).
|
||||
3. Let generatorKind be ! GetGeneratorKind().
|
||||
4. Let iterator be ? GetIterator(value, generatorKind).
|
||||
...
|
||||
|
||||
GetIterator ( obj [ , hint ] )
|
||||
|
||||
...
|
||||
3. If hint is async,
|
||||
a. Set method to ? GetMethod(obj, @@asyncIterator).
|
||||
...
|
||||
6. Let iterator be ? Call(method, obj).
|
||||
7. If Type(iterator) is not Object, throw a TypeError exception.
|
||||
...
|
||||
|
||||
---*/
|
||||
var obj = {
|
||||
get [Symbol.iterator]() {
|
||||
throw new Test262Error('it should not get Symbol.iterator');
|
||||
},
|
||||
[Symbol.asyncIterator]() {
|
||||
return Symbol.asyncIterator;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
|
||||
var callCount = 0;
|
||||
|
||||
var C = class { static async *gen() {
|
||||
callCount += 1;
|
||||
yield* obj;
|
||||
throw new Test262Error('abrupt completion closes iter');
|
||||
|
||||
}}
|
||||
|
||||
var gen = C.gen;
|
||||
|
||||
var iter = gen();
|
||||
|
||||
iter.next().then(() => {
|
||||
throw new Test262Error('Promise incorrectly fulfilled.');
|
||||
}, v => {
|
||||
assert.sameValue(v.constructor, TypeError, "TypeError");
|
||||
|
||||
iter.next().then(({ done, value }) => {
|
||||
assert.sameValue(done, true, 'the iterator is completed');
|
||||
assert.sameValue(value, undefined, 'value is undefined');
|
||||
}).then($DONE, $DONE);
|
||||
}).catch($DONE);
|
||||
|
||||
assert.sameValue(callCount, 1);
|
|
@ -0,0 +1,76 @@
|
|||
// This file was procedurally generated from the following sources:
|
||||
// - src/async-generators/yield-star-getiter-async-returns-undefined-throw.case
|
||||
// - src/async-generators/default/async-class-expr-static-method.template
|
||||
/*---
|
||||
description: Non object returned by [Symbol.asyncIterator]() - undefined (Static async generator method as a ClassExpression element)
|
||||
esid: prod-AsyncGeneratorMethod
|
||||
features: [Symbol.asyncIterator, async-iteration]
|
||||
flags: [generated, async]
|
||||
info: |
|
||||
ClassElement :
|
||||
static MethodDefinition
|
||||
|
||||
MethodDefinition :
|
||||
AsyncGeneratorMethod
|
||||
|
||||
Async Generator Function Definitions
|
||||
|
||||
AsyncGeneratorMethod :
|
||||
async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody }
|
||||
|
||||
|
||||
YieldExpression: yield * AssignmentExpression
|
||||
|
||||
1. Let exprRef be the result of evaluating AssignmentExpression.
|
||||
2. Let value be ? GetValue(exprRef).
|
||||
3. Let generatorKind be ! GetGeneratorKind().
|
||||
4. Let iterator be ? GetIterator(value, generatorKind).
|
||||
...
|
||||
|
||||
GetIterator ( obj [ , hint ] )
|
||||
|
||||
...
|
||||
3. If hint is async,
|
||||
a. Set method to ? GetMethod(obj, @@asyncIterator).
|
||||
...
|
||||
6. Let iterator be ? Call(method, obj).
|
||||
7. If Type(iterator) is not Object, throw a TypeError exception.
|
||||
...
|
||||
|
||||
---*/
|
||||
var obj = {
|
||||
get [Symbol.iterator]() {
|
||||
throw new Test262Error('it should not get Symbol.iterator');
|
||||
},
|
||||
[Symbol.asyncIterator]() {
|
||||
return undefined;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
|
||||
var callCount = 0;
|
||||
|
||||
var C = class { static async *gen() {
|
||||
callCount += 1;
|
||||
yield* obj;
|
||||
throw new Test262Error('abrupt completion closes iter');
|
||||
|
||||
}}
|
||||
|
||||
var gen = C.gen;
|
||||
|
||||
var iter = gen();
|
||||
|
||||
iter.next().then(() => {
|
||||
throw new Test262Error('Promise incorrectly fulfilled.');
|
||||
}, v => {
|
||||
assert.sameValue(v.constructor, TypeError, "TypeError");
|
||||
|
||||
iter.next().then(({ done, value }) => {
|
||||
assert.sameValue(done, true, 'the iterator is completed');
|
||||
assert.sameValue(value, undefined, 'value is undefined');
|
||||
}).then($DONE, $DONE);
|
||||
}).catch($DONE);
|
||||
|
||||
assert.sameValue(callCount, 1);
|
|
@ -0,0 +1,85 @@
|
|||
// This file was procedurally generated from the following sources:
|
||||
// - src/async-generators/yield-star-getiter-async-undefined-sync-get-abrupt.case
|
||||
// - src/async-generators/default/async-class-expr-static-method.template
|
||||
/*---
|
||||
description: Abrupt completion while getting @@iterator after undefined @@asyncIterator (Static async generator method as a ClassExpression element)
|
||||
esid: prod-AsyncGeneratorMethod
|
||||
features: [Symbol.asyncIterator, async-iteration]
|
||||
flags: [generated, async]
|
||||
info: |
|
||||
ClassElement :
|
||||
static MethodDefinition
|
||||
|
||||
MethodDefinition :
|
||||
AsyncGeneratorMethod
|
||||
|
||||
Async Generator Function Definitions
|
||||
|
||||
AsyncGeneratorMethod :
|
||||
async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody }
|
||||
|
||||
|
||||
YieldExpression: yield * AssignmentExpression
|
||||
|
||||
1. Let exprRef be the result of evaluating AssignmentExpression.
|
||||
2. Let value be ? GetValue(exprRef).
|
||||
3. Let generatorKind be ! GetGeneratorKind().
|
||||
4. Let iterator be ? GetIterator(value, generatorKind).
|
||||
...
|
||||
|
||||
GetIterator ( obj [ , hint ] )
|
||||
|
||||
...
|
||||
3. If hint is async,
|
||||
a. Set method to ? GetMethod(obj, @@asyncIterator).
|
||||
b. If method is undefined,
|
||||
i. Let syncMethod be ? GetMethod(obj, @@iterator).
|
||||
...
|
||||
|
||||
GetMethod ( V, P )
|
||||
|
||||
...
|
||||
2. Let func be ? GetV(V, P).
|
||||
...
|
||||
|
||||
---*/
|
||||
var calls = 0;
|
||||
var reason = {};
|
||||
var obj = {
|
||||
get [Symbol.iterator]() {
|
||||
throw reason;
|
||||
},
|
||||
get [Symbol.asyncIterator]() {
|
||||
calls += 1;
|
||||
return undefined;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
|
||||
var callCount = 0;
|
||||
|
||||
var C = class { static async *gen() {
|
||||
callCount += 1;
|
||||
yield* obj;
|
||||
throw new Test262Error('abrupt completion closes iter');
|
||||
|
||||
}}
|
||||
|
||||
var gen = C.gen;
|
||||
|
||||
var iter = gen();
|
||||
|
||||
iter.next().then(() => {
|
||||
throw new Test262Error('Promise incorrectly fulfilled.');
|
||||
}, v => {
|
||||
assert.sameValue(v, reason, 'reject reason');
|
||||
assert.sameValue(calls, 1);
|
||||
|
||||
iter.next().then(({ done, value }) => {
|
||||
assert.sameValue(done, true, 'the iterator is completed');
|
||||
assert.sameValue(value, undefined, 'value is undefined');
|
||||
}).then($DONE, $DONE);
|
||||
}).catch($DONE);
|
||||
|
||||
assert.sameValue(callCount, 1);
|
|
@ -0,0 +1,79 @@
|
|||
// This file was procedurally generated from the following sources:
|
||||
// - src/async-generators/yield-star-getiter-sync-get-abrupt.case
|
||||
// - src/async-generators/default/async-class-expr-static-method.template
|
||||
/*---
|
||||
description: Abrupt completion while getting [Symbol.iterator] (Static async generator method as a ClassExpression element)
|
||||
esid: prod-AsyncGeneratorMethod
|
||||
features: [Symbol.asyncIterator, async-iteration]
|
||||
flags: [generated, async]
|
||||
info: |
|
||||
ClassElement :
|
||||
static MethodDefinition
|
||||
|
||||
MethodDefinition :
|
||||
AsyncGeneratorMethod
|
||||
|
||||
Async Generator Function Definitions
|
||||
|
||||
AsyncGeneratorMethod :
|
||||
async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody }
|
||||
|
||||
|
||||
YieldExpression: yield * AssignmentExpression
|
||||
|
||||
1. Let exprRef be the result of evaluating AssignmentExpression.
|
||||
2. Let value be ? GetValue(exprRef).
|
||||
3. Let generatorKind be ! GetGeneratorKind().
|
||||
4. Let iterator be ? GetIterator(value, generatorKind).
|
||||
...
|
||||
|
||||
GetIterator ( obj [ , hint ] )
|
||||
|
||||
...
|
||||
3. If hint is async,
|
||||
a. Set method to ? GetMethod(obj, @@asyncIterator).
|
||||
b. If method is undefined,
|
||||
i. Let syncMethod be ? GetMethod(obj, @@iterator).
|
||||
...
|
||||
|
||||
GetMethod ( V, P )
|
||||
|
||||
...
|
||||
2. Let func be ? GetV(V, P).
|
||||
...
|
||||
|
||||
---*/
|
||||
var reason = {};
|
||||
var obj = {
|
||||
get [Symbol.iterator]() {
|
||||
throw reason;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
|
||||
var callCount = 0;
|
||||
|
||||
var C = class { static async *gen() {
|
||||
callCount += 1;
|
||||
yield* obj;
|
||||
throw new Test262Error('abrupt completion closes iter');
|
||||
|
||||
}}
|
||||
|
||||
var gen = C.gen;
|
||||
|
||||
var iter = gen();
|
||||
|
||||
iter.next().then(() => {
|
||||
throw new Test262Error('Promise incorrectly fulfilled.');
|
||||
}, v => {
|
||||
assert.sameValue(v, reason, "reject reason");
|
||||
|
||||
iter.next().then(({ done, value }) => {
|
||||
assert.sameValue(done, true, 'the iterator is completed');
|
||||
assert.sameValue(value, undefined, 'value is undefined');
|
||||
}).then($DONE, $DONE);
|
||||
}).catch($DONE);
|
||||
|
||||
assert.sameValue(callCount, 1);
|
|
@ -0,0 +1,78 @@
|
|||
// This file was procedurally generated from the following sources:
|
||||
// - src/async-generators/yield-star-getiter-sync-not-callable-boolean-throw.case
|
||||
// - src/async-generators/default/async-class-expr-static-method.template
|
||||
/*---
|
||||
description: Throws a TypeError on a non-callable [Symbol.iterator] (boolean) (Static async generator method as a ClassExpression element)
|
||||
esid: prod-AsyncGeneratorMethod
|
||||
features: [async-iteration]
|
||||
flags: [generated, async]
|
||||
info: |
|
||||
ClassElement :
|
||||
static MethodDefinition
|
||||
|
||||
MethodDefinition :
|
||||
AsyncGeneratorMethod
|
||||
|
||||
Async Generator Function Definitions
|
||||
|
||||
AsyncGeneratorMethod :
|
||||
async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody }
|
||||
|
||||
|
||||
YieldExpression: yield * AssignmentExpression
|
||||
|
||||
1. Let exprRef be the result of evaluating AssignmentExpression.
|
||||
2. Let value be ? GetValue(exprRef).
|
||||
3. Let generatorKind be ! GetGeneratorKind().
|
||||
4. Let iterator be ? GetIterator(value, generatorKind).
|
||||
...
|
||||
|
||||
GetIterator ( obj [ , hint ] )
|
||||
|
||||
...
|
||||
3. If hint is async,
|
||||
a. Set method to ? GetMethod(obj, @@asyncIterator).
|
||||
b. If method is undefined,
|
||||
i. Let syncMethod be ? GetMethod(obj, @@iterator).
|
||||
...
|
||||
|
||||
GetMethod ( V, P )
|
||||
|
||||
...
|
||||
2. Let func be ? GetV(V, P).
|
||||
...
|
||||
4. If IsCallable(func) is false, throw a TypeError exception.
|
||||
...
|
||||
|
||||
---*/
|
||||
var obj = {
|
||||
[Symbol.iterator]: false
|
||||
};
|
||||
|
||||
|
||||
|
||||
var callCount = 0;
|
||||
|
||||
var C = class { static async *gen() {
|
||||
callCount += 1;
|
||||
yield* obj;
|
||||
throw new Test262Error('abrupt completion closes iter');
|
||||
|
||||
}}
|
||||
|
||||
var gen = C.gen;
|
||||
|
||||
var iter = gen();
|
||||
|
||||
iter.next().then(() => {
|
||||
throw new Test262Error('Promise incorrectly fulfilled.');
|
||||
}, v => {
|
||||
assert.sameValue(v.constructor, TypeError, "TypeError");
|
||||
|
||||
iter.next().then(({ done, value }) => {
|
||||
assert.sameValue(done, true, 'the iterator is completed');
|
||||
assert.sameValue(value, undefined, 'value is undefined');
|
||||
}).then($DONE, $DONE);
|
||||
}).catch($DONE);
|
||||
|
||||
assert.sameValue(callCount, 1);
|
|
@ -0,0 +1,78 @@
|
|||
// This file was procedurally generated from the following sources:
|
||||
// - src/async-generators/yield-star-getiter-sync-not-callable-number-throw.case
|
||||
// - src/async-generators/default/async-class-expr-static-method.template
|
||||
/*---
|
||||
description: Throws a TypeError on a non-callable [Symbol.iterator] (number) (Static async generator method as a ClassExpression element)
|
||||
esid: prod-AsyncGeneratorMethod
|
||||
features: [async-iteration]
|
||||
flags: [generated, async]
|
||||
info: |
|
||||
ClassElement :
|
||||
static MethodDefinition
|
||||
|
||||
MethodDefinition :
|
||||
AsyncGeneratorMethod
|
||||
|
||||
Async Generator Function Definitions
|
||||
|
||||
AsyncGeneratorMethod :
|
||||
async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody }
|
||||
|
||||
|
||||
YieldExpression: yield * AssignmentExpression
|
||||
|
||||
1. Let exprRef be the result of evaluating AssignmentExpression.
|
||||
2. Let value be ? GetValue(exprRef).
|
||||
3. Let generatorKind be ! GetGeneratorKind().
|
||||
4. Let iterator be ? GetIterator(value, generatorKind).
|
||||
...
|
||||
|
||||
GetIterator ( obj [ , hint ] )
|
||||
|
||||
...
|
||||
3. If hint is async,
|
||||
a. Set method to ? GetMethod(obj, @@asyncIterator).
|
||||
b. If method is undefined,
|
||||
i. Let syncMethod be ? GetMethod(obj, @@iterator).
|
||||
...
|
||||
|
||||
GetMethod ( V, P )
|
||||
|
||||
...
|
||||
2. Let func be ? GetV(V, P).
|
||||
...
|
||||
4. If IsCallable(func) is false, throw a TypeError exception.
|
||||
...
|
||||
|
||||
---*/
|
||||
var obj = {
|
||||
[Symbol.iterator]: 0
|
||||
};
|
||||
|
||||
|
||||
|
||||
var callCount = 0;
|
||||
|
||||
var C = class { static async *gen() {
|
||||
callCount += 1;
|
||||
yield* obj;
|
||||
throw new Test262Error('abrupt completion closes iter');
|
||||
|
||||
}}
|
||||
|
||||
var gen = C.gen;
|
||||
|
||||
var iter = gen();
|
||||
|
||||
iter.next().then(() => {
|
||||
throw new Test262Error('Promise incorrectly fulfilled.');
|
||||
}, v => {
|
||||
assert.sameValue(v.constructor, TypeError, "TypeError");
|
||||
|
||||
iter.next().then(({ done, value }) => {
|
||||
assert.sameValue(done, true, 'the iterator is completed');
|
||||
assert.sameValue(value, undefined, 'value is undefined');
|
||||
}).then($DONE, $DONE);
|
||||
}).catch($DONE);
|
||||
|
||||
assert.sameValue(callCount, 1);
|
|
@ -0,0 +1,78 @@
|
|||
// This file was procedurally generated from the following sources:
|
||||
// - src/async-generators/yield-star-getiter-sync-not-callable-object-throw.case
|
||||
// - src/async-generators/default/async-class-expr-static-method.template
|
||||
/*---
|
||||
description: Throws a TypeError on a non-callable [Symbol.iterator] (object) (Static async generator method as a ClassExpression element)
|
||||
esid: prod-AsyncGeneratorMethod
|
||||
features: [async-iteration]
|
||||
flags: [generated, async]
|
||||
info: |
|
||||
ClassElement :
|
||||
static MethodDefinition
|
||||
|
||||
MethodDefinition :
|
||||
AsyncGeneratorMethod
|
||||
|
||||
Async Generator Function Definitions
|
||||
|
||||
AsyncGeneratorMethod :
|
||||
async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody }
|
||||
|
||||
|
||||
YieldExpression: yield * AssignmentExpression
|
||||
|
||||
1. Let exprRef be the result of evaluating AssignmentExpression.
|
||||
2. Let value be ? GetValue(exprRef).
|
||||
3. Let generatorKind be ! GetGeneratorKind().
|
||||
4. Let iterator be ? GetIterator(value, generatorKind).
|
||||
...
|
||||
|
||||
GetIterator ( obj [ , hint ] )
|
||||
|
||||
...
|
||||
3. If hint is async,
|
||||
a. Set method to ? GetMethod(obj, @@asyncIterator).
|
||||
b. If method is undefined,
|
||||
i. Let syncMethod be ? GetMethod(obj, @@iterator).
|
||||
...
|
||||
|
||||
GetMethod ( V, P )
|
||||
|
||||
...
|
||||
2. Let func be ? GetV(V, P).
|
||||
...
|
||||
4. If IsCallable(func) is false, throw a TypeError exception.
|
||||
...
|
||||
|
||||
---*/
|
||||
var obj = {
|
||||
[Symbol.iterator]: {}
|
||||
};
|
||||
|
||||
|
||||
|
||||
var callCount = 0;
|
||||
|
||||
var C = class { static async *gen() {
|
||||
callCount += 1;
|
||||
yield* obj;
|
||||
throw new Test262Error('abrupt completion closes iter');
|
||||
|
||||
}}
|
||||
|
||||
var gen = C.gen;
|
||||
|
||||
var iter = gen();
|
||||
|
||||
iter.next().then(() => {
|
||||
throw new Test262Error('Promise incorrectly fulfilled.');
|
||||
}, v => {
|
||||
assert.sameValue(v.constructor, TypeError, "TypeError");
|
||||
|
||||
iter.next().then(({ done, value }) => {
|
||||
assert.sameValue(done, true, 'the iterator is completed');
|
||||
assert.sameValue(value, undefined, 'value is undefined');
|
||||
}).then($DONE, $DONE);
|
||||
}).catch($DONE);
|
||||
|
||||
assert.sameValue(callCount, 1);
|
|
@ -0,0 +1,78 @@
|
|||
// This file was procedurally generated from the following sources:
|
||||
// - src/async-generators/yield-star-getiter-sync-not-callable-string-throw.case
|
||||
// - src/async-generators/default/async-class-expr-static-method.template
|
||||
/*---
|
||||
description: Throws a TypeError on a non-callable [Symbol.iterator] (string) (Static async generator method as a ClassExpression element)
|
||||
esid: prod-AsyncGeneratorMethod
|
||||
features: [async-iteration]
|
||||
flags: [generated, async]
|
||||
info: |
|
||||
ClassElement :
|
||||
static MethodDefinition
|
||||
|
||||
MethodDefinition :
|
||||
AsyncGeneratorMethod
|
||||
|
||||
Async Generator Function Definitions
|
||||
|
||||
AsyncGeneratorMethod :
|
||||
async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody }
|
||||
|
||||
|
||||
YieldExpression: yield * AssignmentExpression
|
||||
|
||||
1. Let exprRef be the result of evaluating AssignmentExpression.
|
||||
2. Let value be ? GetValue(exprRef).
|
||||
3. Let generatorKind be ! GetGeneratorKind().
|
||||
4. Let iterator be ? GetIterator(value, generatorKind).
|
||||
...
|
||||
|
||||
GetIterator ( obj [ , hint ] )
|
||||
|
||||
...
|
||||
3. If hint is async,
|
||||
a. Set method to ? GetMethod(obj, @@asyncIterator).
|
||||
b. If method is undefined,
|
||||
i. Let syncMethod be ? GetMethod(obj, @@iterator).
|
||||
...
|
||||
|
||||
GetMethod ( V, P )
|
||||
|
||||
...
|
||||
2. Let func be ? GetV(V, P).
|
||||
...
|
||||
4. If IsCallable(func) is false, throw a TypeError exception.
|
||||
...
|
||||
|
||||
---*/
|
||||
var obj = {
|
||||
[Symbol.iterator]: ''
|
||||
};
|
||||
|
||||
|
||||
|
||||
var callCount = 0;
|
||||
|
||||
var C = class { static async *gen() {
|
||||
callCount += 1;
|
||||
yield* obj;
|
||||
throw new Test262Error('abrupt completion closes iter');
|
||||
|
||||
}}
|
||||
|
||||
var gen = C.gen;
|
||||
|
||||
var iter = gen();
|
||||
|
||||
iter.next().then(() => {
|
||||
throw new Test262Error('Promise incorrectly fulfilled.');
|
||||
}, v => {
|
||||
assert.sameValue(v.constructor, TypeError, "TypeError");
|
||||
|
||||
iter.next().then(({ done, value }) => {
|
||||
assert.sameValue(done, true, 'the iterator is completed');
|
||||
assert.sameValue(value, undefined, 'value is undefined');
|
||||
}).then($DONE, $DONE);
|
||||
}).catch($DONE);
|
||||
|
||||
assert.sameValue(callCount, 1);
|
|
@ -0,0 +1,78 @@
|
|||
// This file was procedurally generated from the following sources:
|
||||
// - src/async-generators/yield-star-getiter-sync-not-callable-symbol-throw.case
|
||||
// - src/async-generators/default/async-class-expr-static-method.template
|
||||
/*---
|
||||
description: Throws a TypeError on a non-callable [Symbol.iterator] (symbol) (Static async generator method as a ClassExpression element)
|
||||
esid: prod-AsyncGeneratorMethod
|
||||
features: [Symbol.asyncIterator, async-iteration]
|
||||
flags: [generated, async]
|
||||
info: |
|
||||
ClassElement :
|
||||
static MethodDefinition
|
||||
|
||||
MethodDefinition :
|
||||
AsyncGeneratorMethod
|
||||
|
||||
Async Generator Function Definitions
|
||||
|
||||
AsyncGeneratorMethod :
|
||||
async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody }
|
||||
|
||||
|
||||
YieldExpression: yield * AssignmentExpression
|
||||
|
||||
1. Let exprRef be the result of evaluating AssignmentExpression.
|
||||
2. Let value be ? GetValue(exprRef).
|
||||
3. Let generatorKind be ! GetGeneratorKind().
|
||||
4. Let iterator be ? GetIterator(value, generatorKind).
|
||||
...
|
||||
|
||||
GetIterator ( obj [ , hint ] )
|
||||
|
||||
...
|
||||
3. If hint is async,
|
||||
a. Set method to ? GetMethod(obj, @@asyncIterator).
|
||||
b. If method is undefined,
|
||||
i. Let syncMethod be ? GetMethod(obj, @@iterator).
|
||||
...
|
||||
|
||||
GetMethod ( V, P )
|
||||
|
||||
...
|
||||
2. Let func be ? GetV(V, P).
|
||||
...
|
||||
4. If IsCallable(func) is false, throw a TypeError exception.
|
||||
...
|
||||
|
||||
---*/
|
||||
var obj = {
|
||||
[Symbol.iterator]: Symbol.iterator
|
||||
};
|
||||
|
||||
|
||||
|
||||
var callCount = 0;
|
||||
|
||||
var C = class { static async *gen() {
|
||||
callCount += 1;
|
||||
yield* obj;
|
||||
throw new Test262Error('abrupt completion closes iter');
|
||||
|
||||
}}
|
||||
|
||||
var gen = C.gen;
|
||||
|
||||
var iter = gen();
|
||||
|
||||
iter.next().then(() => {
|
||||
throw new Test262Error('Promise incorrectly fulfilled.');
|
||||
}, v => {
|
||||
assert.sameValue(v.constructor, TypeError, "TypeError");
|
||||
|
||||
iter.next().then(({ done, value }) => {
|
||||
assert.sameValue(done, true, 'the iterator is completed');
|
||||
assert.sameValue(value, undefined, 'value is undefined');
|
||||
}).then($DONE, $DONE);
|
||||
}).catch($DONE);
|
||||
|
||||
assert.sameValue(callCount, 1);
|
|
@ -0,0 +1,73 @@
|
|||
// This file was procedurally generated from the following sources:
|
||||
// - src/async-generators/yield-star-getiter-sync-returns-abrupt.case
|
||||
// - src/async-generators/default/async-class-expr-static-method.template
|
||||
/*---
|
||||
description: Abrupt completion while calling [Symbol.iterator] (Static async generator method as a ClassExpression element)
|
||||
esid: prod-AsyncGeneratorMethod
|
||||
features: [Symbol.asyncIterator, async-iteration]
|
||||
flags: [generated, async]
|
||||
info: |
|
||||
ClassElement :
|
||||
static MethodDefinition
|
||||
|
||||
MethodDefinition :
|
||||
AsyncGeneratorMethod
|
||||
|
||||
Async Generator Function Definitions
|
||||
|
||||
AsyncGeneratorMethod :
|
||||
async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody }
|
||||
|
||||
|
||||
YieldExpression: yield * AssignmentExpression
|
||||
|
||||
1. Let exprRef be the result of evaluating AssignmentExpression.
|
||||
2. Let value be ? GetValue(exprRef).
|
||||
3. Let generatorKind be ! GetGeneratorKind().
|
||||
4. Let iterator be ? GetIterator(value, generatorKind).
|
||||
...
|
||||
|
||||
GetIterator ( obj [ , hint ] )
|
||||
|
||||
...
|
||||
3. If hint is async,
|
||||
a. Set method to ? GetMethod(obj, @@asyncIterator).
|
||||
i. Let syncMethod be ? GetMethod(obj, @@iterator).
|
||||
ii. Let syncIterator be ? Call(syncMethod, obj).
|
||||
...
|
||||
|
||||
---*/
|
||||
var reason = {};
|
||||
var obj = {
|
||||
[Symbol.iterator]() {
|
||||
throw reason;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
|
||||
var callCount = 0;
|
||||
|
||||
var C = class { static async *gen() {
|
||||
callCount += 1;
|
||||
yield* obj;
|
||||
throw new Test262Error('abrupt completion closes iter');
|
||||
|
||||
}}
|
||||
|
||||
var gen = C.gen;
|
||||
|
||||
var iter = gen();
|
||||
|
||||
iter.next().then(() => {
|
||||
throw new Test262Error('Promise incorrectly fulfilled.');
|
||||
}, v => {
|
||||
assert.sameValue(v, reason, "reject reason");
|
||||
|
||||
iter.next().then(({ done, value }) => {
|
||||
assert.sameValue(done, true, 'the iterator is completed');
|
||||
assert.sameValue(value, undefined, 'value is undefined');
|
||||
}).then($DONE, $DONE);
|
||||
}).catch($DONE);
|
||||
|
||||
assert.sameValue(callCount, 1);
|
|
@ -0,0 +1,78 @@
|
|||
// This file was procedurally generated from the following sources:
|
||||
// - src/async-generators/yield-star-getiter-sync-returns-boolean-throw.case
|
||||
// - src/async-generators/default/async-class-expr-static-method.template
|
||||
/*---
|
||||
description: Non object returned by [Symbol.iterator]() - boolean (Static async generator method as a ClassExpression element)
|
||||
esid: prod-AsyncGeneratorMethod
|
||||
features: [async-iteration]
|
||||
flags: [generated, async]
|
||||
info: |
|
||||
ClassElement :
|
||||
static MethodDefinition
|
||||
|
||||
MethodDefinition :
|
||||
AsyncGeneratorMethod
|
||||
|
||||
Async Generator Function Definitions
|
||||
|
||||
AsyncGeneratorMethod :
|
||||
async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody }
|
||||
|
||||
|
||||
YieldExpression: yield * AssignmentExpression
|
||||
|
||||
1. Let exprRef be the result of evaluating AssignmentExpression.
|
||||
2. Let value be ? GetValue(exprRef).
|
||||
3. Let generatorKind be ! GetGeneratorKind().
|
||||
4. Let iterator be ? GetIterator(value, generatorKind).
|
||||
...
|
||||
|
||||
GetIterator ( obj [ , hint ] )
|
||||
|
||||
...
|
||||
3. If hint is async,
|
||||
a. Set method to ? GetMethod(obj, @@asyncIterator).
|
||||
i. Let syncMethod be ? GetMethod(obj, @@iterator).
|
||||
ii. Let syncIterator be ? Call(syncMethod, obj).
|
||||
iii. Return ? CreateAsyncFromSyncIterator(syncIterator).
|
||||
...
|
||||
|
||||
CreateAsyncFromSyncIterator(syncIterator)
|
||||
|
||||
1. If Type(syncIterator) is not Object, throw a TypeError exception.
|
||||
...
|
||||
|
||||
---*/
|
||||
var obj = {
|
||||
[Symbol.iterator]() {
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
|
||||
var callCount = 0;
|
||||
|
||||
var C = class { static async *gen() {
|
||||
callCount += 1;
|
||||
yield* obj;
|
||||
throw new Test262Error('abrupt completion closes iter');
|
||||
|
||||
}}
|
||||
|
||||
var gen = C.gen;
|
||||
|
||||
var iter = gen();
|
||||
|
||||
iter.next().then(() => {
|
||||
throw new Test262Error('Promise incorrectly fulfilled.');
|
||||
}, v => {
|
||||
assert.sameValue(v.constructor, TypeError, "TypeError");
|
||||
|
||||
iter.next().then(({ done, value }) => {
|
||||
assert.sameValue(done, true, 'the iterator is completed');
|
||||
assert.sameValue(value, undefined, 'value is undefined');
|
||||
}).then($DONE, $DONE);
|
||||
}).catch($DONE);
|
||||
|
||||
assert.sameValue(callCount, 1);
|
|
@ -0,0 +1,78 @@
|
|||
// This file was procedurally generated from the following sources:
|
||||
// - src/async-generators/yield-star-getiter-sync-returns-null-throw.case
|
||||
// - src/async-generators/default/async-class-expr-static-method.template
|
||||
/*---
|
||||
description: Non object returned by [Symbol.iterator]() - null (Static async generator method as a ClassExpression element)
|
||||
esid: prod-AsyncGeneratorMethod
|
||||
features: [async-iteration]
|
||||
flags: [generated, async]
|
||||
info: |
|
||||
ClassElement :
|
||||
static MethodDefinition
|
||||
|
||||
MethodDefinition :
|
||||
AsyncGeneratorMethod
|
||||
|
||||
Async Generator Function Definitions
|
||||
|
||||
AsyncGeneratorMethod :
|
||||
async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody }
|
||||
|
||||
|
||||
YieldExpression: yield * AssignmentExpression
|
||||
|
||||
1. Let exprRef be the result of evaluating AssignmentExpression.
|
||||
2. Let value be ? GetValue(exprRef).
|
||||
3. Let generatorKind be ! GetGeneratorKind().
|
||||
4. Let iterator be ? GetIterator(value, generatorKind).
|
||||
...
|
||||
|
||||
GetIterator ( obj [ , hint ] )
|
||||
|
||||
...
|
||||
3. If hint is async,
|
||||
a. Set method to ? GetMethod(obj, @@asyncIterator).
|
||||
i. Let syncMethod be ? GetMethod(obj, @@iterator).
|
||||
ii. Let syncIterator be ? Call(syncMethod, obj).
|
||||
iii. Return ? CreateAsyncFromSyncIterator(syncIterator).
|
||||
...
|
||||
|
||||
CreateAsyncFromSyncIterator(syncIterator)
|
||||
|
||||
1. If Type(syncIterator) is not Object, throw a TypeError exception.
|
||||
...
|
||||
|
||||
---*/
|
||||
var obj = {
|
||||
[Symbol.iterator]() {
|
||||
return null;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
|
||||
var callCount = 0;
|
||||
|
||||
var C = class { static async *gen() {
|
||||
callCount += 1;
|
||||
yield* obj;
|
||||
throw new Test262Error('abrupt completion closes iter');
|
||||
|
||||
}}
|
||||
|
||||
var gen = C.gen;
|
||||
|
||||
var iter = gen();
|
||||
|
||||
iter.next().then(() => {
|
||||
throw new Test262Error('Promise incorrectly fulfilled.');
|
||||
}, v => {
|
||||
assert.sameValue(v.constructor, TypeError, "TypeError");
|
||||
|
||||
iter.next().then(({ done, value }) => {
|
||||
assert.sameValue(done, true, 'the iterator is completed');
|
||||
assert.sameValue(value, undefined, 'value is undefined');
|
||||
}).then($DONE, $DONE);
|
||||
}).catch($DONE);
|
||||
|
||||
assert.sameValue(callCount, 1);
|
|
@ -0,0 +1,78 @@
|
|||
// This file was procedurally generated from the following sources:
|
||||
// - src/async-generators/yield-star-getiter-sync-returns-number-throw.case
|
||||
// - src/async-generators/default/async-class-expr-static-method.template
|
||||
/*---
|
||||
description: Non object returned by [Symbol.iterator]() - number (Static async generator method as a ClassExpression element)
|
||||
esid: prod-AsyncGeneratorMethod
|
||||
features: [async-iteration]
|
||||
flags: [generated, async]
|
||||
info: |
|
||||
ClassElement :
|
||||
static MethodDefinition
|
||||
|
||||
MethodDefinition :
|
||||
AsyncGeneratorMethod
|
||||
|
||||
Async Generator Function Definitions
|
||||
|
||||
AsyncGeneratorMethod :
|
||||
async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody }
|
||||
|
||||
|
||||
YieldExpression: yield * AssignmentExpression
|
||||
|
||||
1. Let exprRef be the result of evaluating AssignmentExpression.
|
||||
2. Let value be ? GetValue(exprRef).
|
||||
3. Let generatorKind be ! GetGeneratorKind().
|
||||
4. Let iterator be ? GetIterator(value, generatorKind).
|
||||
...
|
||||
|
||||
GetIterator ( obj [ , hint ] )
|
||||
|
||||
...
|
||||
3. If hint is async,
|
||||
a. Set method to ? GetMethod(obj, @@asyncIterator).
|
||||
i. Let syncMethod be ? GetMethod(obj, @@iterator).
|
||||
ii. Let syncIterator be ? Call(syncMethod, obj).
|
||||
iii. Return ? CreateAsyncFromSyncIterator(syncIterator).
|
||||
...
|
||||
|
||||
CreateAsyncFromSyncIterator(syncIterator)
|
||||
|
||||
1. If Type(syncIterator) is not Object, throw a TypeError exception.
|
||||
...
|
||||
|
||||
---*/
|
||||
var obj = {
|
||||
[Symbol.iterator]() {
|
||||
return 0;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
|
||||
var callCount = 0;
|
||||
|
||||
var C = class { static async *gen() {
|
||||
callCount += 1;
|
||||
yield* obj;
|
||||
throw new Test262Error('abrupt completion closes iter');
|
||||
|
||||
}}
|
||||
|
||||
var gen = C.gen;
|
||||
|
||||
var iter = gen();
|
||||
|
||||
iter.next().then(() => {
|
||||
throw new Test262Error('Promise incorrectly fulfilled.');
|
||||
}, v => {
|
||||
assert.sameValue(v.constructor, TypeError, "TypeError");
|
||||
|
||||
iter.next().then(({ done, value }) => {
|
||||
assert.sameValue(done, true, 'the iterator is completed');
|
||||
assert.sameValue(value, undefined, 'value is undefined');
|
||||
}).then($DONE, $DONE);
|
||||
}).catch($DONE);
|
||||
|
||||
assert.sameValue(callCount, 1);
|
|
@ -0,0 +1,78 @@
|
|||
// This file was procedurally generated from the following sources:
|
||||
// - src/async-generators/yield-star-getiter-sync-returns-string-throw.case
|
||||
// - src/async-generators/default/async-class-expr-static-method.template
|
||||
/*---
|
||||
description: Non object returned by [Symbol.iterator]() - string (Static async generator method as a ClassExpression element)
|
||||
esid: prod-AsyncGeneratorMethod
|
||||
features: [async-iteration]
|
||||
flags: [generated, async]
|
||||
info: |
|
||||
ClassElement :
|
||||
static MethodDefinition
|
||||
|
||||
MethodDefinition :
|
||||
AsyncGeneratorMethod
|
||||
|
||||
Async Generator Function Definitions
|
||||
|
||||
AsyncGeneratorMethod :
|
||||
async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody }
|
||||
|
||||
|
||||
YieldExpression: yield * AssignmentExpression
|
||||
|
||||
1. Let exprRef be the result of evaluating AssignmentExpression.
|
||||
2. Let value be ? GetValue(exprRef).
|
||||
3. Let generatorKind be ! GetGeneratorKind().
|
||||
4. Let iterator be ? GetIterator(value, generatorKind).
|
||||
...
|
||||
|
||||
GetIterator ( obj [ , hint ] )
|
||||
|
||||
...
|
||||
3. If hint is async,
|
||||
a. Set method to ? GetMethod(obj, @@asyncIterator).
|
||||
i. Let syncMethod be ? GetMethod(obj, @@iterator).
|
||||
ii. Let syncIterator be ? Call(syncMethod, obj).
|
||||
iii. Return ? CreateAsyncFromSyncIterator(syncIterator).
|
||||
...
|
||||
|
||||
CreateAsyncFromSyncIterator(syncIterator)
|
||||
|
||||
1. If Type(syncIterator) is not Object, throw a TypeError exception.
|
||||
...
|
||||
|
||||
---*/
|
||||
var obj = {
|
||||
[Symbol.iterator]() {
|
||||
return '';
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
|
||||
var callCount = 0;
|
||||
|
||||
var C = class { static async *gen() {
|
||||
callCount += 1;
|
||||
yield* obj;
|
||||
throw new Test262Error('abrupt completion closes iter');
|
||||
|
||||
}}
|
||||
|
||||
var gen = C.gen;
|
||||
|
||||
var iter = gen();
|
||||
|
||||
iter.next().then(() => {
|
||||
throw new Test262Error('Promise incorrectly fulfilled.');
|
||||
}, v => {
|
||||
assert.sameValue(v.constructor, TypeError, "TypeError");
|
||||
|
||||
iter.next().then(({ done, value }) => {
|
||||
assert.sameValue(done, true, 'the iterator is completed');
|
||||
assert.sameValue(value, undefined, 'value is undefined');
|
||||
}).then($DONE, $DONE);
|
||||
}).catch($DONE);
|
||||
|
||||
assert.sameValue(callCount, 1);
|
|
@ -0,0 +1,78 @@
|
|||
// This file was procedurally generated from the following sources:
|
||||
// - src/async-generators/yield-star-getiter-sync-returns-symbol-throw.case
|
||||
// - src/async-generators/default/async-class-expr-static-method.template
|
||||
/*---
|
||||
description: Non object returned by [Symbol.iterator]() - symbol (Static async generator method as a ClassExpression element)
|
||||
esid: prod-AsyncGeneratorMethod
|
||||
features: [async-iteration]
|
||||
flags: [generated, async]
|
||||
info: |
|
||||
ClassElement :
|
||||
static MethodDefinition
|
||||
|
||||
MethodDefinition :
|
||||
AsyncGeneratorMethod
|
||||
|
||||
Async Generator Function Definitions
|
||||
|
||||
AsyncGeneratorMethod :
|
||||
async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody }
|
||||
|
||||
|
||||
YieldExpression: yield * AssignmentExpression
|
||||
|
||||
1. Let exprRef be the result of evaluating AssignmentExpression.
|
||||
2. Let value be ? GetValue(exprRef).
|
||||
3. Let generatorKind be ! GetGeneratorKind().
|
||||
4. Let iterator be ? GetIterator(value, generatorKind).
|
||||
...
|
||||
|
||||
GetIterator ( obj [ , hint ] )
|
||||
|
||||
...
|
||||
3. If hint is async,
|
||||
a. Set method to ? GetMethod(obj, @@asyncIterator).
|
||||
i. Let syncMethod be ? GetMethod(obj, @@iterator).
|
||||
ii. Let syncIterator be ? Call(syncMethod, obj).
|
||||
iii. Return ? CreateAsyncFromSyncIterator(syncIterator).
|
||||
...
|
||||
|
||||
CreateAsyncFromSyncIterator(syncIterator)
|
||||
|
||||
1. If Type(syncIterator) is not Object, throw a TypeError exception.
|
||||
...
|
||||
|
||||
---*/
|
||||
var obj = {
|
||||
[Symbol.iterator]() {
|
||||
return Symbol.iterator;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
|
||||
var callCount = 0;
|
||||
|
||||
var C = class { static async *gen() {
|
||||
callCount += 1;
|
||||
yield* obj;
|
||||
throw new Test262Error('abrupt completion closes iter');
|
||||
|
||||
}}
|
||||
|
||||
var gen = C.gen;
|
||||
|
||||
var iter = gen();
|
||||
|
||||
iter.next().then(() => {
|
||||
throw new Test262Error('Promise incorrectly fulfilled.');
|
||||
}, v => {
|
||||
assert.sameValue(v.constructor, TypeError, "TypeError");
|
||||
|
||||
iter.next().then(({ done, value }) => {
|
||||
assert.sameValue(done, true, 'the iterator is completed');
|
||||
assert.sameValue(value, undefined, 'value is undefined');
|
||||
}).then($DONE, $DONE);
|
||||
}).catch($DONE);
|
||||
|
||||
assert.sameValue(callCount, 1);
|
|
@ -0,0 +1,78 @@
|
|||
// This file was procedurally generated from the following sources:
|
||||
// - src/async-generators/yield-star-getiter-sync-returns-undefined-throw.case
|
||||
// - src/async-generators/default/async-class-expr-static-method.template
|
||||
/*---
|
||||
description: Non object returned by [Symbol.iterator]() - undefined (Static async generator method as a ClassExpression element)
|
||||
esid: prod-AsyncGeneratorMethod
|
||||
features: [async-iteration]
|
||||
flags: [generated, async]
|
||||
info: |
|
||||
ClassElement :
|
||||
static MethodDefinition
|
||||
|
||||
MethodDefinition :
|
||||
AsyncGeneratorMethod
|
||||
|
||||
Async Generator Function Definitions
|
||||
|
||||
AsyncGeneratorMethod :
|
||||
async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody }
|
||||
|
||||
|
||||
YieldExpression: yield * AssignmentExpression
|
||||
|
||||
1. Let exprRef be the result of evaluating AssignmentExpression.
|
||||
2. Let value be ? GetValue(exprRef).
|
||||
3. Let generatorKind be ! GetGeneratorKind().
|
||||
4. Let iterator be ? GetIterator(value, generatorKind).
|
||||
...
|
||||
|
||||
GetIterator ( obj [ , hint ] )
|
||||
|
||||
...
|
||||
3. If hint is async,
|
||||
a. Set method to ? GetMethod(obj, @@asyncIterator).
|
||||
i. Let syncMethod be ? GetMethod(obj, @@iterator).
|
||||
ii. Let syncIterator be ? Call(syncMethod, obj).
|
||||
iii. Return ? CreateAsyncFromSyncIterator(syncIterator).
|
||||
...
|
||||
|
||||
CreateAsyncFromSyncIterator(syncIterator)
|
||||
|
||||
1. If Type(syncIterator) is not Object, throw a TypeError exception.
|
||||
...
|
||||
|
||||
---*/
|
||||
var obj = {
|
||||
[Symbol.iterator]() {
|
||||
return undefined;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
|
||||
var callCount = 0;
|
||||
|
||||
var C = class { static async *gen() {
|
||||
callCount += 1;
|
||||
yield* obj;
|
||||
throw new Test262Error('abrupt completion closes iter');
|
||||
|
||||
}}
|
||||
|
||||
var gen = C.gen;
|
||||
|
||||
var iter = gen();
|
||||
|
||||
iter.next().then(() => {
|
||||
throw new Test262Error('Promise incorrectly fulfilled.');
|
||||
}, v => {
|
||||
assert.sameValue(v.constructor, TypeError, "TypeError");
|
||||
|
||||
iter.next().then(({ done, value }) => {
|
||||
assert.sameValue(done, true, 'the iterator is completed');
|
||||
assert.sameValue(value, undefined, 'value is undefined');
|
||||
}).then($DONE, $DONE);
|
||||
}).catch($DONE);
|
||||
|
||||
assert.sameValue(callCount, 1);
|
|
@ -0,0 +1,60 @@
|
|||
// This file was procedurally generated from the following sources:
|
||||
// - src/async-generators/yield-star-expr-abrupt.case
|
||||
// - src/async-generators/default/async-class-expr-method.template
|
||||
/*---
|
||||
description: Abrupt completion while getting yield* operand (Async generator method as a ClassExpression element)
|
||||
esid: prod-AsyncGeneratorMethod
|
||||
features: [async-iteration]
|
||||
flags: [generated, async]
|
||||
info: |
|
||||
ClassElement :
|
||||
MethodDefinition
|
||||
|
||||
MethodDefinition :
|
||||
AsyncGeneratorMethod
|
||||
|
||||
Async Generator Function Definitions
|
||||
|
||||
AsyncGeneratorMethod :
|
||||
async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody }
|
||||
|
||||
|
||||
YieldExpression: yield * AssignmentExpression
|
||||
|
||||
1. Let exprRef be the result of evaluating AssignmentExpression.
|
||||
2. Let value be ? GetValue(exprRef).
|
||||
...
|
||||
|
||||
---*/
|
||||
var obj = {};
|
||||
var abrupt = function() {
|
||||
throw obj;
|
||||
};
|
||||
|
||||
|
||||
|
||||
var callCount = 0;
|
||||
|
||||
var C = class { async *gen() {
|
||||
callCount += 1;
|
||||
yield* abrupt();
|
||||
throw new Test262Error('abrupt completion closes iter');
|
||||
|
||||
}}
|
||||
|
||||
var gen = C.prototype.gen;
|
||||
|
||||
var iter = gen();
|
||||
|
||||
iter.next().then(() => {
|
||||
throw new Test262Error('Promise incorrectly fulfilled.');
|
||||
}, v => {
|
||||
assert.sameValue(v, obj, "reject reason");
|
||||
|
||||
iter.next().then(({ done, value }) => {
|
||||
assert.sameValue(done, true, 'the iterator is completed');
|
||||
assert.sameValue(value, undefined, 'value is undefined');
|
||||
}).then($DONE, $DONE);
|
||||
}).catch($DONE);
|
||||
|
||||
assert.sameValue(callCount, 1);
|
|
@ -0,0 +1,80 @@
|
|||
// This file was procedurally generated from the following sources:
|
||||
// - src/async-generators/yield-star-getiter-async-get-abrupt.case
|
||||
// - src/async-generators/default/async-class-expr-method.template
|
||||
/*---
|
||||
description: Abrupt completion while getting [Symbol.asyncIterator] (Async generator method as a ClassExpression element)
|
||||
esid: prod-AsyncGeneratorMethod
|
||||
features: [Symbol.asyncIterator, async-iteration]
|
||||
flags: [generated, async]
|
||||
info: |
|
||||
ClassElement :
|
||||
MethodDefinition
|
||||
|
||||
MethodDefinition :
|
||||
AsyncGeneratorMethod
|
||||
|
||||
Async Generator Function Definitions
|
||||
|
||||
AsyncGeneratorMethod :
|
||||
async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody }
|
||||
|
||||
|
||||
YieldExpression: yield * AssignmentExpression
|
||||
|
||||
1. Let exprRef be the result of evaluating AssignmentExpression.
|
||||
2. Let value be ? GetValue(exprRef).
|
||||
3. Let generatorKind be ! GetGeneratorKind().
|
||||
4. Let iterator be ? GetIterator(value, generatorKind).
|
||||
...
|
||||
|
||||
GetIterator ( obj [ , hint ] )
|
||||
|
||||
...
|
||||
3. If hint is async,
|
||||
a. Set method to ? GetMethod(obj, @@asyncIterator).
|
||||
...
|
||||
|
||||
GetMethod ( V, P )
|
||||
|
||||
...
|
||||
2. Let func be ? GetV(V, P).
|
||||
...
|
||||
|
||||
---*/
|
||||
var reason = {};
|
||||
var obj = {
|
||||
get [Symbol.iterator]() {
|
||||
throw new Test262Error('it should not get Symbol.iterator');
|
||||
},
|
||||
get [Symbol.asyncIterator]() {
|
||||
throw reason;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
|
||||
var callCount = 0;
|
||||
|
||||
var C = class { async *gen() {
|
||||
callCount += 1;
|
||||
yield* obj;
|
||||
throw new Test262Error('abrupt completion closes iter');
|
||||
|
||||
}}
|
||||
|
||||
var gen = C.prototype.gen;
|
||||
|
||||
var iter = gen();
|
||||
|
||||
iter.next().then(() => {
|
||||
throw new Test262Error('Promise incorrectly fulfilled.');
|
||||
}, v => {
|
||||
assert.sameValue(v, reason, "reject reason");
|
||||
|
||||
iter.next().then(({ done, value }) => {
|
||||
assert.sameValue(done, true, 'the iterator is completed');
|
||||
assert.sameValue(value, undefined, 'value is undefined');
|
||||
}).then($DONE, $DONE);
|
||||
}).catch($DONE);
|
||||
|
||||
assert.sameValue(callCount, 1);
|
|
@ -0,0 +1,79 @@
|
|||
// This file was procedurally generated from the following sources:
|
||||
// - src/async-generators/yield-star-getiter-async-not-callable-boolean-throw.case
|
||||
// - src/async-generators/default/async-class-expr-method.template
|
||||
/*---
|
||||
description: Throws a TypeError on a non-callable [Symbol.asyncIterator] (boolean) (Async generator method as a ClassExpression element)
|
||||
esid: prod-AsyncGeneratorMethod
|
||||
features: [Symbol.asyncIterator, async-iteration]
|
||||
flags: [generated, async]
|
||||
info: |
|
||||
ClassElement :
|
||||
MethodDefinition
|
||||
|
||||
MethodDefinition :
|
||||
AsyncGeneratorMethod
|
||||
|
||||
Async Generator Function Definitions
|
||||
|
||||
AsyncGeneratorMethod :
|
||||
async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody }
|
||||
|
||||
|
||||
YieldExpression: yield * AssignmentExpression
|
||||
|
||||
1. Let exprRef be the result of evaluating AssignmentExpression.
|
||||
2. Let value be ? GetValue(exprRef).
|
||||
3. Let generatorKind be ! GetGeneratorKind().
|
||||
4. Let iterator be ? GetIterator(value, generatorKind).
|
||||
...
|
||||
|
||||
GetIterator ( obj [ , hint ] )
|
||||
|
||||
...
|
||||
3. If hint is async,
|
||||
a. Set method to ? GetMethod(obj, @@asyncIterator).
|
||||
...
|
||||
|
||||
GetMethod ( V, P )
|
||||
|
||||
...
|
||||
2. Let func be ? GetV(V, P).
|
||||
3. If func is either undefined or null, return undefined.
|
||||
4. If IsCallable(func) is false, throw a TypeError exception.
|
||||
...
|
||||
|
||||
---*/
|
||||
var obj = {
|
||||
get [Symbol.iterator]() {
|
||||
throw new Test262Error('it should not get Symbol.iterator');
|
||||
},
|
||||
[Symbol.asyncIterator]: false
|
||||
};
|
||||
|
||||
|
||||
|
||||
var callCount = 0;
|
||||
|
||||
var C = class { async *gen() {
|
||||
callCount += 1;
|
||||
yield* obj;
|
||||
throw new Test262Error('abrupt completion closes iter');
|
||||
|
||||
}}
|
||||
|
||||
var gen = C.prototype.gen;
|
||||
|
||||
var iter = gen();
|
||||
|
||||
iter.next().then(() => {
|
||||
throw new Test262Error('Promise incorrectly fulfilled.');
|
||||
}, v => {
|
||||
assert.sameValue(v.constructor, TypeError, "TypeError");
|
||||
|
||||
iter.next().then(({ done, value }) => {
|
||||
assert.sameValue(done, true, 'the iterator is completed');
|
||||
assert.sameValue(value, undefined, 'value is undefined');
|
||||
}).then($DONE, $DONE);
|
||||
}).catch($DONE);
|
||||
|
||||
assert.sameValue(callCount, 1);
|
|
@ -0,0 +1,79 @@
|
|||
// This file was procedurally generated from the following sources:
|
||||
// - src/async-generators/yield-star-getiter-async-not-callable-number-throw.case
|
||||
// - src/async-generators/default/async-class-expr-method.template
|
||||
/*---
|
||||
description: Throws a TypeError on a non-callable [Symbol.asyncIterator] (number) (Async generator method as a ClassExpression element)
|
||||
esid: prod-AsyncGeneratorMethod
|
||||
features: [Symbol.asyncIterator, async-iteration]
|
||||
flags: [generated, async]
|
||||
info: |
|
||||
ClassElement :
|
||||
MethodDefinition
|
||||
|
||||
MethodDefinition :
|
||||
AsyncGeneratorMethod
|
||||
|
||||
Async Generator Function Definitions
|
||||
|
||||
AsyncGeneratorMethod :
|
||||
async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody }
|
||||
|
||||
|
||||
YieldExpression: yield * AssignmentExpression
|
||||
|
||||
1. Let exprRef be the result of evaluating AssignmentExpression.
|
||||
2. Let value be ? GetValue(exprRef).
|
||||
3. Let generatorKind be ! GetGeneratorKind().
|
||||
4. Let iterator be ? GetIterator(value, generatorKind).
|
||||
...
|
||||
|
||||
GetIterator ( obj [ , hint ] )
|
||||
|
||||
...
|
||||
3. If hint is async,
|
||||
a. Set method to ? GetMethod(obj, @@asyncIterator).
|
||||
...
|
||||
|
||||
GetMethod ( V, P )
|
||||
|
||||
...
|
||||
2. Let func be ? GetV(V, P).
|
||||
3. If func is either undefined or null, return undefined.
|
||||
4. If IsCallable(func) is false, throw a TypeError exception.
|
||||
...
|
||||
|
||||
---*/
|
||||
var obj = {
|
||||
get [Symbol.iterator]() {
|
||||
throw new Test262Error('it should not get Symbol.iterator');
|
||||
},
|
||||
[Symbol.asyncIterator]: 0
|
||||
};
|
||||
|
||||
|
||||
|
||||
var callCount = 0;
|
||||
|
||||
var C = class { async *gen() {
|
||||
callCount += 1;
|
||||
yield* obj;
|
||||
throw new Test262Error('abrupt completion closes iter');
|
||||
|
||||
}}
|
||||
|
||||
var gen = C.prototype.gen;
|
||||
|
||||
var iter = gen();
|
||||
|
||||
iter.next().then(() => {
|
||||
throw new Test262Error('Promise incorrectly fulfilled.');
|
||||
}, v => {
|
||||
assert.sameValue(v.constructor, TypeError, "TypeError");
|
||||
|
||||
iter.next().then(({ done, value }) => {
|
||||
assert.sameValue(done, true, 'the iterator is completed');
|
||||
assert.sameValue(value, undefined, 'value is undefined');
|
||||
}).then($DONE, $DONE);
|
||||
}).catch($DONE);
|
||||
|
||||
assert.sameValue(callCount, 1);
|
|
@ -0,0 +1,79 @@
|
|||
// This file was procedurally generated from the following sources:
|
||||
// - src/async-generators/yield-star-getiter-async-not-callable-object-throw.case
|
||||
// - src/async-generators/default/async-class-expr-method.template
|
||||
/*---
|
||||
description: Throws a TypeError on a non-callable [Symbol.asyncIterator] (object) (Async generator method as a ClassExpression element)
|
||||
esid: prod-AsyncGeneratorMethod
|
||||
features: [Symbol.asyncIterator, async-iteration]
|
||||
flags: [generated, async]
|
||||
info: |
|
||||
ClassElement :
|
||||
MethodDefinition
|
||||
|
||||
MethodDefinition :
|
||||
AsyncGeneratorMethod
|
||||
|
||||
Async Generator Function Definitions
|
||||
|
||||
AsyncGeneratorMethod :
|
||||
async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody }
|
||||
|
||||
|
||||
YieldExpression: yield * AssignmentExpression
|
||||
|
||||
1. Let exprRef be the result of evaluating AssignmentExpression.
|
||||
2. Let value be ? GetValue(exprRef).
|
||||
3. Let generatorKind be ! GetGeneratorKind().
|
||||
4. Let iterator be ? GetIterator(value, generatorKind).
|
||||
...
|
||||
|
||||
GetIterator ( obj [ , hint ] )
|
||||
|
||||
...
|
||||
3. If hint is async,
|
||||
a. Set method to ? GetMethod(obj, @@asyncIterator).
|
||||
...
|
||||
|
||||
GetMethod ( V, P )
|
||||
|
||||
...
|
||||
2. Let func be ? GetV(V, P).
|
||||
3. If func is either undefined or null, return undefined.
|
||||
4. If IsCallable(func) is false, throw a TypeError exception.
|
||||
...
|
||||
|
||||
---*/
|
||||
var obj = {
|
||||
get [Symbol.iterator]() {
|
||||
throw new Test262Error('it should not get Symbol.iterator');
|
||||
},
|
||||
[Symbol.asyncIterator]: {}
|
||||
};
|
||||
|
||||
|
||||
|
||||
var callCount = 0;
|
||||
|
||||
var C = class { async *gen() {
|
||||
callCount += 1;
|
||||
yield* obj;
|
||||
throw new Test262Error('abrupt completion closes iter');
|
||||
|
||||
}}
|
||||
|
||||
var gen = C.prototype.gen;
|
||||
|
||||
var iter = gen();
|
||||
|
||||
iter.next().then(() => {
|
||||
throw new Test262Error('Promise incorrectly fulfilled.');
|
||||
}, v => {
|
||||
assert.sameValue(v.constructor, TypeError, "TypeError");
|
||||
|
||||
iter.next().then(({ done, value }) => {
|
||||
assert.sameValue(done, true, 'the iterator is completed');
|
||||
assert.sameValue(value, undefined, 'value is undefined');
|
||||
}).then($DONE, $DONE);
|
||||
}).catch($DONE);
|
||||
|
||||
assert.sameValue(callCount, 1);
|
|
@ -0,0 +1,79 @@
|
|||
// This file was procedurally generated from the following sources:
|
||||
// - src/async-generators/yield-star-getiter-async-not-callable-string-throw.case
|
||||
// - src/async-generators/default/async-class-expr-method.template
|
||||
/*---
|
||||
description: Throws a TypeError on a non-callable [Symbol.asyncIterator] (string) (Async generator method as a ClassExpression element)
|
||||
esid: prod-AsyncGeneratorMethod
|
||||
features: [Symbol.asyncIterator, async-iteration]
|
||||
flags: [generated, async]
|
||||
info: |
|
||||
ClassElement :
|
||||
MethodDefinition
|
||||
|
||||
MethodDefinition :
|
||||
AsyncGeneratorMethod
|
||||
|
||||
Async Generator Function Definitions
|
||||
|
||||
AsyncGeneratorMethod :
|
||||
async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody }
|
||||
|
||||
|
||||
YieldExpression: yield * AssignmentExpression
|
||||
|
||||
1. Let exprRef be the result of evaluating AssignmentExpression.
|
||||
2. Let value be ? GetValue(exprRef).
|
||||
3. Let generatorKind be ! GetGeneratorKind().
|
||||
4. Let iterator be ? GetIterator(value, generatorKind).
|
||||
...
|
||||
|
||||
GetIterator ( obj [ , hint ] )
|
||||
|
||||
...
|
||||
3. If hint is async,
|
||||
a. Set method to ? GetMethod(obj, @@asyncIterator).
|
||||
...
|
||||
|
||||
GetMethod ( V, P )
|
||||
|
||||
...
|
||||
2. Let func be ? GetV(V, P).
|
||||
3. If func is either undefined or null, return undefined.
|
||||
4. If IsCallable(func) is false, throw a TypeError exception.
|
||||
...
|
||||
|
||||
---*/
|
||||
var obj = {
|
||||
get [Symbol.iterator]() {
|
||||
throw new Test262Error('it should not get Symbol.iterator');
|
||||
},
|
||||
[Symbol.asyncIterator]: ''
|
||||
};
|
||||
|
||||
|
||||
|
||||
var callCount = 0;
|
||||
|
||||
var C = class { async *gen() {
|
||||
callCount += 1;
|
||||
yield* obj;
|
||||
throw new Test262Error('abrupt completion closes iter');
|
||||
|
||||
}}
|
||||
|
||||
var gen = C.prototype.gen;
|
||||
|
||||
var iter = gen();
|
||||
|
||||
iter.next().then(() => {
|
||||
throw new Test262Error('Promise incorrectly fulfilled.');
|
||||
}, v => {
|
||||
assert.sameValue(v.constructor, TypeError, "TypeError");
|
||||
|
||||
iter.next().then(({ done, value }) => {
|
||||
assert.sameValue(done, true, 'the iterator is completed');
|
||||
assert.sameValue(value, undefined, 'value is undefined');
|
||||
}).then($DONE, $DONE);
|
||||
}).catch($DONE);
|
||||
|
||||
assert.sameValue(callCount, 1);
|
|
@ -0,0 +1,79 @@
|
|||
// This file was procedurally generated from the following sources:
|
||||
// - src/async-generators/yield-star-getiter-async-not-callable-symbol-throw.case
|
||||
// - src/async-generators/default/async-class-expr-method.template
|
||||
/*---
|
||||
description: Throws a TypeError on a non-callable [Symbol.asyncIterator] (symbol) (Async generator method as a ClassExpression element)
|
||||
esid: prod-AsyncGeneratorMethod
|
||||
features: [Symbol.asyncIterator, async-iteration]
|
||||
flags: [generated, async]
|
||||
info: |
|
||||
ClassElement :
|
||||
MethodDefinition
|
||||
|
||||
MethodDefinition :
|
||||
AsyncGeneratorMethod
|
||||
|
||||
Async Generator Function Definitions
|
||||
|
||||
AsyncGeneratorMethod :
|
||||
async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody }
|
||||
|
||||
|
||||
YieldExpression: yield * AssignmentExpression
|
||||
|
||||
1. Let exprRef be the result of evaluating AssignmentExpression.
|
||||
2. Let value be ? GetValue(exprRef).
|
||||
3. Let generatorKind be ! GetGeneratorKind().
|
||||
4. Let iterator be ? GetIterator(value, generatorKind).
|
||||
...
|
||||
|
||||
GetIterator ( obj [ , hint ] )
|
||||
|
||||
...
|
||||
3. If hint is async,
|
||||
a. Set method to ? GetMethod(obj, @@asyncIterator).
|
||||
...
|
||||
|
||||
GetMethod ( V, P )
|
||||
|
||||
...
|
||||
2. Let func be ? GetV(V, P).
|
||||
3. If func is either undefined or null, return undefined.
|
||||
4. If IsCallable(func) is false, throw a TypeError exception.
|
||||
...
|
||||
|
||||
---*/
|
||||
var obj = {
|
||||
get [Symbol.iterator]() {
|
||||
throw new Test262Error('it should not get Symbol.iterator');
|
||||
},
|
||||
[Symbol.asyncIterator]: Symbol.asyncIterator
|
||||
};
|
||||
|
||||
|
||||
|
||||
var callCount = 0;
|
||||
|
||||
var C = class { async *gen() {
|
||||
callCount += 1;
|
||||
yield* obj;
|
||||
throw new Test262Error('abrupt completion closes iter');
|
||||
|
||||
}}
|
||||
|
||||
var gen = C.prototype.gen;
|
||||
|
||||
var iter = gen();
|
||||
|
||||
iter.next().then(() => {
|
||||
throw new Test262Error('Promise incorrectly fulfilled.');
|
||||
}, v => {
|
||||
assert.sameValue(v.constructor, TypeError, "TypeError");
|
||||
|
||||
iter.next().then(({ done, value }) => {
|
||||
assert.sameValue(done, true, 'the iterator is completed');
|
||||
assert.sameValue(value, undefined, 'value is undefined');
|
||||
}).then($DONE, $DONE);
|
||||
}).catch($DONE);
|
||||
|
||||
assert.sameValue(callCount, 1);
|
|
@ -0,0 +1,85 @@
|
|||
// This file was procedurally generated from the following sources:
|
||||
// - src/async-generators/yield-star-getiter-async-null-sync-get-abrupt.case
|
||||
// - src/async-generators/default/async-class-expr-method.template
|
||||
/*---
|
||||
description: Abrupt completion while getting @@iterator after null @@asyncIterator (Async generator method as a ClassExpression element)
|
||||
esid: prod-AsyncGeneratorMethod
|
||||
features: [Symbol.asyncIterator, async-iteration]
|
||||
flags: [generated, async]
|
||||
info: |
|
||||
ClassElement :
|
||||
MethodDefinition
|
||||
|
||||
MethodDefinition :
|
||||
AsyncGeneratorMethod
|
||||
|
||||
Async Generator Function Definitions
|
||||
|
||||
AsyncGeneratorMethod :
|
||||
async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody }
|
||||
|
||||
|
||||
YieldExpression: yield * AssignmentExpression
|
||||
|
||||
1. Let exprRef be the result of evaluating AssignmentExpression.
|
||||
2. Let value be ? GetValue(exprRef).
|
||||
3. Let generatorKind be ! GetGeneratorKind().
|
||||
4. Let iterator be ? GetIterator(value, generatorKind).
|
||||
...
|
||||
|
||||
GetIterator ( obj [ , hint ] )
|
||||
|
||||
...
|
||||
3. If hint is async,
|
||||
a. Set method to ? GetMethod(obj, @@asyncIterator).
|
||||
b. If method is undefined,
|
||||
i. Let syncMethod be ? GetMethod(obj, @@iterator).
|
||||
...
|
||||
|
||||
GetMethod ( V, P )
|
||||
|
||||
...
|
||||
2. Let func be ? GetV(V, P).
|
||||
...
|
||||
|
||||
---*/
|
||||
var calls = 0;
|
||||
var reason = {};
|
||||
var obj = {
|
||||
get [Symbol.iterator]() {
|
||||
throw reason;
|
||||
},
|
||||
get [Symbol.asyncIterator]() {
|
||||
calls += 1;
|
||||
return null;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
|
||||
var callCount = 0;
|
||||
|
||||
var C = class { async *gen() {
|
||||
callCount += 1;
|
||||
yield* obj;
|
||||
throw new Test262Error('abrupt completion closes iter');
|
||||
|
||||
}}
|
||||
|
||||
var gen = C.prototype.gen;
|
||||
|
||||
var iter = gen();
|
||||
|
||||
iter.next().then(() => {
|
||||
throw new Test262Error('Promise incorrectly fulfilled.');
|
||||
}, v => {
|
||||
assert.sameValue(v, reason, 'reject reason');
|
||||
assert.sameValue(calls, 1);
|
||||
|
||||
iter.next().then(({ done, value }) => {
|
||||
assert.sameValue(done, true, 'the iterator is completed');
|
||||
assert.sameValue(value, undefined, 'value is undefined');
|
||||
}).then($DONE, $DONE);
|
||||
}).catch($DONE);
|
||||
|
||||
assert.sameValue(callCount, 1);
|
|
@ -0,0 +1,76 @@
|
|||
// This file was procedurally generated from the following sources:
|
||||
// - src/async-generators/yield-star-getiter-async-returns-abrupt.case
|
||||
// - src/async-generators/default/async-class-expr-method.template
|
||||
/*---
|
||||
description: Abrupt completion while calling [Symbol.asyncIterator] (Async generator method as a ClassExpression element)
|
||||
esid: prod-AsyncGeneratorMethod
|
||||
features: [Symbol.asyncIterator, async-iteration]
|
||||
flags: [generated, async]
|
||||
info: |
|
||||
ClassElement :
|
||||
MethodDefinition
|
||||
|
||||
MethodDefinition :
|
||||
AsyncGeneratorMethod
|
||||
|
||||
Async Generator Function Definitions
|
||||
|
||||
AsyncGeneratorMethod :
|
||||
async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody }
|
||||
|
||||
|
||||
YieldExpression: yield * AssignmentExpression
|
||||
|
||||
1. Let exprRef be the result of evaluating AssignmentExpression.
|
||||
2. Let value be ? GetValue(exprRef).
|
||||
3. Let generatorKind be ! GetGeneratorKind().
|
||||
4. Let iterator be ? GetIterator(value, generatorKind).
|
||||
...
|
||||
|
||||
GetIterator ( obj [ , hint ] )
|
||||
|
||||
...
|
||||
3. If hint is async,
|
||||
a. Set method to ? GetMethod(obj, @@asyncIterator).
|
||||
...
|
||||
6. Let iterator be ? Call(method, obj).
|
||||
...
|
||||
|
||||
---*/
|
||||
var reason = {};
|
||||
var obj = {
|
||||
get [Symbol.iterator]() {
|
||||
throw new Test262Error('it should not get Symbol.iterator');
|
||||
},
|
||||
[Symbol.asyncIterator]() {
|
||||
throw reason;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
|
||||
var callCount = 0;
|
||||
|
||||
var C = class { async *gen() {
|
||||
callCount += 1;
|
||||
yield* obj;
|
||||
throw new Test262Error('abrupt completion closes iter');
|
||||
|
||||
}}
|
||||
|
||||
var gen = C.prototype.gen;
|
||||
|
||||
var iter = gen();
|
||||
|
||||
iter.next().then(() => {
|
||||
throw new Test262Error('Promise incorrectly fulfilled.');
|
||||
}, v => {
|
||||
assert.sameValue(v, reason, "reject reason");
|
||||
|
||||
iter.next().then(({ done, value }) => {
|
||||
assert.sameValue(done, true, 'the iterator is completed');
|
||||
assert.sameValue(value, undefined, 'value is undefined');
|
||||
}).then($DONE, $DONE);
|
||||
}).catch($DONE);
|
||||
|
||||
assert.sameValue(callCount, 1);
|
|
@ -0,0 +1,76 @@
|
|||
// This file was procedurally generated from the following sources:
|
||||
// - src/async-generators/yield-star-getiter-async-returns-boolean-throw.case
|
||||
// - src/async-generators/default/async-class-expr-method.template
|
||||
/*---
|
||||
description: Non object returned by [Symbol.asyncIterator]() - boolean (Async generator method as a ClassExpression element)
|
||||
esid: prod-AsyncGeneratorMethod
|
||||
features: [Symbol.asyncIterator, async-iteration]
|
||||
flags: [generated, async]
|
||||
info: |
|
||||
ClassElement :
|
||||
MethodDefinition
|
||||
|
||||
MethodDefinition :
|
||||
AsyncGeneratorMethod
|
||||
|
||||
Async Generator Function Definitions
|
||||
|
||||
AsyncGeneratorMethod :
|
||||
async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody }
|
||||
|
||||
|
||||
YieldExpression: yield * AssignmentExpression
|
||||
|
||||
1. Let exprRef be the result of evaluating AssignmentExpression.
|
||||
2. Let value be ? GetValue(exprRef).
|
||||
3. Let generatorKind be ! GetGeneratorKind().
|
||||
4. Let iterator be ? GetIterator(value, generatorKind).
|
||||
...
|
||||
|
||||
GetIterator ( obj [ , hint ] )
|
||||
|
||||
...
|
||||
3. If hint is async,
|
||||
a. Set method to ? GetMethod(obj, @@asyncIterator).
|
||||
...
|
||||
6. Let iterator be ? Call(method, obj).
|
||||
7. If Type(iterator) is not Object, throw a TypeError exception.
|
||||
...
|
||||
|
||||
---*/
|
||||
var obj = {
|
||||
get [Symbol.iterator]() {
|
||||
throw new Test262Error('it should not get Symbol.iterator');
|
||||
},
|
||||
[Symbol.asyncIterator]() {
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
|
||||
var callCount = 0;
|
||||
|
||||
var C = class { async *gen() {
|
||||
callCount += 1;
|
||||
yield* obj;
|
||||
throw new Test262Error('abrupt completion closes iter');
|
||||
|
||||
}}
|
||||
|
||||
var gen = C.prototype.gen;
|
||||
|
||||
var iter = gen();
|
||||
|
||||
iter.next().then(() => {
|
||||
throw new Test262Error('Promise incorrectly fulfilled.');
|
||||
}, v => {
|
||||
assert.sameValue(v.constructor, TypeError, "TypeError");
|
||||
|
||||
iter.next().then(({ done, value }) => {
|
||||
assert.sameValue(done, true, 'the iterator is completed');
|
||||
assert.sameValue(value, undefined, 'value is undefined');
|
||||
}).then($DONE, $DONE);
|
||||
}).catch($DONE);
|
||||
|
||||
assert.sameValue(callCount, 1);
|
|
@ -0,0 +1,76 @@
|
|||
// This file was procedurally generated from the following sources:
|
||||
// - src/async-generators/yield-star-getiter-async-returns-null-throw.case
|
||||
// - src/async-generators/default/async-class-expr-method.template
|
||||
/*---
|
||||
description: Non object returned by [Symbol.asyncIterator]() - null (Async generator method as a ClassExpression element)
|
||||
esid: prod-AsyncGeneratorMethod
|
||||
features: [Symbol.asyncIterator, async-iteration]
|
||||
flags: [generated, async]
|
||||
info: |
|
||||
ClassElement :
|
||||
MethodDefinition
|
||||
|
||||
MethodDefinition :
|
||||
AsyncGeneratorMethod
|
||||
|
||||
Async Generator Function Definitions
|
||||
|
||||
AsyncGeneratorMethod :
|
||||
async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody }
|
||||
|
||||
|
||||
YieldExpression: yield * AssignmentExpression
|
||||
|
||||
1. Let exprRef be the result of evaluating AssignmentExpression.
|
||||
2. Let value be ? GetValue(exprRef).
|
||||
3. Let generatorKind be ! GetGeneratorKind().
|
||||
4. Let iterator be ? GetIterator(value, generatorKind).
|
||||
...
|
||||
|
||||
GetIterator ( obj [ , hint ] )
|
||||
|
||||
...
|
||||
3. If hint is async,
|
||||
a. Set method to ? GetMethod(obj, @@asyncIterator).
|
||||
...
|
||||
6. Let iterator be ? Call(method, obj).
|
||||
7. If Type(iterator) is not Object, throw a TypeError exception.
|
||||
...
|
||||
|
||||
---*/
|
||||
var obj = {
|
||||
get [Symbol.iterator]() {
|
||||
throw new Test262Error('it should not get Symbol.iterator');
|
||||
},
|
||||
[Symbol.asyncIterator]() {
|
||||
return null;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
|
||||
var callCount = 0;
|
||||
|
||||
var C = class { async *gen() {
|
||||
callCount += 1;
|
||||
yield* obj;
|
||||
throw new Test262Error('abrupt completion closes iter');
|
||||
|
||||
}}
|
||||
|
||||
var gen = C.prototype.gen;
|
||||
|
||||
var iter = gen();
|
||||
|
||||
iter.next().then(() => {
|
||||
throw new Test262Error('Promise incorrectly fulfilled.');
|
||||
}, v => {
|
||||
assert.sameValue(v.constructor, TypeError, "TypeError");
|
||||
|
||||
iter.next().then(({ done, value }) => {
|
||||
assert.sameValue(done, true, 'the iterator is completed');
|
||||
assert.sameValue(value, undefined, 'value is undefined');
|
||||
}).then($DONE, $DONE);
|
||||
}).catch($DONE);
|
||||
|
||||
assert.sameValue(callCount, 1);
|
|
@ -0,0 +1,76 @@
|
|||
// This file was procedurally generated from the following sources:
|
||||
// - src/async-generators/yield-star-getiter-async-returns-number-throw.case
|
||||
// - src/async-generators/default/async-class-expr-method.template
|
||||
/*---
|
||||
description: Non object returned by [Symbol.asyncIterator]() - number (Async generator method as a ClassExpression element)
|
||||
esid: prod-AsyncGeneratorMethod
|
||||
features: [Symbol.asyncIterator, async-iteration]
|
||||
flags: [generated, async]
|
||||
info: |
|
||||
ClassElement :
|
||||
MethodDefinition
|
||||
|
||||
MethodDefinition :
|
||||
AsyncGeneratorMethod
|
||||
|
||||
Async Generator Function Definitions
|
||||
|
||||
AsyncGeneratorMethod :
|
||||
async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody }
|
||||
|
||||
|
||||
YieldExpression: yield * AssignmentExpression
|
||||
|
||||
1. Let exprRef be the result of evaluating AssignmentExpression.
|
||||
2. Let value be ? GetValue(exprRef).
|
||||
3. Let generatorKind be ! GetGeneratorKind().
|
||||
4. Let iterator be ? GetIterator(value, generatorKind).
|
||||
...
|
||||
|
||||
GetIterator ( obj [ , hint ] )
|
||||
|
||||
...
|
||||
3. If hint is async,
|
||||
a. Set method to ? GetMethod(obj, @@asyncIterator).
|
||||
...
|
||||
6. Let iterator be ? Call(method, obj).
|
||||
7. If Type(iterator) is not Object, throw a TypeError exception.
|
||||
...
|
||||
|
||||
---*/
|
||||
var obj = {
|
||||
get [Symbol.iterator]() {
|
||||
throw new Test262Error('it should not get Symbol.iterator');
|
||||
},
|
||||
[Symbol.asyncIterator]() {
|
||||
return 42;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
|
||||
var callCount = 0;
|
||||
|
||||
var C = class { async *gen() {
|
||||
callCount += 1;
|
||||
yield* obj;
|
||||
throw new Test262Error('abrupt completion closes iter');
|
||||
|
||||
}}
|
||||
|
||||
var gen = C.prototype.gen;
|
||||
|
||||
var iter = gen();
|
||||
|
||||
iter.next().then(() => {
|
||||
throw new Test262Error('Promise incorrectly fulfilled.');
|
||||
}, v => {
|
||||
assert.sameValue(v.constructor, TypeError, "TypeError");
|
||||
|
||||
iter.next().then(({ done, value }) => {
|
||||
assert.sameValue(done, true, 'the iterator is completed');
|
||||
assert.sameValue(value, undefined, 'value is undefined');
|
||||
}).then($DONE, $DONE);
|
||||
}).catch($DONE);
|
||||
|
||||
assert.sameValue(callCount, 1);
|
|
@ -0,0 +1,76 @@
|
|||
// This file was procedurally generated from the following sources:
|
||||
// - src/async-generators/yield-star-getiter-async-returns-string-throw.case
|
||||
// - src/async-generators/default/async-class-expr-method.template
|
||||
/*---
|
||||
description: Non object returned by [Symbol.asyncIterator]() - string (Async generator method as a ClassExpression element)
|
||||
esid: prod-AsyncGeneratorMethod
|
||||
features: [Symbol.asyncIterator, async-iteration]
|
||||
flags: [generated, async]
|
||||
info: |
|
||||
ClassElement :
|
||||
MethodDefinition
|
||||
|
||||
MethodDefinition :
|
||||
AsyncGeneratorMethod
|
||||
|
||||
Async Generator Function Definitions
|
||||
|
||||
AsyncGeneratorMethod :
|
||||
async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody }
|
||||
|
||||
|
||||
YieldExpression: yield * AssignmentExpression
|
||||
|
||||
1. Let exprRef be the result of evaluating AssignmentExpression.
|
||||
2. Let value be ? GetValue(exprRef).
|
||||
3. Let generatorKind be ! GetGeneratorKind().
|
||||
4. Let iterator be ? GetIterator(value, generatorKind).
|
||||
...
|
||||
|
||||
GetIterator ( obj [ , hint ] )
|
||||
|
||||
...
|
||||
3. If hint is async,
|
||||
a. Set method to ? GetMethod(obj, @@asyncIterator).
|
||||
...
|
||||
6. Let iterator be ? Call(method, obj).
|
||||
7. If Type(iterator) is not Object, throw a TypeError exception.
|
||||
...
|
||||
|
||||
---*/
|
||||
var obj = {
|
||||
get [Symbol.iterator]() {
|
||||
throw new Test262Error('it should not get Symbol.iterator');
|
||||
},
|
||||
[Symbol.asyncIterator]() {
|
||||
return '42';
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
|
||||
var callCount = 0;
|
||||
|
||||
var C = class { async *gen() {
|
||||
callCount += 1;
|
||||
yield* obj;
|
||||
throw new Test262Error('abrupt completion closes iter');
|
||||
|
||||
}}
|
||||
|
||||
var gen = C.prototype.gen;
|
||||
|
||||
var iter = gen();
|
||||
|
||||
iter.next().then(() => {
|
||||
throw new Test262Error('Promise incorrectly fulfilled.');
|
||||
}, v => {
|
||||
assert.sameValue(v.constructor, TypeError, "TypeError");
|
||||
|
||||
iter.next().then(({ done, value }) => {
|
||||
assert.sameValue(done, true, 'the iterator is completed');
|
||||
assert.sameValue(value, undefined, 'value is undefined');
|
||||
}).then($DONE, $DONE);
|
||||
}).catch($DONE);
|
||||
|
||||
assert.sameValue(callCount, 1);
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue