mirror of
https://github.com/tc39/test262.git
synced 2025-07-23 05:55:36 +02:00
Promise.all/race with non-iterable or invalid return from Symbol.iterator. (#1496)
Fixes gh-1490
This commit is contained in:
parent
50dd1fbd58
commit
03f0f56961
33
test/built-ins/Promise/all/iter-arg-is-false-reject.js
Normal file
33
test/built-ins/Promise/all/iter-arg-is-false-reject.js
Normal file
@ -0,0 +1,33 @@
|
||||
// Copyright (C) 2018 Rick Waldron. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
esid: sec-promise.all
|
||||
description: >
|
||||
Reject when argument is `false`
|
||||
info: |
|
||||
...
|
||||
Let iteratorRecord be GetIterator(iterable).
|
||||
IfAbruptRejectPromise(iteratorRecord, promiseCapability).
|
||||
...
|
||||
|
||||
#sec-getiterator
|
||||
GetIterator ( obj [ , hint [ , method ] ] )
|
||||
|
||||
...
|
||||
Let iterator be ? Call(method, obj).
|
||||
If Type(iterator) is not Object, throw a TypeError exception.
|
||||
...
|
||||
features: [Symbol.iterator]
|
||||
flags: [async]
|
||||
---*/
|
||||
|
||||
try {
|
||||
Promise.all(false).then(function() {
|
||||
$DONE('The promise should be rejected, but was resolved');
|
||||
}, function(error) {
|
||||
assert(error instanceof TypeError);
|
||||
}).then($DONE, $DONE);
|
||||
} catch (error) {
|
||||
$DONE(`The promise should be rejected, but threw an exception: ${error.message}`);
|
||||
}
|
33
test/built-ins/Promise/all/iter-arg-is-null-reject.js
Normal file
33
test/built-ins/Promise/all/iter-arg-is-null-reject.js
Normal file
@ -0,0 +1,33 @@
|
||||
// Copyright (C) 2018 Rick Waldron. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
esid: sec-promise.all
|
||||
description: >
|
||||
Reject when argument is `null`
|
||||
info: |
|
||||
...
|
||||
Let iteratorRecord be GetIterator(iterable).
|
||||
IfAbruptRejectPromise(iteratorRecord, promiseCapability).
|
||||
...
|
||||
|
||||
#sec-getiterator
|
||||
GetIterator ( obj [ , hint [ , method ] ] )
|
||||
|
||||
...
|
||||
Let iterator be ? Call(method, obj).
|
||||
If Type(iterator) is not Object, throw a TypeError exception.
|
||||
...
|
||||
features: [Symbol.iterator]
|
||||
flags: [async]
|
||||
---*/
|
||||
|
||||
try {
|
||||
Promise.all(null).then(function() {
|
||||
$DONE('The promise should be rejected, but was resolved');
|
||||
}, function(error) {
|
||||
assert(error instanceof TypeError);
|
||||
}).then($DONE, $DONE);
|
||||
} catch (error) {
|
||||
$DONE(`The promise should be rejected, but threw an exception: ${error.message}`);
|
||||
}
|
33
test/built-ins/Promise/all/iter-arg-is-number-reject.js
Normal file
33
test/built-ins/Promise/all/iter-arg-is-number-reject.js
Normal file
@ -0,0 +1,33 @@
|
||||
// Copyright (C) 2018 Rick Waldron. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
esid: sec-promise.all
|
||||
description: >
|
||||
Reject when argument is a number
|
||||
info: |
|
||||
...
|
||||
Let iteratorRecord be GetIterator(iterable).
|
||||
IfAbruptRejectPromise(iteratorRecord, promiseCapability).
|
||||
...
|
||||
|
||||
#sec-getiterator
|
||||
GetIterator ( obj [ , hint [ , method ] ] )
|
||||
|
||||
...
|
||||
Let iterator be ? Call(method, obj).
|
||||
If Type(iterator) is not Object, throw a TypeError exception.
|
||||
...
|
||||
features: [Symbol.iterator]
|
||||
flags: [async]
|
||||
---*/
|
||||
|
||||
try {
|
||||
Promise.all(1).then(function() {
|
||||
$DONE('The promise should be rejected, but was resolved');
|
||||
}, function(error) {
|
||||
assert(error instanceof TypeError);
|
||||
}).then($DONE, $DONE);
|
||||
} catch (error) {
|
||||
$DONE(`The promise should be rejected, but threw an exception: ${error.message}`);
|
||||
}
|
33
test/built-ins/Promise/all/iter-arg-is-string-resolve.js
Normal file
33
test/built-ins/Promise/all/iter-arg-is-string-resolve.js
Normal file
@ -0,0 +1,33 @@
|
||||
// Copyright (C) 2018 Rick Waldron. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
esid: sec-promise.all
|
||||
description: >
|
||||
Reject when argument is a string
|
||||
info: |
|
||||
...
|
||||
Let iteratorRecord be GetIterator(iterable).
|
||||
IfAbruptRejectPromise(iteratorRecord, promiseCapability).
|
||||
...
|
||||
|
||||
#sec-getiterator
|
||||
GetIterator ( obj [ , hint [ , method ] ] )
|
||||
|
||||
...
|
||||
Let iterator be ? Call(method, obj).
|
||||
If Type(iterator) is not Object, throw a TypeError exception.
|
||||
...
|
||||
features: [Symbol.iterator]
|
||||
flags: [async]
|
||||
---*/
|
||||
|
||||
try {
|
||||
Promise.all("").then(function() {
|
||||
$DONE();
|
||||
}, function() {
|
||||
$DONE('The promise should be resolved, but was rejected');
|
||||
}).then($DONE, $DONE);
|
||||
} catch (error) {
|
||||
$DONE(`The promise should be rejected, but threw an exception: ${error.message}`);
|
||||
}
|
33
test/built-ins/Promise/all/iter-arg-is-symbol-reject.js
Normal file
33
test/built-ins/Promise/all/iter-arg-is-symbol-reject.js
Normal file
@ -0,0 +1,33 @@
|
||||
// Copyright (C) 2018 Rick Waldron. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
esid: sec-promise.all
|
||||
description: >
|
||||
Reject when argument is a symbol
|
||||
info: |
|
||||
...
|
||||
Let iteratorRecord be GetIterator(iterable).
|
||||
IfAbruptRejectPromise(iteratorRecord, promiseCapability).
|
||||
...
|
||||
|
||||
#sec-getiterator
|
||||
GetIterator ( obj [ , hint [ , method ] ] )
|
||||
|
||||
...
|
||||
Let iterator be ? Call(method, obj).
|
||||
If Type(iterator) is not Object, throw a TypeError exception.
|
||||
...
|
||||
features: [Symbol.iterator]
|
||||
flags: [async]
|
||||
---*/
|
||||
|
||||
try {
|
||||
Promise.all(Symbol()).then(function() {
|
||||
$DONE('The promise should be rejected, but was resolved');
|
||||
}, function(error) {
|
||||
assert(error instanceof TypeError);
|
||||
}).then($DONE, $DONE);
|
||||
} catch (error) {
|
||||
$DONE(`The promise should be rejected, but threw an exception: ${error.message}`);
|
||||
}
|
33
test/built-ins/Promise/all/iter-arg-is-true-reject.js
Normal file
33
test/built-ins/Promise/all/iter-arg-is-true-reject.js
Normal file
@ -0,0 +1,33 @@
|
||||
// Copyright (C) 2018 Rick Waldron. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
esid: sec-promise.all
|
||||
description: >
|
||||
Reject when argument is `true`
|
||||
info: |
|
||||
...
|
||||
Let iteratorRecord be GetIterator(iterable).
|
||||
IfAbruptRejectPromise(iteratorRecord, promiseCapability).
|
||||
...
|
||||
|
||||
#sec-getiterator
|
||||
GetIterator ( obj [ , hint [ , method ] ] )
|
||||
|
||||
...
|
||||
Let iterator be ? Call(method, obj).
|
||||
If Type(iterator) is not Object, throw a TypeError exception.
|
||||
...
|
||||
features: [Symbol.iterator]
|
||||
flags: [async]
|
||||
---*/
|
||||
|
||||
try {
|
||||
Promise.all(true).then(function() {
|
||||
$DONE('The promise should be rejected, but was resolved');
|
||||
}, function(error) {
|
||||
assert(error instanceof TypeError);
|
||||
}).then($DONE, $DONE);
|
||||
} catch (error) {
|
||||
$DONE(`The promise should be rejected, but threw an exception: ${error.message}`);
|
||||
}
|
33
test/built-ins/Promise/all/iter-arg-is-undefined-reject.js
Normal file
33
test/built-ins/Promise/all/iter-arg-is-undefined-reject.js
Normal file
@ -0,0 +1,33 @@
|
||||
// Copyright (C) 2018 Rick Waldron. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
esid: sec-promise.all
|
||||
description: >
|
||||
Reject when argument is `undefined`
|
||||
info: |
|
||||
...
|
||||
Let iteratorRecord be GetIterator(iterable).
|
||||
IfAbruptRejectPromise(iteratorRecord, promiseCapability).
|
||||
...
|
||||
|
||||
#sec-getiterator
|
||||
GetIterator ( obj [ , hint [ , method ] ] )
|
||||
|
||||
...
|
||||
Let iterator be ? Call(method, obj).
|
||||
If Type(iterator) is not Object, throw a TypeError exception.
|
||||
...
|
||||
features: [Symbol.iterator]
|
||||
flags: [async]
|
||||
---*/
|
||||
|
||||
try {
|
||||
Promise.all(undefined).then(function() {
|
||||
$DONE('The promise should be rejected, but was resolved');
|
||||
}, function(error) {
|
||||
assert(error instanceof TypeError);
|
||||
}).then($DONE, $DONE);
|
||||
} catch (error) {
|
||||
$DONE(`The promise should be rejected, but threw an exception: ${error.message}`);
|
||||
}
|
35
test/built-ins/Promise/all/iter-assigned-false-reject.js
Normal file
35
test/built-ins/Promise/all/iter-assigned-false-reject.js
Normal file
@ -0,0 +1,35 @@
|
||||
// Copyright (C) 2018 Rick Waldron. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
esid: sec-promise.all
|
||||
description: >
|
||||
Reject when argument's Symbol.iterator property has the value false
|
||||
info: |
|
||||
...
|
||||
Let iteratorRecord be GetIterator(iterable).
|
||||
IfAbruptRejectPromise(iteratorRecord, promiseCapability).
|
||||
...
|
||||
|
||||
#sec-getiterator
|
||||
GetIterator ( obj [ , hint [ , method ] ] )
|
||||
|
||||
...
|
||||
Let iterator be ? Call(method, obj).
|
||||
If Type(iterator) is not Object, throw a TypeError exception.
|
||||
...
|
||||
features: [Symbol.iterator]
|
||||
flags: [async]
|
||||
---*/
|
||||
|
||||
try {
|
||||
Promise.all({
|
||||
[Symbol.iterator]: false
|
||||
}).then(function() {
|
||||
$DONE('The promise should be rejected, but was resolved');
|
||||
}, function(error) {
|
||||
assert(error instanceof TypeError);
|
||||
}).then($DONE, $DONE);
|
||||
} catch (error) {
|
||||
$DONE(`The promise should be rejected, but threw an exception: ${error.message}`);
|
||||
}
|
35
test/built-ins/Promise/all/iter-assigned-null-reject.js
Normal file
35
test/built-ins/Promise/all/iter-assigned-null-reject.js
Normal file
@ -0,0 +1,35 @@
|
||||
// Copyright (C) 2018 Rick Waldron. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
esid: sec-promise.all
|
||||
description: >
|
||||
Reject when argument's Symbol.iterator property has the value null
|
||||
info: |
|
||||
...
|
||||
Let iteratorRecord be GetIterator(iterable).
|
||||
IfAbruptRejectPromise(iteratorRecord, promiseCapability).
|
||||
...
|
||||
|
||||
#sec-getiterator
|
||||
GetIterator ( obj [ , hint [ , method ] ] )
|
||||
|
||||
...
|
||||
Let iterator be ? Call(method, obj).
|
||||
If Type(iterator) is not Object, throw a TypeError exception.
|
||||
...
|
||||
features: [Symbol.iterator]
|
||||
flags: [async]
|
||||
---*/
|
||||
|
||||
try {
|
||||
Promise.all({
|
||||
[Symbol.iterator]: null
|
||||
}).then(function() {
|
||||
$DONE('The promise should be rejected, but was resolved');
|
||||
}, function(error) {
|
||||
assert(error instanceof TypeError);
|
||||
}).then($DONE, $DONE);
|
||||
} catch (error) {
|
||||
$DONE(`The promise should be rejected, but threw an exception: ${error.message}`);
|
||||
}
|
35
test/built-ins/Promise/all/iter-assigned-number-reject.js
Normal file
35
test/built-ins/Promise/all/iter-assigned-number-reject.js
Normal file
@ -0,0 +1,35 @@
|
||||
// Copyright (C) 2018 Rick Waldron. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
esid: sec-promise.all
|
||||
description: >
|
||||
Reject when argument's Symbol.iterator property has the value 1
|
||||
info: |
|
||||
...
|
||||
Let iteratorRecord be GetIterator(iterable).
|
||||
IfAbruptRejectPromise(iteratorRecord, promiseCapability).
|
||||
...
|
||||
|
||||
#sec-getiterator
|
||||
GetIterator ( obj [ , hint [ , method ] ] )
|
||||
|
||||
...
|
||||
Let iterator be ? Call(method, obj).
|
||||
If Type(iterator) is not Object, throw a TypeError exception.
|
||||
...
|
||||
features: [Symbol.iterator]
|
||||
flags: [async]
|
||||
---*/
|
||||
|
||||
try {
|
||||
Promise.all({
|
||||
[Symbol.iterator]: 1
|
||||
}).then(function() {
|
||||
$DONE('The promise should be rejected, but was resolved');
|
||||
}, function(error) {
|
||||
assert(error instanceof TypeError);
|
||||
}).then($DONE, $DONE);
|
||||
} catch (error) {
|
||||
$DONE(`The promise should be rejected, but threw an exception: ${error.message}`);
|
||||
}
|
35
test/built-ins/Promise/all/iter-assigned-string-reject.js
Normal file
35
test/built-ins/Promise/all/iter-assigned-string-reject.js
Normal file
@ -0,0 +1,35 @@
|
||||
// Copyright (C) 2018 Rick Waldron. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
esid: sec-promise.all
|
||||
description: >
|
||||
Reject when argument's Symbol.iterator property has the value ""
|
||||
info: |
|
||||
...
|
||||
Let iteratorRecord be GetIterator(iterable).
|
||||
IfAbruptRejectPromise(iteratorRecord, promiseCapability).
|
||||
...
|
||||
|
||||
#sec-getiterator
|
||||
GetIterator ( obj [ , hint [ , method ] ] )
|
||||
|
||||
...
|
||||
Let iterator be ? Call(method, obj).
|
||||
If Type(iterator) is not Object, throw a TypeError exception.
|
||||
...
|
||||
features: [Symbol.iterator]
|
||||
flags: [async]
|
||||
---*/
|
||||
|
||||
try {
|
||||
Promise.all({
|
||||
[Symbol.iterator]: ""
|
||||
}).then(function() {
|
||||
$DONE('The promise should be rejected, but was resolved');
|
||||
}, function(error) {
|
||||
assert(error instanceof TypeError);
|
||||
}).then($DONE, $DONE);
|
||||
} catch (error) {
|
||||
$DONE(`The promise should be rejected, but threw an exception: ${error.message}`);
|
||||
}
|
35
test/built-ins/Promise/all/iter-assigned-symbol-reject.js
Normal file
35
test/built-ins/Promise/all/iter-assigned-symbol-reject.js
Normal file
@ -0,0 +1,35 @@
|
||||
// Copyright (C) 2018 Rick Waldron. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
esid: sec-promise.all
|
||||
description: >
|
||||
Reject when argument's Symbol.iterator property has the value Symbol()
|
||||
info: |
|
||||
...
|
||||
Let iteratorRecord be GetIterator(iterable).
|
||||
IfAbruptRejectPromise(iteratorRecord, promiseCapability).
|
||||
...
|
||||
|
||||
#sec-getiterator
|
||||
GetIterator ( obj [ , hint [ , method ] ] )
|
||||
|
||||
...
|
||||
Let iterator be ? Call(method, obj).
|
||||
If Type(iterator) is not Object, throw a TypeError exception.
|
||||
...
|
||||
features: [Symbol.iterator]
|
||||
flags: [async]
|
||||
---*/
|
||||
|
||||
try {
|
||||
Promise.all({
|
||||
[Symbol.iterator]: Symbol()
|
||||
}).then(function() {
|
||||
$DONE('The promise should be rejected, but was resolved');
|
||||
}, function(error) {
|
||||
assert(error instanceof TypeError);
|
||||
}).then($DONE, $DONE);
|
||||
} catch (error) {
|
||||
$DONE(`The promise should be rejected, but threw an exception: ${error.message}`);
|
||||
}
|
35
test/built-ins/Promise/all/iter-assigned-true-reject.js
Normal file
35
test/built-ins/Promise/all/iter-assigned-true-reject.js
Normal file
@ -0,0 +1,35 @@
|
||||
// Copyright (C) 2018 Rick Waldron. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
esid: sec-promise.all
|
||||
description: >
|
||||
Reject when argument's Symbol.iterator property has the value true
|
||||
info: |
|
||||
...
|
||||
Let iteratorRecord be GetIterator(iterable).
|
||||
IfAbruptRejectPromise(iteratorRecord, promiseCapability).
|
||||
...
|
||||
|
||||
#sec-getiterator
|
||||
GetIterator ( obj [ , hint [ , method ] ] )
|
||||
|
||||
...
|
||||
Let iterator be ? Call(method, obj).
|
||||
If Type(iterator) is not Object, throw a TypeError exception.
|
||||
...
|
||||
features: [Symbol.iterator]
|
||||
flags: [async]
|
||||
---*/
|
||||
|
||||
try {
|
||||
Promise.all({
|
||||
[Symbol.iterator]: true
|
||||
}).then(function() {
|
||||
$DONE('The promise should be rejected, but was resolved');
|
||||
}, function(error) {
|
||||
assert(error instanceof TypeError);
|
||||
}).then($DONE, $DONE);
|
||||
} catch (error) {
|
||||
$DONE(`The promise should be rejected, but threw an exception: ${error.message}`);
|
||||
}
|
35
test/built-ins/Promise/all/iter-assigned-undefined-reject.js
Normal file
35
test/built-ins/Promise/all/iter-assigned-undefined-reject.js
Normal file
@ -0,0 +1,35 @@
|
||||
// Copyright (C) 2018 Rick Waldron. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
esid: sec-promise.all
|
||||
description: >
|
||||
Reject when argument's Symbol.iterator property has the value undefined
|
||||
info: |
|
||||
...
|
||||
Let iteratorRecord be GetIterator(iterable).
|
||||
IfAbruptRejectPromise(iteratorRecord, promiseCapability).
|
||||
...
|
||||
|
||||
#sec-getiterator
|
||||
GetIterator ( obj [ , hint [ , method ] ] )
|
||||
|
||||
...
|
||||
Let iterator be ? Call(method, obj).
|
||||
If Type(iterator) is not Object, throw a TypeError exception.
|
||||
...
|
||||
features: [Symbol.iterator]
|
||||
flags: [async]
|
||||
---*/
|
||||
|
||||
try {
|
||||
Promise.all({
|
||||
[Symbol.iterator]: undefined
|
||||
}).then(function() {
|
||||
$DONE('The promise should be rejected, but was resolved');
|
||||
}, function(error) {
|
||||
assert(error instanceof TypeError);
|
||||
}).then($DONE, $DONE);
|
||||
} catch (error) {
|
||||
$DONE(`The promise should be rejected, but threw an exception: ${error.message}`);
|
||||
}
|
@ -48,7 +48,7 @@ iterNextValThrows[Symbol.iterator] = function() {
|
||||
};
|
||||
|
||||
Promise.all(iterNextValThrows).then(function() {
|
||||
$ERROR('The promise should be rejected.');
|
||||
$DONE('The promise should be rejected.');
|
||||
}, function(reason) {
|
||||
assert.sameValue(reason, error);
|
||||
}).then($DONE, $DONE);
|
||||
|
37
test/built-ins/Promise/all/iter-returns-false-reject.js
Normal file
37
test/built-ins/Promise/all/iter-returns-false-reject.js
Normal file
@ -0,0 +1,37 @@
|
||||
// Copyright (C) 2018 Rick Waldron. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
esid: sec-promise.all
|
||||
description: >
|
||||
Reject when argument's Symbol.iterator returns false
|
||||
info: |
|
||||
...
|
||||
Let iteratorRecord be GetIterator(iterable).
|
||||
IfAbruptRejectPromise(iteratorRecord, promiseCapability).
|
||||
...
|
||||
|
||||
#sec-getiterator
|
||||
GetIterator ( obj [ , hint [ , method ] ] )
|
||||
|
||||
...
|
||||
Let iterator be ? Call(method, obj).
|
||||
If Type(iterator) is not Object, throw a TypeError exception.
|
||||
...
|
||||
features: [Symbol.iterator]
|
||||
flags: [async]
|
||||
---*/
|
||||
|
||||
try {
|
||||
Promise.all({
|
||||
[Symbol.iterator]() {
|
||||
return false;
|
||||
}
|
||||
}).then(function() {
|
||||
$DONE('The promise should be rejected, but was resolved');
|
||||
}, function(error) {
|
||||
assert(error instanceof TypeError);
|
||||
}).then($DONE, $DONE);
|
||||
} catch (error) {
|
||||
$DONE(`The promise should be rejected, but threw an exception: ${error.message}`);
|
||||
}
|
37
test/built-ins/Promise/all/iter-returns-null-reject.js
Normal file
37
test/built-ins/Promise/all/iter-returns-null-reject.js
Normal file
@ -0,0 +1,37 @@
|
||||
// Copyright (C) 2018 Rick Waldron. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
esid: sec-promise.all
|
||||
description: >
|
||||
Reject when argument's Symbol.iterator returns null
|
||||
info: |
|
||||
...
|
||||
Let iteratorRecord be GetIterator(iterable).
|
||||
IfAbruptRejectPromise(iteratorRecord, promiseCapability).
|
||||
...
|
||||
|
||||
#sec-getiterator
|
||||
GetIterator ( obj [ , hint [ , method ] ] )
|
||||
|
||||
...
|
||||
Let iterator be ? Call(method, obj).
|
||||
If Type(iterator) is not Object, throw a TypeError exception.
|
||||
...
|
||||
features: [Symbol.iterator]
|
||||
flags: [async]
|
||||
---*/
|
||||
|
||||
try {
|
||||
Promise.all({
|
||||
[Symbol.iterator]() {
|
||||
return null;
|
||||
}
|
||||
}).then(function() {
|
||||
$DONE('The promise should be rejected, but was resolved');
|
||||
}, function(error) {
|
||||
assert(error instanceof TypeError);
|
||||
}).then($DONE, $DONE);
|
||||
} catch (error) {
|
||||
$DONE(`The promise should be rejected, but threw an exception: ${error.message}`);
|
||||
}
|
37
test/built-ins/Promise/all/iter-returns-number-reject.js
Normal file
37
test/built-ins/Promise/all/iter-returns-number-reject.js
Normal file
@ -0,0 +1,37 @@
|
||||
// Copyright (C) 2018 Rick Waldron. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
esid: sec-promise.all
|
||||
description: >
|
||||
Reject when argument's Symbol.iterator returns a number
|
||||
info: |
|
||||
...
|
||||
Let iteratorRecord be GetIterator(iterable).
|
||||
IfAbruptRejectPromise(iteratorRecord, promiseCapability).
|
||||
...
|
||||
|
||||
#sec-getiterator
|
||||
GetIterator ( obj [ , hint [ , method ] ] )
|
||||
|
||||
...
|
||||
Let iterator be ? Call(method, obj).
|
||||
If Type(iterator) is not Object, throw a TypeError exception.
|
||||
...
|
||||
features: [Symbol.iterator]
|
||||
flags: [async]
|
||||
---*/
|
||||
|
||||
try {
|
||||
Promise.all({
|
||||
[Symbol.iterator]() {
|
||||
return 1;
|
||||
}
|
||||
}).then(function() {
|
||||
$DONE('The promise should be rejected, but was resolved');
|
||||
}, function(error) {
|
||||
assert(error instanceof TypeError);
|
||||
}).then($DONE, $DONE);
|
||||
} catch (error) {
|
||||
$DONE(`The promise should be rejected, but threw an exception: ${error.message}`);
|
||||
}
|
37
test/built-ins/Promise/all/iter-returns-string-reject.js
Normal file
37
test/built-ins/Promise/all/iter-returns-string-reject.js
Normal file
@ -0,0 +1,37 @@
|
||||
// Copyright (C) 2018 Rick Waldron. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
esid: sec-promise.all
|
||||
description: >
|
||||
Reject when argument's Symbol.iterator returns a string
|
||||
info: |
|
||||
...
|
||||
Let iteratorRecord be GetIterator(iterable).
|
||||
IfAbruptRejectPromise(iteratorRecord, promiseCapability).
|
||||
...
|
||||
|
||||
#sec-getiterator
|
||||
GetIterator ( obj [ , hint [ , method ] ] )
|
||||
|
||||
...
|
||||
Let iterator be ? Call(method, obj).
|
||||
If Type(iterator) is not Object, throw a TypeError exception.
|
||||
...
|
||||
features: [Symbol.iterator]
|
||||
flags: [async]
|
||||
---*/
|
||||
|
||||
try {
|
||||
Promise.all({
|
||||
[Symbol.iterator]() {
|
||||
return "";
|
||||
}
|
||||
}).then(function() {
|
||||
$DONE('The promise should be rejected, but was resolved');
|
||||
}, function(error) {
|
||||
assert(error instanceof TypeError);
|
||||
}).then($DONE, $DONE);
|
||||
} catch (error) {
|
||||
$DONE(`The promise should be rejected, but threw an exception: ${error.message}`);
|
||||
}
|
37
test/built-ins/Promise/all/iter-returns-symbol-reject.js
Normal file
37
test/built-ins/Promise/all/iter-returns-symbol-reject.js
Normal file
@ -0,0 +1,37 @@
|
||||
// Copyright (C) 2018 Rick Waldron. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
esid: sec-promise.all
|
||||
description: >
|
||||
Reject when argument's Symbol.iterator returns a symbol
|
||||
info: |
|
||||
...
|
||||
Let iteratorRecord be GetIterator(iterable).
|
||||
IfAbruptRejectPromise(iteratorRecord, promiseCapability).
|
||||
...
|
||||
|
||||
#sec-getiterator
|
||||
GetIterator ( obj [ , hint [ , method ] ] )
|
||||
|
||||
...
|
||||
Let iterator be ? Call(method, obj).
|
||||
If Type(iterator) is not Object, throw a TypeError exception.
|
||||
...
|
||||
features: [Symbol.iterator]
|
||||
flags: [async]
|
||||
---*/
|
||||
|
||||
try {
|
||||
Promise.all({
|
||||
[Symbol.iterator]() {
|
||||
return Symbol();
|
||||
}
|
||||
}).then(function() {
|
||||
$DONE('The promise should be rejected, but was resolved');
|
||||
}, function(error) {
|
||||
assert(error instanceof TypeError);
|
||||
}).then($DONE, $DONE);
|
||||
} catch (error) {
|
||||
$DONE(`The promise should be rejected, but threw an exception: ${error.message}`);
|
||||
}
|
37
test/built-ins/Promise/all/iter-returns-true-reject.js
Normal file
37
test/built-ins/Promise/all/iter-returns-true-reject.js
Normal file
@ -0,0 +1,37 @@
|
||||
// Copyright (C) 2018 Rick Waldron. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
esid: sec-promise.all
|
||||
description: >
|
||||
Reject when argument's Symbol.iterator returns true
|
||||
info: |
|
||||
...
|
||||
Let iteratorRecord be GetIterator(iterable).
|
||||
IfAbruptRejectPromise(iteratorRecord, promiseCapability).
|
||||
...
|
||||
|
||||
#sec-getiterator
|
||||
GetIterator ( obj [ , hint [ , method ] ] )
|
||||
|
||||
...
|
||||
Let iterator be ? Call(method, obj).
|
||||
If Type(iterator) is not Object, throw a TypeError exception.
|
||||
...
|
||||
features: [Symbol.iterator]
|
||||
flags: [async]
|
||||
---*/
|
||||
|
||||
try {
|
||||
Promise.all({
|
||||
[Symbol.iterator]() {
|
||||
return true;
|
||||
}
|
||||
}).then(function() {
|
||||
$DONE('The promise should be rejected, but was resolved');
|
||||
}, function(error) {
|
||||
assert(error instanceof TypeError);
|
||||
}).then($DONE, $DONE);
|
||||
} catch (error) {
|
||||
$DONE(`The promise should be rejected, but threw an exception: ${error.message}`);
|
||||
}
|
37
test/built-ins/Promise/all/iter-returns-undefined-reject.js
Normal file
37
test/built-ins/Promise/all/iter-returns-undefined-reject.js
Normal file
@ -0,0 +1,37 @@
|
||||
// Copyright (C) 2018 Rick Waldron. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
esid: sec-promise.all
|
||||
description: >
|
||||
Reject when argument's Symbol.iterator returns undefined
|
||||
info: |
|
||||
...
|
||||
Let iteratorRecord be GetIterator(iterable).
|
||||
IfAbruptRejectPromise(iteratorRecord, promiseCapability).
|
||||
...
|
||||
|
||||
#sec-getiterator
|
||||
GetIterator ( obj [ , hint [ , method ] ] )
|
||||
|
||||
...
|
||||
Let iterator be ? Call(method, obj).
|
||||
If Type(iterator) is not Object, throw a TypeError exception.
|
||||
...
|
||||
features: [Symbol.iterator]
|
||||
flags: [async]
|
||||
---*/
|
||||
|
||||
try {
|
||||
Promise.all({
|
||||
[Symbol.iterator]() {
|
||||
return undefined;
|
||||
}
|
||||
}).then(function() {
|
||||
$DONE('The promise should be rejected, but was resolved');
|
||||
}, function(error) {
|
||||
assert(error instanceof TypeError);
|
||||
}).then($DONE, $DONE);
|
||||
} catch (error) {
|
||||
$DONE(`The promise should be rejected, but threw an exception: ${error.message}`);
|
||||
}
|
@ -37,7 +37,7 @@ Object.defineProperty(poisonedDone, 'done', {
|
||||
});
|
||||
Object.defineProperty(poisonedDone, 'value', {
|
||||
get: function() {
|
||||
$ERROR('The `value` property should not be accessed.');
|
||||
$DONE('The `value` property should not be accessed.');
|
||||
}
|
||||
});
|
||||
|
||||
|
@ -37,7 +37,7 @@ Object.defineProperty(poisonedDone, 'done', {
|
||||
});
|
||||
Object.defineProperty(poisonedDone, 'value', {
|
||||
get: function() {
|
||||
$ERROR('The `value` property should not be accessed.');
|
||||
$DONE('The `value` property should not be accessed.');
|
||||
}
|
||||
});
|
||||
|
||||
@ -50,7 +50,7 @@ iterStepThrows[Symbol.iterator] = function() {
|
||||
};
|
||||
|
||||
Promise.all(iterStepThrows).then(function() {
|
||||
$ERROR('The promise should be rejected.');
|
||||
$DONE('The promise should be rejected.');
|
||||
}, function(reason) {
|
||||
assert.sameValue(reason, error);
|
||||
}).then($DONE, $DONE);
|
||||
|
33
test/built-ins/Promise/race/iter-arg-is-false-reject.js
Normal file
33
test/built-ins/Promise/race/iter-arg-is-false-reject.js
Normal file
@ -0,0 +1,33 @@
|
||||
// Copyright (C) 2018 Rick Waldron. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
esid: sec-promise.race
|
||||
description: >
|
||||
Reject when argument is `false`
|
||||
info: |
|
||||
...
|
||||
Let iteratorRecord be GetIterator(iterable).
|
||||
IfAbruptRejectPromise(iteratorRecord, promiseCapability).
|
||||
...
|
||||
|
||||
#sec-getiterator
|
||||
GetIterator ( obj [ , hint [ , method ] ] )
|
||||
|
||||
...
|
||||
Let iterator be ? Call(method, obj).
|
||||
If Type(iterator) is not Object, throw a TypeError exception.
|
||||
...
|
||||
features: [Symbol.iterator]
|
||||
flags: [async]
|
||||
---*/
|
||||
|
||||
try {
|
||||
Promise.race(false).then(function() {
|
||||
$DONE('The promise should be rejected, but was resolved');
|
||||
}, function(error) {
|
||||
assert(error instanceof TypeError);
|
||||
}).then($DONE, $DONE);
|
||||
} catch (error) {
|
||||
$DONE(`The promise should be rejected, but threw an exception: ${error.message}`);
|
||||
}
|
33
test/built-ins/Promise/race/iter-arg-is-null-reject.js
Normal file
33
test/built-ins/Promise/race/iter-arg-is-null-reject.js
Normal file
@ -0,0 +1,33 @@
|
||||
// Copyright (C) 2018 Rick Waldron. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
esid: sec-promise.race
|
||||
description: >
|
||||
Reject when argument is `null`
|
||||
info: |
|
||||
...
|
||||
Let iteratorRecord be GetIterator(iterable).
|
||||
IfAbruptRejectPromise(iteratorRecord, promiseCapability).
|
||||
...
|
||||
|
||||
#sec-getiterator
|
||||
GetIterator ( obj [ , hint [ , method ] ] )
|
||||
|
||||
...
|
||||
Let iterator be ? Call(method, obj).
|
||||
If Type(iterator) is not Object, throw a TypeError exception.
|
||||
...
|
||||
features: [Symbol.iterator]
|
||||
flags: [async]
|
||||
---*/
|
||||
|
||||
try {
|
||||
Promise.race(null).then(function() {
|
||||
$DONE('The promise should be rejected, but was resolved');
|
||||
}, function(error) {
|
||||
assert(error instanceof TypeError);
|
||||
}).then($DONE, $DONE);
|
||||
} catch (error) {
|
||||
$DONE(`The promise should be rejected, but threw an exception: ${error.message}`);
|
||||
}
|
33
test/built-ins/Promise/race/iter-arg-is-number-reject.js
Normal file
33
test/built-ins/Promise/race/iter-arg-is-number-reject.js
Normal file
@ -0,0 +1,33 @@
|
||||
// Copyright (C) 2018 Rick Waldron. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
esid: sec-promise.race
|
||||
description: >
|
||||
Reject when argument is a number
|
||||
info: |
|
||||
...
|
||||
Let iteratorRecord be GetIterator(iterable).
|
||||
IfAbruptRejectPromise(iteratorRecord, promiseCapability).
|
||||
...
|
||||
|
||||
#sec-getiterator
|
||||
GetIterator ( obj [ , hint [ , method ] ] )
|
||||
|
||||
...
|
||||
Let iterator be ? Call(method, obj).
|
||||
If Type(iterator) is not Object, throw a TypeError exception.
|
||||
...
|
||||
features: [Symbol.iterator]
|
||||
flags: [async]
|
||||
---*/
|
||||
|
||||
try {
|
||||
Promise.race(1).then(function() {
|
||||
$DONE('The promise should be rejected, but was resolved');
|
||||
}, function(error) {
|
||||
assert(error instanceof TypeError);
|
||||
}).then($DONE, $DONE);
|
||||
} catch (error) {
|
||||
$DONE(`The promise should be rejected, but threw an exception: ${error.message}`);
|
||||
}
|
33
test/built-ins/Promise/race/iter-arg-is-string-resolve.js
Normal file
33
test/built-ins/Promise/race/iter-arg-is-string-resolve.js
Normal file
@ -0,0 +1,33 @@
|
||||
// Copyright (C) 2018 Rick Waldron. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
esid: sec-promise.race
|
||||
description: >
|
||||
Reject when argument is a string
|
||||
info: |
|
||||
...
|
||||
Let iteratorRecord be GetIterator(iterable).
|
||||
IfAbruptRejectPromise(iteratorRecord, promiseCapability).
|
||||
...
|
||||
|
||||
#sec-getiterator
|
||||
GetIterator ( obj [ , hint [ , method ] ] )
|
||||
|
||||
...
|
||||
Let iterator be ? Call(method, obj).
|
||||
If Type(iterator) is not Object, throw a TypeError exception.
|
||||
...
|
||||
features: [Symbol.iterator]
|
||||
flags: [async]
|
||||
---*/
|
||||
|
||||
try {
|
||||
Promise.race("").then(function() {
|
||||
$DONE();
|
||||
}, function() {
|
||||
$DONE('The promise should be resolved, but was rejected');
|
||||
}).then($DONE, $DONE);
|
||||
} catch (error) {
|
||||
$DONE(`The promise should be rejected, but threw an exception: ${error.message}`);
|
||||
}
|
33
test/built-ins/Promise/race/iter-arg-is-symbol-reject.js
Normal file
33
test/built-ins/Promise/race/iter-arg-is-symbol-reject.js
Normal file
@ -0,0 +1,33 @@
|
||||
// Copyright (C) 2018 Rick Waldron. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
esid: sec-promise.race
|
||||
description: >
|
||||
Reject when argument is a symbol
|
||||
info: |
|
||||
...
|
||||
Let iteratorRecord be GetIterator(iterable).
|
||||
IfAbruptRejectPromise(iteratorRecord, promiseCapability).
|
||||
...
|
||||
|
||||
#sec-getiterator
|
||||
GetIterator ( obj [ , hint [ , method ] ] )
|
||||
|
||||
...
|
||||
Let iterator be ? Call(method, obj).
|
||||
If Type(iterator) is not Object, throw a TypeError exception.
|
||||
...
|
||||
features: [Symbol.iterator]
|
||||
flags: [async]
|
||||
---*/
|
||||
|
||||
try {
|
||||
Promise.race(Symbol()).then(function() {
|
||||
$DONE('The promise should be rejected, but was resolved');
|
||||
}, function(error) {
|
||||
assert(error instanceof TypeError);
|
||||
}).then($DONE, $DONE);
|
||||
} catch (error) {
|
||||
$DONE(`The promise should be rejected, but threw an exception: ${error.message}`);
|
||||
}
|
33
test/built-ins/Promise/race/iter-arg-is-true-reject.js
Normal file
33
test/built-ins/Promise/race/iter-arg-is-true-reject.js
Normal file
@ -0,0 +1,33 @@
|
||||
// Copyright (C) 2018 Rick Waldron. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
esid: sec-promise.race
|
||||
description: >
|
||||
Reject when argument is `true`
|
||||
info: |
|
||||
...
|
||||
Let iteratorRecord be GetIterator(iterable).
|
||||
IfAbruptRejectPromise(iteratorRecord, promiseCapability).
|
||||
...
|
||||
|
||||
#sec-getiterator
|
||||
GetIterator ( obj [ , hint [ , method ] ] )
|
||||
|
||||
...
|
||||
Let iterator be ? Call(method, obj).
|
||||
If Type(iterator) is not Object, throw a TypeError exception.
|
||||
...
|
||||
features: [Symbol.iterator]
|
||||
flags: [async]
|
||||
---*/
|
||||
|
||||
try {
|
||||
Promise.race(true).then(function() {
|
||||
$DONE('The promise should be rejected, but was resolved');
|
||||
}, function(error) {
|
||||
assert(error instanceof TypeError);
|
||||
}).then($DONE, $DONE);
|
||||
} catch (error) {
|
||||
$DONE(`The promise should be rejected, but threw an exception: ${error.message}`);
|
||||
}
|
33
test/built-ins/Promise/race/iter-arg-is-undefined-reject.js
Normal file
33
test/built-ins/Promise/race/iter-arg-is-undefined-reject.js
Normal file
@ -0,0 +1,33 @@
|
||||
// Copyright (C) 2018 Rick Waldron. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
esid: sec-promise.race
|
||||
description: >
|
||||
Reject when argument is `undefined`
|
||||
info: |
|
||||
...
|
||||
Let iteratorRecord be GetIterator(iterable).
|
||||
IfAbruptRejectPromise(iteratorRecord, promiseCapability).
|
||||
...
|
||||
|
||||
#sec-getiterator
|
||||
GetIterator ( obj [ , hint [ , method ] ] )
|
||||
|
||||
...
|
||||
Let iterator be ? Call(method, obj).
|
||||
If Type(iterator) is not Object, throw a TypeError exception.
|
||||
...
|
||||
features: [Symbol.iterator]
|
||||
flags: [async]
|
||||
---*/
|
||||
|
||||
try {
|
||||
Promise.race(undefined).then(function() {
|
||||
$DONE('The promise should be rejected, but was resolved');
|
||||
}, function(error) {
|
||||
assert(error instanceof TypeError);
|
||||
}).then($DONE, $DONE);
|
||||
} catch (error) {
|
||||
$DONE(`The promise should be rejected, but threw an exception: ${error.message}`);
|
||||
}
|
35
test/built-ins/Promise/race/iter-assigned-false-reject.js
Normal file
35
test/built-ins/Promise/race/iter-assigned-false-reject.js
Normal file
@ -0,0 +1,35 @@
|
||||
// Copyright (C) 2018 Rick Waldron. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
esid: sec-promise.race
|
||||
description: >
|
||||
Reject when argument's Symbol.iterator property has the value false
|
||||
info: |
|
||||
...
|
||||
Let iteratorRecord be GetIterator(iterable).
|
||||
IfAbruptRejectPromise(iteratorRecord, promiseCapability).
|
||||
...
|
||||
|
||||
#sec-getiterator
|
||||
GetIterator ( obj [ , hint [ , method ] ] )
|
||||
|
||||
...
|
||||
Let iterator be ? Call(method, obj).
|
||||
If Type(iterator) is not Object, throw a TypeError exception.
|
||||
...
|
||||
features: [Symbol.iterator]
|
||||
flags: [async]
|
||||
---*/
|
||||
|
||||
try {
|
||||
Promise.race({
|
||||
[Symbol.iterator]: false
|
||||
}).then(function() {
|
||||
$DONE('The promise should be rejected, but was resolved');
|
||||
}, function(error) {
|
||||
assert(error instanceof TypeError);
|
||||
}).then($DONE, $DONE);
|
||||
} catch (error) {
|
||||
$DONE(`The promise should be rejected, but threw an exception: ${error.message}`);
|
||||
}
|
35
test/built-ins/Promise/race/iter-assigned-null-reject.js
Normal file
35
test/built-ins/Promise/race/iter-assigned-null-reject.js
Normal file
@ -0,0 +1,35 @@
|
||||
// Copyright (C) 2018 Rick Waldron. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
esid: sec-promise.race
|
||||
description: >
|
||||
Reject when argument's Symbol.iterator property has the value null
|
||||
info: |
|
||||
...
|
||||
Let iteratorRecord be GetIterator(iterable).
|
||||
IfAbruptRejectPromise(iteratorRecord, promiseCapability).
|
||||
...
|
||||
|
||||
#sec-getiterator
|
||||
GetIterator ( obj [ , hint [ , method ] ] )
|
||||
|
||||
...
|
||||
Let iterator be ? Call(method, obj).
|
||||
If Type(iterator) is not Object, throw a TypeError exception.
|
||||
...
|
||||
features: [Symbol.iterator]
|
||||
flags: [async]
|
||||
---*/
|
||||
|
||||
try {
|
||||
Promise.race({
|
||||
[Symbol.iterator]: null
|
||||
}).then(function() {
|
||||
$DONE('The promise should be rejected, but was resolved');
|
||||
}, function(error) {
|
||||
assert(error instanceof TypeError);
|
||||
}).then($DONE, $DONE);
|
||||
} catch (error) {
|
||||
$DONE(`The promise should be rejected, but threw an exception: ${error.message}`);
|
||||
}
|
35
test/built-ins/Promise/race/iter-assigned-number-reject.js
Normal file
35
test/built-ins/Promise/race/iter-assigned-number-reject.js
Normal file
@ -0,0 +1,35 @@
|
||||
// Copyright (C) 2018 Rick Waldron. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
esid: sec-promise.race
|
||||
description: >
|
||||
Reject when argument's Symbol.iterator property has the value 1
|
||||
info: |
|
||||
...
|
||||
Let iteratorRecord be GetIterator(iterable).
|
||||
IfAbruptRejectPromise(iteratorRecord, promiseCapability).
|
||||
...
|
||||
|
||||
#sec-getiterator
|
||||
GetIterator ( obj [ , hint [ , method ] ] )
|
||||
|
||||
...
|
||||
Let iterator be ? Call(method, obj).
|
||||
If Type(iterator) is not Object, throw a TypeError exception.
|
||||
...
|
||||
features: [Symbol.iterator]
|
||||
flags: [async]
|
||||
---*/
|
||||
|
||||
try {
|
||||
Promise.race({
|
||||
[Symbol.iterator]: 1
|
||||
}).then(function() {
|
||||
$DONE('The promise should be rejected, but was resolved');
|
||||
}, function(error) {
|
||||
assert(error instanceof TypeError);
|
||||
}).then($DONE, $DONE);
|
||||
} catch (error) {
|
||||
$DONE(`The promise should be rejected, but threw an exception: ${error.message}`);
|
||||
}
|
35
test/built-ins/Promise/race/iter-assigned-string-reject.js
Normal file
35
test/built-ins/Promise/race/iter-assigned-string-reject.js
Normal file
@ -0,0 +1,35 @@
|
||||
// Copyright (C) 2018 Rick Waldron. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
esid: sec-promise.race
|
||||
description: >
|
||||
Reject when argument's Symbol.iterator property has the value ""
|
||||
info: |
|
||||
...
|
||||
Let iteratorRecord be GetIterator(iterable).
|
||||
IfAbruptRejectPromise(iteratorRecord, promiseCapability).
|
||||
...
|
||||
|
||||
#sec-getiterator
|
||||
GetIterator ( obj [ , hint [ , method ] ] )
|
||||
|
||||
...
|
||||
Let iterator be ? Call(method, obj).
|
||||
If Type(iterator) is not Object, throw a TypeError exception.
|
||||
...
|
||||
features: [Symbol.iterator]
|
||||
flags: [async]
|
||||
---*/
|
||||
|
||||
try {
|
||||
Promise.race({
|
||||
[Symbol.iterator]: ""
|
||||
}).then(function() {
|
||||
$DONE('The promise should be rejected, but was resolved');
|
||||
}, function(error) {
|
||||
assert(error instanceof TypeError);
|
||||
}).then($DONE, $DONE);
|
||||
} catch (error) {
|
||||
$DONE(`The promise should be rejected, but threw an exception: ${error.message}`);
|
||||
}
|
35
test/built-ins/Promise/race/iter-assigned-symbol-reject.js
Normal file
35
test/built-ins/Promise/race/iter-assigned-symbol-reject.js
Normal file
@ -0,0 +1,35 @@
|
||||
// Copyright (C) 2018 Rick Waldron. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
esid: sec-promise.race
|
||||
description: >
|
||||
Reject when argument's Symbol.iterator property has the value Symbol()
|
||||
info: |
|
||||
...
|
||||
Let iteratorRecord be GetIterator(iterable).
|
||||
IfAbruptRejectPromise(iteratorRecord, promiseCapability).
|
||||
...
|
||||
|
||||
#sec-getiterator
|
||||
GetIterator ( obj [ , hint [ , method ] ] )
|
||||
|
||||
...
|
||||
Let iterator be ? Call(method, obj).
|
||||
If Type(iterator) is not Object, throw a TypeError exception.
|
||||
...
|
||||
features: [Symbol.iterator]
|
||||
flags: [async]
|
||||
---*/
|
||||
|
||||
try {
|
||||
Promise.race({
|
||||
[Symbol.iterator]: Symbol()
|
||||
}).then(function() {
|
||||
$DONE('The promise should be rejected, but was resolved');
|
||||
}, function(error) {
|
||||
assert(error instanceof TypeError);
|
||||
}).then($DONE, $DONE);
|
||||
} catch (error) {
|
||||
$DONE(`The promise should be rejected, but threw an exception: ${error.message}`);
|
||||
}
|
35
test/built-ins/Promise/race/iter-assigned-true-reject.js
Normal file
35
test/built-ins/Promise/race/iter-assigned-true-reject.js
Normal file
@ -0,0 +1,35 @@
|
||||
// Copyright (C) 2018 Rick Waldron. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
esid: sec-promise.race
|
||||
description: >
|
||||
Reject when argument's Symbol.iterator property has the value true
|
||||
info: |
|
||||
...
|
||||
Let iteratorRecord be GetIterator(iterable).
|
||||
IfAbruptRejectPromise(iteratorRecord, promiseCapability).
|
||||
...
|
||||
|
||||
#sec-getiterator
|
||||
GetIterator ( obj [ , hint [ , method ] ] )
|
||||
|
||||
...
|
||||
Let iterator be ? Call(method, obj).
|
||||
If Type(iterator) is not Object, throw a TypeError exception.
|
||||
...
|
||||
features: [Symbol.iterator]
|
||||
flags: [async]
|
||||
---*/
|
||||
|
||||
try {
|
||||
Promise.race({
|
||||
[Symbol.iterator]: true
|
||||
}).then(function() {
|
||||
$DONE('The promise should be rejected, but was resolved');
|
||||
}, function(error) {
|
||||
assert(error instanceof TypeError);
|
||||
}).then($DONE, $DONE);
|
||||
} catch (error) {
|
||||
$DONE(`The promise should be rejected, but threw an exception: ${error.message}`);
|
||||
}
|
@ -0,0 +1,35 @@
|
||||
// Copyright (C) 2018 Rick Waldron. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
esid: sec-promise.race
|
||||
description: >
|
||||
Reject when argument's Symbol.iterator property has the value undefined
|
||||
info: |
|
||||
...
|
||||
Let iteratorRecord be GetIterator(iterable).
|
||||
IfAbruptRejectPromise(iteratorRecord, promiseCapability).
|
||||
...
|
||||
|
||||
#sec-getiterator
|
||||
GetIterator ( obj [ , hint [ , method ] ] )
|
||||
|
||||
...
|
||||
Let iterator be ? Call(method, obj).
|
||||
If Type(iterator) is not Object, throw a TypeError exception.
|
||||
...
|
||||
features: [Symbol.iterator]
|
||||
flags: [async]
|
||||
---*/
|
||||
|
||||
try {
|
||||
Promise.race({
|
||||
[Symbol.iterator]: undefined
|
||||
}).then(function() {
|
||||
$DONE('The promise should be rejected, but was resolved');
|
||||
}, function(error) {
|
||||
assert(error instanceof TypeError);
|
||||
}).then($DONE, $DONE);
|
||||
} catch (error) {
|
||||
$DONE(`The promise should be rejected, but threw an exception: ${error.message}`);
|
||||
}
|
@ -47,7 +47,7 @@ iterNextValThrows[Symbol.iterator] = function() {
|
||||
};
|
||||
|
||||
Promise.race(iterNextValThrows).then(function() {
|
||||
$ERROR('The promise should be rejected.');
|
||||
$DONE('The promise should be rejected.');
|
||||
}, function(reason) {
|
||||
assert.sameValue(reason, error);
|
||||
}).then($DONE, $DONE);
|
||||
|
37
test/built-ins/Promise/race/iter-returns-false-reject.js
Normal file
37
test/built-ins/Promise/race/iter-returns-false-reject.js
Normal file
@ -0,0 +1,37 @@
|
||||
// Copyright (C) 2018 Rick Waldron. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
esid: sec-promise.race
|
||||
description: >
|
||||
Reject when argument's Symbol.iterator returns false
|
||||
info: |
|
||||
...
|
||||
Let iteratorRecord be GetIterator(iterable).
|
||||
IfAbruptRejectPromise(iteratorRecord, promiseCapability).
|
||||
...
|
||||
|
||||
#sec-getiterator
|
||||
GetIterator ( obj [ , hint [ , method ] ] )
|
||||
|
||||
...
|
||||
Let iterator be ? Call(method, obj).
|
||||
If Type(iterator) is not Object, throw a TypeError exception.
|
||||
...
|
||||
features: [Symbol.iterator]
|
||||
flags: [async]
|
||||
---*/
|
||||
|
||||
try {
|
||||
Promise.race({
|
||||
[Symbol.iterator]() {
|
||||
return false;
|
||||
}
|
||||
}).then(function() {
|
||||
$DONE('The promise should be rejected, but was resolved');
|
||||
}, function(error) {
|
||||
assert(error instanceof TypeError);
|
||||
}).then($DONE, $DONE);
|
||||
} catch (error) {
|
||||
$DONE(`The promise should be rejected, but threw an exception: ${error.message}`);
|
||||
}
|
37
test/built-ins/Promise/race/iter-returns-null-reject.js
Normal file
37
test/built-ins/Promise/race/iter-returns-null-reject.js
Normal file
@ -0,0 +1,37 @@
|
||||
// Copyright (C) 2018 Rick Waldron. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
esid: sec-promise.race
|
||||
description: >
|
||||
Reject when argument's Symbol.iterator returns null
|
||||
info: |
|
||||
...
|
||||
Let iteratorRecord be GetIterator(iterable).
|
||||
IfAbruptRejectPromise(iteratorRecord, promiseCapability).
|
||||
...
|
||||
|
||||
#sec-getiterator
|
||||
GetIterator ( obj [ , hint [ , method ] ] )
|
||||
|
||||
...
|
||||
Let iterator be ? Call(method, obj).
|
||||
If Type(iterator) is not Object, throw a TypeError exception.
|
||||
...
|
||||
features: [Symbol.iterator]
|
||||
flags: [async]
|
||||
---*/
|
||||
|
||||
try {
|
||||
Promise.race({
|
||||
[Symbol.iterator]() {
|
||||
return null;
|
||||
}
|
||||
}).then(function() {
|
||||
$DONE('The promise should be rejected, but was resolved');
|
||||
}, function(error) {
|
||||
assert(error instanceof TypeError);
|
||||
}).then($DONE, $DONE);
|
||||
} catch (error) {
|
||||
$DONE(`The promise should be rejected, but threw an exception: ${error.message}`);
|
||||
}
|
37
test/built-ins/Promise/race/iter-returns-number-reject.js
Normal file
37
test/built-ins/Promise/race/iter-returns-number-reject.js
Normal file
@ -0,0 +1,37 @@
|
||||
// Copyright (C) 2018 Rick Waldron. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
esid: sec-promise.race
|
||||
description: >
|
||||
Reject when argument's Symbol.iterator returns a number
|
||||
info: |
|
||||
...
|
||||
Let iteratorRecord be GetIterator(iterable).
|
||||
IfAbruptRejectPromise(iteratorRecord, promiseCapability).
|
||||
...
|
||||
|
||||
#sec-getiterator
|
||||
GetIterator ( obj [ , hint [ , method ] ] )
|
||||
|
||||
...
|
||||
Let iterator be ? Call(method, obj).
|
||||
If Type(iterator) is not Object, throw a TypeError exception.
|
||||
...
|
||||
features: [Symbol.iterator]
|
||||
flags: [async]
|
||||
---*/
|
||||
|
||||
try {
|
||||
Promise.race({
|
||||
[Symbol.iterator]() {
|
||||
return 1;
|
||||
}
|
||||
}).then(function() {
|
||||
$DONE('The promise should be rejected, but was resolved');
|
||||
}, function(error) {
|
||||
assert(error instanceof TypeError);
|
||||
}).then($DONE, $DONE);
|
||||
} catch (error) {
|
||||
$DONE(`The promise should be rejected, but threw an exception: ${error.message}`);
|
||||
}
|
37
test/built-ins/Promise/race/iter-returns-string-reject.js
Normal file
37
test/built-ins/Promise/race/iter-returns-string-reject.js
Normal file
@ -0,0 +1,37 @@
|
||||
// Copyright (C) 2018 Rick Waldron. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
esid: sec-promise.race
|
||||
description: >
|
||||
Reject when argument's Symbol.iterator returns a string
|
||||
info: |
|
||||
...
|
||||
Let iteratorRecord be GetIterator(iterable).
|
||||
IfAbruptRejectPromise(iteratorRecord, promiseCapability).
|
||||
...
|
||||
|
||||
#sec-getiterator
|
||||
GetIterator ( obj [ , hint [ , method ] ] )
|
||||
|
||||
...
|
||||
Let iterator be ? Call(method, obj).
|
||||
If Type(iterator) is not Object, throw a TypeError exception.
|
||||
...
|
||||
features: [Symbol.iterator]
|
||||
flags: [async]
|
||||
---*/
|
||||
|
||||
try {
|
||||
Promise.race({
|
||||
[Symbol.iterator]() {
|
||||
return "";
|
||||
}
|
||||
}).then(function() {
|
||||
$DONE('The promise should be rejected, but was resolved');
|
||||
}, function(error) {
|
||||
assert(error instanceof TypeError);
|
||||
}).then($DONE, $DONE);
|
||||
} catch (error) {
|
||||
$DONE(`The promise should be rejected, but threw an exception: ${error.message}`);
|
||||
}
|
37
test/built-ins/Promise/race/iter-returns-symbol-reject.js
Normal file
37
test/built-ins/Promise/race/iter-returns-symbol-reject.js
Normal file
@ -0,0 +1,37 @@
|
||||
// Copyright (C) 2018 Rick Waldron. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
esid: sec-promise.race
|
||||
description: >
|
||||
Reject when argument's Symbol.iterator returns a symbol
|
||||
info: |
|
||||
...
|
||||
Let iteratorRecord be GetIterator(iterable).
|
||||
IfAbruptRejectPromise(iteratorRecord, promiseCapability).
|
||||
...
|
||||
|
||||
#sec-getiterator
|
||||
GetIterator ( obj [ , hint [ , method ] ] )
|
||||
|
||||
...
|
||||
Let iterator be ? Call(method, obj).
|
||||
If Type(iterator) is not Object, throw a TypeError exception.
|
||||
...
|
||||
features: [Symbol.iterator]
|
||||
flags: [async]
|
||||
---*/
|
||||
|
||||
try {
|
||||
Promise.race({
|
||||
[Symbol.iterator]() {
|
||||
return Symbol();
|
||||
}
|
||||
}).then(function() {
|
||||
$DONE('The promise should be rejected, but was resolved');
|
||||
}, function(error) {
|
||||
assert(error instanceof TypeError);
|
||||
}).then($DONE, $DONE);
|
||||
} catch (error) {
|
||||
$DONE(`The promise should be rejected, but threw an exception: ${error.message}`);
|
||||
}
|
37
test/built-ins/Promise/race/iter-returns-true-reject.js
Normal file
37
test/built-ins/Promise/race/iter-returns-true-reject.js
Normal file
@ -0,0 +1,37 @@
|
||||
// Copyright (C) 2018 Rick Waldron. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
esid: sec-promise.race
|
||||
description: >
|
||||
Reject when argument's Symbol.iterator returns true
|
||||
info: |
|
||||
...
|
||||
Let iteratorRecord be GetIterator(iterable).
|
||||
IfAbruptRejectPromise(iteratorRecord, promiseCapability).
|
||||
...
|
||||
|
||||
#sec-getiterator
|
||||
GetIterator ( obj [ , hint [ , method ] ] )
|
||||
|
||||
...
|
||||
Let iterator be ? Call(method, obj).
|
||||
If Type(iterator) is not Object, throw a TypeError exception.
|
||||
...
|
||||
features: [Symbol.iterator]
|
||||
flags: [async]
|
||||
---*/
|
||||
|
||||
try {
|
||||
Promise.race({
|
||||
[Symbol.iterator]() {
|
||||
return true;
|
||||
}
|
||||
}).then(function() {
|
||||
$DONE('The promise should be rejected, but was resolved');
|
||||
}, function(error) {
|
||||
assert(error instanceof TypeError);
|
||||
}).then($DONE, $DONE);
|
||||
} catch (error) {
|
||||
$DONE(`The promise should be rejected, but threw an exception: ${error.message}`);
|
||||
}
|
37
test/built-ins/Promise/race/iter-returns-undefined-reject.js
Normal file
37
test/built-ins/Promise/race/iter-returns-undefined-reject.js
Normal file
@ -0,0 +1,37 @@
|
||||
// Copyright (C) 2018 Rick Waldron. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
esid: sec-promise.race
|
||||
description: >
|
||||
Reject when argument's Symbol.iterator returns undefined
|
||||
info: |
|
||||
...
|
||||
Let iteratorRecord be GetIterator(iterable).
|
||||
IfAbruptRejectPromise(iteratorRecord, promiseCapability).
|
||||
...
|
||||
|
||||
#sec-getiterator
|
||||
GetIterator ( obj [ , hint [ , method ] ] )
|
||||
|
||||
...
|
||||
Let iterator be ? Call(method, obj).
|
||||
If Type(iterator) is not Object, throw a TypeError exception.
|
||||
...
|
||||
features: [Symbol.iterator]
|
||||
flags: [async]
|
||||
---*/
|
||||
|
||||
try {
|
||||
Promise.race({
|
||||
[Symbol.iterator]() {
|
||||
return undefined;
|
||||
}
|
||||
}).then(function() {
|
||||
$DONE('The promise should be rejected, but was resolved');
|
||||
}, function(error) {
|
||||
assert(error instanceof TypeError);
|
||||
}).then($DONE, $DONE);
|
||||
} catch (error) {
|
||||
$DONE(`The promise should be rejected, but threw an exception: ${error.message}`);
|
||||
}
|
@ -46,7 +46,7 @@ iterStepThrows[Symbol.iterator] = function() {
|
||||
};
|
||||
|
||||
Promise.race(iterStepThrows).then(function() {
|
||||
$ERROR('The promise should be rejected.');
|
||||
$DONE('The promise should be rejected.');
|
||||
}, function(reason) {
|
||||
assert.sameValue(reason, error);
|
||||
}).then($DONE, $DONE);
|
||||
|
Loading…
x
Reference in New Issue
Block a user