summaryrefslogtreecommitdiffstats
path: root/js/src/tests/test262/built-ins/Promise/all/S25.4.4.1_A3.1_T3.js
blob: 9a93d8bd9f9735ce6252f3d88197dbbfa30f0e25 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
// |reftest| async
// Copyright 2014 Cubane Canada, Inc.  All rights reserved.
// See LICENSE for details.

/*---
info: |
    Promise.all expects an iterable argument;
    fails if GetIterator returns an abrupt completion.
es6id: S25.4.4.1_A3.1_T3
author: Sam Mikes
description: Promise.all((throw on GetIterator)) returns Promise rejected with TypeError
features: [Symbol.iterator]
flags: [async]
---*/

var iterThrows = {};
Object.defineProperty(iterThrows, Symbol.iterator, {
  get: function() {
    throw new Error("abrupt completion");
  }
});

Promise.all(iterThrows).then(function() {
  throw new Test262Error('Promise unexpectedly fulfilled: Promise.all(iterThrows) should throw TypeError');
}, function(err) {
  assert(!!(err instanceof Error), 'The value of !!(err instanceof Error) is expected to be true');
}).then($DONE, $DONE);