Debian Codegraph @

tests/auto/qml/ecmascripttests/test262/test/built-ins/Promise/race/S25.4.4.3_A4.1_T1.js

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