diff options
Diffstat (limited to 'test/built-ins/Promise/race/S25.4.4.3_A4.1_T2.js')
-rw-r--r-- | test/built-ins/Promise/race/S25.4.4.3_A4.1_T2.js | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/test/built-ins/Promise/race/S25.4.4.3_A4.1_T2.js b/test/built-ins/Promise/race/S25.4.4.3_A4.1_T2.js new file mode 100644 index 000000000..17fc88701 --- /dev/null +++ b/test/built-ins/Promise/race/S25.4.4.3_A4.1_T2.js @@ -0,0 +1,34 @@ +// Copyright 2014 Cubane Canada, Inc. All rights reserved. +// See LICENSE for details. + +/*--- +es6id: S25.4.4.3_A4.1_T2 +author: Sam Mikes +description: Promise.race rejects if IteratorStep throws +---*/ + +var iterThrows = {}; +Object.defineProperty(iterThrows, Symbol.iterator, { + get: function () { + return { + next: function () { + var v = {}; + Object.defineProperty(v, 'value', { + get: function () { + throw new Error("abrupt completion"); + } + }); + return v; + } + }; + } +}); + +Promise.race(iterThrows).then(function () { + $ERROR('Promise unexpectedly fulfilled: Promise.race(iterThrows) should throw TypeError'); +},function (err) { + if (!(err instanceof TypeError)) { + $ERROR('Expected TypeError, got ' + err); + } +}).then($DONE,$DONE); + |