UNPKG

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