wzp
2021-05-13 7d694a9113118daec5be7ac224dab46a3b20f106
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
/*
 * Tests that if the user modifies the list of functions passed to
 * vasync.pipeline, vasync ignores the changes and does not crash.
 */
var assert = require('assert');
var vasync = require('../lib/vasync');
var count = 0;
var funcs;
 
function doStuff(_, callback)
{
    count++;
    setImmediate(callback);
}
 
funcs = [ doStuff, doStuff, doStuff ];
 
vasync.pipeline({
    'funcs': funcs
}, function (err) {
    assert.ok(!err);
    assert.ok(count === 3);
});
 
funcs.push(doStuff);