[Pkg-javascript-commits] [node-async] 91/480: [test] Add more tests for edge cases to forEachLimit

Jonas Smedegaard js at moszumanska.debian.org
Fri May 2 08:58:15 UTC 2014


This is an automated email from the git hooks/post-receive script.

js pushed a commit to branch master
in repository node-async.

commit 3753e4d452be6fb84bea312bf84b566bde27440c
Author: indexzero <charlie.robbins at gmail.com>
Date:   Sun Jun 12 21:00:56 2011 -0400

    [test] Add more tests for edge cases to forEachLimit
---
 test/test-async.js | 28 ++++++++++++++++++++++++++++
 1 file changed, 28 insertions(+)

diff --git a/test/test-async.js b/test/test-async.js
index a00866a..df7d27b 100644
--- a/test/test-async.js
+++ b/test/test-async.js
@@ -516,6 +516,34 @@ exports['forEachLimit empty array'] = function(test){
     setTimeout(test.done, 25);
 };
 
+exports['forEachLimit limit exceeds size'] = function(test){
+    var args = [];
+    var arr = [0,1,2,3,4,5,6,7,8,9];
+    async.forEachLimit(arr, 20, function(x,callback){
+        setTimeout(function(){
+            args.push(x);
+            callback();
+        }, x*5);
+    }, function(err){
+        test.same(args, arr);
+        test.done();
+    });
+};
+
+exports['forEachLimit limit equal size'] = function(test){
+    var args = [];
+    var arr = [0,1,2,3,4,5,6,7,8,9];
+    async.forEachLimit(arr, 10, function(x,callback){
+        setTimeout(function(){
+            args.push(x);
+            callback();
+        }, x*5);
+    }, function(err){
+        test.same(args, arr);
+        test.done();
+    });
+};
+
 exports['forEachLimit zero limit'] = function(test){
     test.expect(1);
     async.forEachLimit([0,1,2,3,4,5], 0, function(x, callback){

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-javascript/node-async.git



More information about the Pkg-javascript-commits mailing list