From a0d565d01bd256ea3d67104925139576d110aadb Mon Sep 17 00:00:00 2001 From: Caolan McMahon Date: Fri, 15 Mar 2013 12:37:31 +0000 Subject: revert detection of sync tasks and add setImmediate --- test/test-async.js | 57 +----------------------------------------------------- 1 file changed, 1 insertion(+), 56 deletions(-) (limited to 'test/test-async.js') diff --git a/test/test-async.js b/test/test-async.js index 5bd72bf..cba6f4b 100755 --- a/test/test-async.js +++ b/test/test-async.js @@ -2341,7 +2341,7 @@ exports['queue events'] = function(test) { var q = async.queue(function(task, cb) { // nop calls.push('process ' + task); - cb(); + async.setImmediate(cb); }, 3); q.saturated = function() { @@ -2381,58 +2381,3 @@ exports['queue events'] = function(test) { q.push('poo', function () {calls.push('poo cb');}); q.push('moo', function () {calls.push('moo cb');}); }; - -exports['avoid stack overflows for sync tasks'] = function (test) { - if (typeof window !== 'undefined') { - // skip this test in the browser, it takes AGES - return test.done(); - } - var arr = []; - var funcarr = []; - for (var i = 0; i < 10000; i++) { - arr.push[i]; - funcarr.push(function (cb) { return cb(); }); - } - var iter = function (i, cb) { cb(); }; - var counter = 0; - var pred1 = function () { - return counter <= 10000; - }; - var iter = function (cb) { - counter++; - cb(); - }; - var pred2 = function () { - return counter > 10000; - }; - var resetCounter = function (cb) { - counter = 0; - cb(); - } - async.series([ - async.apply(async.each, arr, iter), - async.apply(async.eachSeries, arr, iter), - async.apply(async.eachLimit, arr, iter, 2), - async.apply(async.whilst, pred1, iter), - resetCounter, - async.apply(async.until, pred2, iter), - resetCounter, - async.apply(async.doWhilst, iter, pred1), - resetCounter, - async.apply(async.doUntil, iter, pred2), - async.apply(async.series, funcarr), - async.apply(async.parallel, funcarr), - function (callback) { - var q = async.queue(function (task, cb) { - cb(); - }, 2); - for (var j = 0; j < 10000; j++) { - q.push(j); - } - q.drain = callback; - } - ], - function (err) { - test.done(err); - }); -}; -- cgit v1.2.1