Skip to content
Snippets Groups Projects
S25.4.4.1_A5.1_T1.js 744 B
Newer Older
// Copyright 2014 Cubane Canada, Inc.  All rights reserved.
// See LICENSE for details.

/*---
info: >
    Promise.all expects an iterable argument;
    rejects if IteratorStep() throws
author: Sam Mikes
description: iterator.next throws, causing Promise.all to reject
---*/

var iterThrows = {};
Mike Pennisi's avatar
Mike Pennisi committed
var error = new Test262Error();
iterThrows[Symbol.iterator] = function() {
    return {
        next: function () {
            throw error;
        }
    };
};

Promise.all(iterThrows).then(function () {
    $ERROR('Promise unexpectedly resolved: Promise.all(iterThrows) should throw TypeError');
Mike Pennisi's avatar
Mike Pennisi committed
},function (reason) {
    assert.sameValue(reason, error);
}).then($DONE,$DONE);