Debian Codegraph @

js/src/tests/test262/built-ins/Promise/race/S25.4.4.3_A4.1_T1.js

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