Skip to content

Commit

Permalink
added test for caolan#133
Browse files Browse the repository at this point in the history
  • Loading branch information
sokra committed May 31, 2012
1 parent 4351b56 commit b01270d
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions test/test-async.js
Original file line number Diff line number Diff line change
Expand Up @@ -1212,6 +1212,30 @@ exports['whilst'] = function (test) {
);
};

exports['whilst/until sync'] = function (test) {
var i = 0, j = 0;
var testFuncWhile = function() { return i < 100000; }
var testFuncUntil = function() { return i >= 100000; }
var iter = function(c) {
i++;
j++;
c();
}
var check = function() {
test.equals(i, 100000);
test.equals(j, 100000);
test.done();
}

// This will stack overflow if we wouldn't care about it.
async.whilst(testFuncWhile, iter, function() {
test.equals(i, 100000);
test.equals(j, 100000);
i = j = 0;
async.until(testFuncUntil, iter, check);
});
};

exports['queue'] = function (test) {
var call_order = [],
delays = [160,80,240,80];
Expand Down

0 comments on commit b01270d

Please sign in to comment.