Merge pull request #938 from leobalter/yield-star-abrupt-getiter

Add cases for abrupt completions in yield* in async generator - getIterator
This commit is contained in:
Rick Waldron 2017-04-06 11:43:29 -04:00 committed by GitHub
commit 818bb8d88f
261 changed files with 18776 additions and 0 deletions

View File

@ -0,0 +1,36 @@
// Copyright 2017 Tooru Fujisawa. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
template: default
desc: Abrupt completion while getting yield* operand
info: |
YieldExpression: yield * AssignmentExpression
1. Let exprRef be the result of evaluating AssignmentExpression.
2. Let value be ? GetValue(exprRef).
...
flags: [async]
---*/
//- setup
var obj = {};
var abrupt = function() {
throw obj;
};
//- body
yield* abrupt();
throw new Test262Error('abrupt completion closes iter');
//- assertions
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);

View File

@ -0,0 +1,59 @@
// Copyright 2017 Tooru Fujisawa. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
template: default
desc: Abrupt completion while getting [Symbol.asyncIterator]
info: |
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).
...
features: [Symbol.asyncIterator]
flags: [async]
---*/
//- setup
var reason = {};
var obj = {
get [Symbol.iterator]() {
throw new Test262Error('it should not get Symbol.iterator');
},
get [Symbol.asyncIterator]() {
throw reason;
}
};
//- body
yield* obj;
throw new Test262Error('abrupt completion closes iter');
//- assertions
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);

View File

@ -0,0 +1,58 @@
// Copyright 2017 Tooru Fujisawa. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
template: default
desc: Throws a TypeError on a non-callable [Symbol.asyncIterator] (boolean)
info: |
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.
...
features: [Symbol.asyncIterator]
flags: [async]
---*/
//- setup
var obj = {
get [Symbol.iterator]() {
throw new Test262Error('it should not get Symbol.iterator');
},
[Symbol.asyncIterator]: false
};
//- body
yield* obj;
throw new Test262Error('abrupt completion closes iter');
//- assertions
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);

View File

@ -0,0 +1,58 @@
// Copyright 2017 Tooru Fujisawa. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
template: default
desc: Throws a TypeError on a non-callable [Symbol.asyncIterator] (number)
info: |
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.
...
features: [Symbol.asyncIterator]
flags: [async]
---*/
//- setup
var obj = {
get [Symbol.iterator]() {
throw new Test262Error('it should not get Symbol.iterator');
},
[Symbol.asyncIterator]: 0
};
//- body
yield* obj;
throw new Test262Error('abrupt completion closes iter');
//- assertions
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);

View File

@ -0,0 +1,58 @@
// Copyright 2017 Tooru Fujisawa. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
template: default
desc: Throws a TypeError on a non-callable [Symbol.asyncIterator] (object)
info: |
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.
...
features: [Symbol.asyncIterator]
flags: [async]
---*/
//- setup
var obj = {
get [Symbol.iterator]() {
throw new Test262Error('it should not get Symbol.iterator');
},
[Symbol.asyncIterator]: {}
};
//- body
yield* obj;
throw new Test262Error('abrupt completion closes iter');
//- assertions
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);

View File

@ -0,0 +1,58 @@
// Copyright 2017 Tooru Fujisawa. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
template: default
desc: Throws a TypeError on a non-callable [Symbol.asyncIterator] (string)
info: |
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.
...
features: [Symbol.asyncIterator]
flags: [async]
---*/
//- setup
var obj = {
get [Symbol.iterator]() {
throw new Test262Error('it should not get Symbol.iterator');
},
[Symbol.asyncIterator]: ''
};
//- body
yield* obj;
throw new Test262Error('abrupt completion closes iter');
//- assertions
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);

View File

@ -0,0 +1,58 @@
// Copyright 2017 Tooru Fujisawa. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
template: default
desc: Throws a TypeError on a non-callable [Symbol.asyncIterator] (symbol)
info: |
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.
...
features: [Symbol.asyncIterator]
flags: [async]
---*/
//- setup
var obj = {
get [Symbol.iterator]() {
throw new Test262Error('it should not get Symbol.iterator');
},
[Symbol.asyncIterator]: Symbol.asyncIterator
};
//- body
yield* obj;
throw new Test262Error('abrupt completion closes iter');
//- assertions
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);

View File

@ -0,0 +1,64 @@
// Copyright 2017 Tooru Fujisawa. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
template: default
desc: Abrupt completion while getting @@iterator after null @@asyncIterator
info: |
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).
...
features: [Symbol.asyncIterator]
flags: [async]
---*/
//- setup
var calls = 0;
var reason = {};
var obj = {
get [Symbol.iterator]() {
throw reason;
},
get [Symbol.asyncIterator]() {
calls += 1;
return null;
}
};
//- body
yield* obj;
throw new Test262Error('abrupt completion closes iter');
//- assertions
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);

View File

@ -0,0 +1,55 @@
// Copyright 2017 Tooru Fujisawa. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
template: default
desc: Abrupt completion while calling [Symbol.asyncIterator]
info: |
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).
...
features: [Symbol.asyncIterator]
flags: [async]
---*/
//- setup
var reason = {};
var obj = {
get [Symbol.iterator]() {
throw new Test262Error('it should not get Symbol.iterator');
},
[Symbol.asyncIterator]() {
throw reason;
}
};
//- body
yield* obj;
throw new Test262Error('abrupt completion closes iter');
//- assertions
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);

View File

@ -0,0 +1,54 @@
// Copyright 2017 Tooru Fujisawa. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
template: default
desc: Non object returned by [Symbol.asyncIterator]() - boolean
info: |
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.
...
features: [Symbol.asyncIterator]
flags: [async]
---*/
//- setup
var obj = {
get [Symbol.iterator]() {
throw new Test262Error('it should not get Symbol.iterator');
},
[Symbol.asyncIterator]() {
return true;
}
};
//- body
yield* obj;
throw new Test262Error('abrupt completion closes iter');
//- assertions
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);

View File

@ -0,0 +1,54 @@
// Copyright 2017 Tooru Fujisawa. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
template: default
desc: Non object returned by [Symbol.asyncIterator]() - null
info: |
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.
...
features: [Symbol.asyncIterator]
flags: [async]
---*/
//- setup
var obj = {
get [Symbol.iterator]() {
throw new Test262Error('it should not get Symbol.iterator');
},
[Symbol.asyncIterator]() {
return null;
}
};
//- body
yield* obj;
throw new Test262Error('abrupt completion closes iter');
//- assertions
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);

View File

@ -0,0 +1,54 @@
// Copyright 2017 Tooru Fujisawa. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
template: default
desc: Non object returned by [Symbol.asyncIterator]() - number
info: |
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.
...
features: [Symbol.asyncIterator]
flags: [async]
---*/
//- setup
var obj = {
get [Symbol.iterator]() {
throw new Test262Error('it should not get Symbol.iterator');
},
[Symbol.asyncIterator]() {
return 42;
}
};
//- body
yield* obj;
throw new Test262Error('abrupt completion closes iter');
//- assertions
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);

View File

@ -0,0 +1,54 @@
// Copyright 2017 Tooru Fujisawa. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
template: default
desc: Non object returned by [Symbol.asyncIterator]() - string
info: |
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.
...
features: [Symbol.asyncIterator]
flags: [async]
---*/
//- setup
var obj = {
get [Symbol.iterator]() {
throw new Test262Error('it should not get Symbol.iterator');
},
[Symbol.asyncIterator]() {
return '42';
}
};
//- body
yield* obj;
throw new Test262Error('abrupt completion closes iter');
//- assertions
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);

View File

@ -0,0 +1,54 @@
// Copyright 2017 Tooru Fujisawa. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
template: default
desc: Non object returned by [Symbol.asyncIterator]() - symbol
info: |
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.
...
features: [Symbol.asyncIterator]
flags: [async]
---*/
//- setup
var obj = {
get [Symbol.iterator]() {
throw new Test262Error('it should not get Symbol.iterator');
},
[Symbol.asyncIterator]() {
return Symbol.asyncIterator;
}
};
//- body
yield* obj;
throw new Test262Error('abrupt completion closes iter');
//- assertions
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);

View File

@ -0,0 +1,54 @@
// Copyright 2017 Tooru Fujisawa. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
template: default
desc: Non object returned by [Symbol.asyncIterator]() - undefined
info: |
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.
...
features: [Symbol.asyncIterator]
flags: [async]
---*/
//- setup
var obj = {
get [Symbol.iterator]() {
throw new Test262Error('it should not get Symbol.iterator');
},
[Symbol.asyncIterator]() {
return undefined;
}
};
//- body
yield* obj;
throw new Test262Error('abrupt completion closes iter');
//- assertions
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);

View File

@ -0,0 +1,64 @@
// Copyright 2017 Tooru Fujisawa. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
template: default
desc: Abrupt completion while getting @@iterator after undefined @@asyncIterator
info: |
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).
...
features: [Symbol.asyncIterator]
flags: [async]
---*/
//- setup
var calls = 0;
var reason = {};
var obj = {
get [Symbol.iterator]() {
throw reason;
},
get [Symbol.asyncIterator]() {
calls += 1;
return undefined;
}
};
//- body
yield* obj;
throw new Test262Error('abrupt completion closes iter');
//- assertions
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);

View File

@ -0,0 +1,58 @@
// Copyright 2017 Tooru Fujisawa. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
template: default
desc: Abrupt completion while getting [Symbol.iterator]
info: |
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).
...
features: [Symbol.asyncIterator]
flags: [async]
---*/
//- setup
var reason = {};
var obj = {
get [Symbol.iterator]() {
throw reason;
}
};
//- body
yield* obj;
throw new Test262Error('abrupt completion closes iter');
//- assertions
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);

View File

@ -0,0 +1,56 @@
// Copyright 2017 Tooru Fujisawa. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
template: default
desc: Throws a TypeError on a non-callable [Symbol.iterator] (boolean)
info: |
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.
...
flags: [async]
---*/
//- setup
var obj = {
[Symbol.iterator]: false
};
//- body
yield* obj;
throw new Test262Error('abrupt completion closes iter');
//- assertions
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);

View File

@ -0,0 +1,56 @@
// Copyright 2017 Tooru Fujisawa. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
template: default
desc: Throws a TypeError on a non-callable [Symbol.iterator] (number)
info: |
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.
...
flags: [async]
---*/
//- setup
var obj = {
[Symbol.iterator]: 0
};
//- body
yield* obj;
throw new Test262Error('abrupt completion closes iter');
//- assertions
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);

View File

@ -0,0 +1,56 @@
// Copyright 2017 Tooru Fujisawa. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
template: default
desc: Throws a TypeError on a non-callable [Symbol.iterator] (object)
info: |
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.
...
flags: [async]
---*/
//- setup
var obj = {
[Symbol.iterator]: {}
};
//- body
yield* obj;
throw new Test262Error('abrupt completion closes iter');
//- assertions
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);

View File

@ -0,0 +1,56 @@
// Copyright 2017 Tooru Fujisawa. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
template: default
desc: Throws a TypeError on a non-callable [Symbol.iterator] (string)
info: |
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.
...
flags: [async]
---*/
//- setup
var obj = {
[Symbol.iterator]: ''
};
//- body
yield* obj;
throw new Test262Error('abrupt completion closes iter');
//- assertions
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);

View File

@ -0,0 +1,57 @@
// Copyright 2017 Tooru Fujisawa. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
template: default
desc: Throws a TypeError on a non-callable [Symbol.iterator] (symbol)
info: |
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.
...
features: [Symbol.asyncIterator]
flags: [async]
---*/
//- setup
var obj = {
[Symbol.iterator]: Symbol.iterator
};
//- body
yield* obj;
throw new Test262Error('abrupt completion closes iter');
//- assertions
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);

View File

@ -0,0 +1,51 @@
// Copyright 2017 Tooru Fujisawa. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
template: default
desc: Abrupt completion while calling [Symbol.iterator]
info: |
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).
...
features: [Symbol.asyncIterator]
flags: [async]
---*/
//- setup
var reason = {};
var obj = {
[Symbol.iterator]() {
throw reason;
}
};
//- body
yield* obj;
throw new Test262Error('abrupt completion closes iter');
//- assertions
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);

View File

@ -0,0 +1,55 @@
// Copyright 2017 Tooru Fujisawa. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
template: default
desc: Non object returned by [Symbol.iterator]() - boolean
info: |
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.
...
flags: [async]
---*/
//- setup
var obj = {
[Symbol.iterator]() {
return true;
}
};
//- body
yield* obj;
throw new Test262Error('abrupt completion closes iter');
//- assertions
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);

View File

@ -0,0 +1,55 @@
// Copyright 2017 Tooru Fujisawa. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
template: default
desc: Non object returned by [Symbol.iterator]() - null
info: |
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.
...
flags: [async]
---*/
//- setup
var obj = {
[Symbol.iterator]() {
return null;
}
};
//- body
yield* obj;
throw new Test262Error('abrupt completion closes iter');
//- assertions
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);

View File

@ -0,0 +1,55 @@
// Copyright 2017 Tooru Fujisawa. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
template: default
desc: Non object returned by [Symbol.iterator]() - number
info: |
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.
...
flags: [async]
---*/
//- setup
var obj = {
[Symbol.iterator]() {
return 0;
}
};
//- body
yield* obj;
throw new Test262Error('abrupt completion closes iter');
//- assertions
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);

View File

@ -0,0 +1,55 @@
// Copyright 2017 Tooru Fujisawa. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
template: default
desc: Non object returned by [Symbol.iterator]() - string
info: |
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.
...
flags: [async]
---*/
//- setup
var obj = {
[Symbol.iterator]() {
return '';
}
};
//- body
yield* obj;
throw new Test262Error('abrupt completion closes iter');
//- assertions
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);

View File

@ -0,0 +1,55 @@
// Copyright 2017 Tooru Fujisawa. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
template: default
desc: Non object returned by [Symbol.iterator]() - symbol
info: |
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.
...
flags: [async]
---*/
//- setup
var obj = {
[Symbol.iterator]() {
return Symbol.iterator;
}
};
//- body
yield* obj;
throw new Test262Error('abrupt completion closes iter');
//- assertions
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);

View File

@ -0,0 +1,55 @@
// Copyright 2017 Tooru Fujisawa. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
template: default
desc: Non object returned by [Symbol.iterator]() - undefined
info: |
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.
...
flags: [async]
---*/
//- setup
var obj = {
[Symbol.iterator]() {
return undefined;
}
};
//- body
yield* obj;
throw new Test262Error('abrupt completion closes iter');
//- assertions
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);

View File

@ -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);

View File

@ -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);

View File

@ -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);

View File

@ -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);

View File

@ -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);

View File

@ -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);

View File

@ -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);

View File

@ -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);

View File

@ -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);

View File

@ -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);

View File

@ -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);

View File

@ -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);

View File

@ -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);

View File

@ -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);

View File

@ -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);

View File

@ -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);

View File

@ -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);

View File

@ -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);

View File

@ -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);

View File

@ -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);

View File

@ -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);

View File

@ -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);

View File

@ -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);

View File

@ -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);

View File

@ -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);

View File

@ -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);

View File

@ -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);

View File

@ -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);

View File

@ -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);

View File

@ -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);

View File

@ -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);

View File

@ -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);

View File

@ -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);

View File

@ -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);

View File

@ -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);

View File

@ -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);

View File

@ -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);

View File

@ -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);

View File

@ -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);

View File

@ -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);

View File

@ -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);

View File

@ -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);

View File

@ -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);

View File

@ -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);

View File

@ -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);

View File

@ -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);

View File

@ -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);

View File

@ -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);

View File

@ -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);

View File

@ -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);

View File

@ -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);

View File

@ -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);

View File

@ -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);

View File

@ -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);

View File

@ -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);

View File

@ -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);

View File

@ -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);

View File

@ -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);

View File

@ -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);

View File

@ -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);

View File

@ -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);

View File

@ -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);

View File

@ -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);

View File

@ -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);

View File

@ -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);

View File

@ -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);

View File

@ -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);

View File

@ -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);

View File

@ -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);

View File

@ -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);

View File

@ -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);

Some files were not shown because too many files have changed in this diff Show More