Debian Codegraph @

tests/auto/qml/ecmascripttests/test262/test/built-ins/Promise/all/S25.4.4.1_A5.1_T1.js

raw
1 // Copyright 2014 Cubane Canada, Inc. All rights reserved.
2 // See LICENSE for details.
3
4 /*---
5 info: |
6 Promise.all expects an iterable argument;
7 rejects if IteratorStep() throws
8 es6id: S25.4.4.1_A5.1_T1
9 author: Sam Mikes
10 description: iterator.next throws, causing Promise.all to reject
11 features: [Symbol.iterator]
12 flags: [async]
13 ---*/
14
15 var iterThrows = {};
16 var error = new Test262Error();
17 iterThrows[Symbol.iterator] = function() {
18 return {
19 next: function() {
20 throw error;
21 }
22 };
23 };
24
25 Promise.all(iterThrows).then(function() {
26 $ERROR('Promise unexpectedly resolved: Promise.all(iterThrows) should throw TypeError');
27 }, function(reason) {
28 assert.sameValue(reason, error);
29 }).then($DONE, $DONE);