| function __createIterableObject(arr, methods) { |
| if (typeof Symbol !== 'function' || !Symbol.iterator) { |
| return { value: arr.shift(), done: arr.length <= 0 }; |
| 'return': methods['return'], |
| 'throw': methods['throw'] |
| iterable[Symbol.iterator] = function(){ return iterator; } |
| function asyncTestPassed() { |
| var fulfills = Promise.all(global.__createIterableObject([ |
| new Promise(function(resolve) { setTimeout(resolve,200,"foo"); }), |
| new Promise(function(resolve) { setTimeout(resolve,100,"bar"); }), |
| var rejects = Promise.all(global.__createIterableObject([ |
| new Promise(function(_, reject) { setTimeout(reject, 200,"baz"); }), |
| new Promise(function(_, reject) { setTimeout(reject, 100,"qux"); }), |
| fulfills.then(function(result) { score += (result + "" === "foo,bar"); check(); }); |
| rejects.catch(function(result) { score += (result === "qux"); check(); }); |
| if (score === 2) asyncTestPassed(); |
| throw new Error("Test failed"); |