| 1 |
// Copyright 2014 Cubane Canada, Inc. All rights reserved. |
| 2 |
// See LICENSE for details. |
| 3 |
|
| 4 |
/*--- |
| 5 |
info: Promise.race rejects on non-iterable argument |
| 6 |
es6id: S25.4.4.3_A2.2_T1 |
| 7 |
author: Sam Mikes |
| 8 |
description: Promise.race rejects if argument is not object or is non-iterable |
| 9 |
flags: [async] |
| 10 |
---*/ |
| 11 |
|
| 12 |
var nonIterable = 3; |
| 13 |
|
| 14 |
Promise.race(nonIterable).then(function() { |
| 15 |
$ERROR('Promise unexpectedly fulfilled: Promise.race(nonIterable) should throw TypeError'); |
| 16 |
}, function(err) { |
| 17 |
if (!(err instanceof TypeError)) { |
| 18 |
$ERROR('Expected TypeError, got ' + err); |
| 19 |
} |
| 20 |
}).then($DONE, $DONE); |