| 1 |
// Copyright 2014 Cubane Canada, Inc. All rights reserved. |
| 2 |
// See LICENSE for details. |
| 3 |
|
| 4 |
/*--- |
| 5 |
info: | |
| 6 |
Promise.all expects an iterable argument; |
| 7 |
ref 7.4.1 non-Object fails CheckIterable |
| 8 |
ref 7.4.2 GetIterator throws TypeError if CheckIterable fails |
| 9 |
es6id: 25.4.4.1_A3.1_T1 |
| 10 |
author: Sam Mikes |
| 11 |
description: Promise.all(3) returns Promise rejected with TypeError |
| 12 |
flags: [async] |
| 13 |
---*/ |
| 14 |
|
| 15 |
var nonIterable = 3; |
| 16 |
|
| 17 |
Promise.all(nonIterable).then(function() { |
| 18 |
$ERROR('Promise unexpectedly resolved: Promise.all(nonIterable) should throw TypeError'); |
| 19 |
}, function(err) { |
| 20 |
if (!(err instanceof TypeError)) { |
| 21 |
$ERROR('Expected TypeError, got ' + err); |
| 22 |
} |
| 23 |
}).then($DONE, $DONE); |