mirror of https://github.com/tc39/test262.git
Add cases for abrupt completions in yield* in async generator - getting iterator
Closes #873
This commit is contained in:
parent
882b3cc0d0
commit
78388c5ac2
|
@ -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);
|
|
@ -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);
|
|
@ -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);
|
|
@ -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);
|
|
@ -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);
|
|
@ -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);
|
|
@ -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);
|
|
@ -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);
|
|
@ -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);
|
|
@ -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);
|
|
@ -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);
|
|
@ -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);
|
|
@ -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);
|
|
@ -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);
|
|
@ -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);
|
|
@ -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);
|
|
@ -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);
|
|
@ -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);
|
|
@ -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);
|
|
@ -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);
|
|
@ -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);
|
|
@ -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);
|
|
@ -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);
|
|
@ -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);
|
|
@ -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);
|
|
@ -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);
|
|
@ -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);
|
|
@ -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);
|
|
@ -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);
|
Loading…
Reference in New Issue