blob: 82419a75c2d5e587c546b4a5a5fae9c5821b4118 [file] [log] [blame]
function shouldBe(actual, expected) {
if (actual !== expected)
throw new Error('bad value: ' + actual);
}
var resolve = null;
var promise = new Promise(function (r) {
resolve = r;
});
var array = [];
promise.then(function () {
array.push(0);
});
promise.then(function () {
array.push(1);
promise.then(function () {
array.push(3);
});
});
promise.then(function () {
array.push(2);
});
resolve(42);
drainMicrotasks();
shouldBe(array.length, 4);
for (var i = 0; i < array.length; ++i)
shouldBe(array[i], i);