2015-05-19 13:00:06 +02:00
|
|
|
'use strict';
|
2010-12-05 00:20:34 +01:00
|
|
|
var common = require('../common');
|
|
|
|
var assert = require('assert');
|
2010-11-28 07:03:14 +01:00
|
|
|
var events = require('events');
|
|
|
|
|
|
|
|
var e = new events.EventEmitter(),
|
2010-12-05 20:15:30 +01:00
|
|
|
num_args_emited = [];
|
2010-11-28 07:03:14 +01:00
|
|
|
|
2010-12-05 20:15:30 +01:00
|
|
|
e.on('numArgs', function() {
|
2010-11-28 07:03:14 +01:00
|
|
|
var numArgs = arguments.length;
|
2010-12-05 20:15:30 +01:00
|
|
|
console.log('numArgs: ' + numArgs);
|
2010-11-28 07:03:14 +01:00
|
|
|
num_args_emited.push(numArgs);
|
|
|
|
});
|
|
|
|
|
2010-12-05 20:15:30 +01:00
|
|
|
console.log('start');
|
2010-11-28 07:03:14 +01:00
|
|
|
|
2010-12-05 20:15:30 +01: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 07:03:14 +01:00
|
|
|
|
2011-10-15 01:08:36 +02:00
|
|
|
process.on('exit', function() {
|
2010-11-28 07:03:14 +01:00
|
|
|
assert.deepEqual([0, 1, 2, 3, 4, 5], num_args_emited);
|
|
|
|
});
|