iter-arg-is-true-reject.js (903B)
1 // |reftest| async 2 // Copyright (C) 2018 Rick Waldron. All rights reserved. 3 // This code is governed by the BSD license found in the LICENSE file. 4 5 /*--- 6 esid: sec-promise.all 7 description: > 8 Reject when argument is `true` 9 info: | 10 ... 11 Let iteratorRecord be GetIterator(iterable). 12 IfAbruptRejectPromise(iteratorRecord, promiseCapability). 13 ... 14 15 #sec-getiterator 16 GetIterator ( obj [ , hint [ , method ] ] ) 17 18 ... 19 Let iterator be ? Call(method, obj). 20 If Type(iterator) is not Object, throw a TypeError exception. 21 ... 22 features: [Symbol.iterator] 23 flags: [async] 24 ---*/ 25 26 try { 27 Promise.all(true).then(function() { 28 $DONE('The promise should be rejected, but was resolved'); 29 }, function(error) { 30 assert(error instanceof TypeError); 31 }).then($DONE, $DONE); 32 } catch (error) { 33 $DONE(`The promise should be rejected, but threw an exception: ${error.message}`); 34 }