0
0
mirror of https://github.com/nodejs/node.git synced 2024-12-01 16:10:02 +01:00
nodejs/test/parallel/test-event-emitter-num-args.js
Roman Reiss fb8811d95e lib,test: fix whitespace issues
PR-URL: https://github.com/nodejs/io.js/pull/1971
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
2015-06-15 16:37:37 +02:00

27 lines
636 B
JavaScript

'use strict';
var common = require('../common');
var assert = require('assert');
var events = require('events');
var e = new events.EventEmitter(),
num_args_emited = [];
e.on('numArgs', function() {
var numArgs = arguments.length;
console.log('numArgs: ' + numArgs);
num_args_emited.push(numArgs);
});
console.log('start');
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);
process.on('exit', function() {
assert.deepEqual([0, 1, 2, 3, 4, 5], num_args_emited);
});