blob: 22916cc20536f5f2ab802311fe3b768d3be33058 [file] [log] [blame]
function shouldBe(actual, expected) {
if (actual !== expected)
throw new Error('bad value: ' + actual);
}
var array = [];
for (var i = 0; i < 3e3; ++i) {
let value = i;
array.push(new Promise(function (resolve) { resolve(Promise.resolve(value)); }));
}
drainMicrotasks();
for (var i = 0; i < 3e3; ++i) {
let expected = i;
array[i].then(function (value) {
shouldBe(value, expected);
array[expected] = true;
});
}
drainMicrotasks();
for (var i = 0; i < 3e3; ++i)
shouldBe(array[i], true);