summaryrefslogtreecommitdiff
path: root/test/test-async.js
diff options
context:
space:
mode:
Diffstat (limited to 'test/test-async.js')
-rwxr-xr-xtest/test-async.js26
1 files changed, 24 insertions, 2 deletions
diff --git a/test/test-async.js b/test/test-async.js
index 6797afe..eba90e9 100755
--- a/test/test-async.js
+++ b/test/test-async.js
@@ -80,8 +80,10 @@ function getFunctionsObject(call_order) {
};
}
-exports['forever'] = function (test) {
- test.expect(1);
+exports['forever'] = {
+
+'async': function (test) {
+ test.expect(2);
var counter = 0;
function addOne(callback) {
counter++;
@@ -94,8 +96,28 @@ exports['forever'] = function (test) {
}
async.forever(addOne, function (err) {
test.equal(err, 'too big!');
+ test.equal(counter, 50);
test.done();
});
+},
+
+'sync': function (test) {
+ test.expect(2);
+ var counter = 0;
+ function addOne(callback) {
+ counter++;
+ if (counter === 50000) {
+ return callback('too big!');
+ }
+ callback();
+ }
+ async.forever(addOne, function (err) {
+ test.equal(err, 'too big!');
+ test.equal(counter, 50000);
+ test.done();
+ });
+}
+
};
exports['applyEach'] = function (test) {