Debian Codegraph @

tests/auto/qml/ecmascripttests/test262/test/built-ins/Promise/all/S25.4.4.1_A3.1_T3.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 fails if GetIterator returns an abrupt completion.
8 es6id: S25.4.4.1_A3.1_T3
9 author: Sam Mikes
10 description: Promise.all((throw on GetIterator)) returns Promise rejected with TypeError
11 features: [Symbol.iterator]
12 flags: [async]
13 ---*/
14
15 var iterThrows = {};
16 Object.defineProperty(iterThrows, Symbol.iterator, {
17 get: function() {
18 throw new Error("abrupt completion");
19 }
20 });
21
22 Promise.all(iterThrows).then(function() {
23 $ERROR('Promise unexpectedly fulfilled: Promise.all(iterThrows) should throw TypeError');
24 }, function(err) {
25 if (!(err instanceof Error)) {
26 $ERROR('Expected promise to be rejected with error, got ' + err);
27 }
28 }).then($DONE, $DONE);