2010-12-05 07:20:34 +08:00
|
|
|
var common = require('../common');
|
|
|
|
var assert = require('assert');
|
2010-11-28 14:03:14 +08:00
|
|
|
var events = require('events');
|
|
|
|
|
|
|
|
var e = new events.EventEmitter(),
|
2010-12-06 03:15:30 +08:00
|
|
|
num_args_emited = [];
|
2010-11-28 14:03:14 +08:00
|
|
|
|
2010-12-06 03:15:30 +08:00
|
|
|
e.on('numArgs', function() {
|
2010-11-28 14:03:14 +08:00
|
|
|
var numArgs = arguments.length;
|
2010-12-06 03:15:30 +08:00
|
|
|
console.log('numArgs: ' + numArgs);
|
2010-11-28 14:03:14 +08:00
|
|
|
num_args_emited.push(numArgs);
|
|
|
|
});
|
|
|
|
|
2010-12-06 03:15:30 +08:00
|
|
|
console.log('start');
|
2010-11-28 14:03:14 +08:00
|
|
|
|
2010-12-06 03:15:30 +08:00
|
|
|
e.emit('numArgs');
|
|
|
|
e.emit('numArgs', null);
|
|
|
|
e.emit('numArgs', null, null);
|
|
|
|
e.emit('numArgs', null, null, null);
|
|
|
|
e.emit('numArgs', null, null, null, null);
|
|
|
|
e.emit('numArgs', null, null, null, null, null);
|
2010-11-28 14:03:14 +08:00
|
|
|
|
2010-12-06 03:15:30 +08:00
|
|
|
process.addListener('exit', function() {
|
2010-11-28 14:03:14 +08:00
|
|
|
assert.deepEqual([0, 1, 2, 3, 4, 5], num_args_emited);
|
|
|
|
});
|
|
|
|
|
|
|
|
|