mirror of https://github.com/lukechilds/node.git
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
24 lines
658 B
24 lines
658 B
'use strict';
|
|
const common = require('../common');
|
|
const assert = require('assert');
|
|
const events = require('events');
|
|
const e = new events.EventEmitter();
|
|
|
|
e.on('maxListeners', common.mustCall(function() {}));
|
|
|
|
// Should not corrupt the 'maxListeners' queue.
|
|
e.setMaxListeners(42);
|
|
|
|
assert.throws(function() {
|
|
e.setMaxListeners(NaN);
|
|
}, /^TypeError: "n" argument must be a positive number$/);
|
|
|
|
assert.throws(function() {
|
|
e.setMaxListeners(-1);
|
|
}, /^TypeError: "n" argument must be a positive number$/);
|
|
|
|
assert.throws(function() {
|
|
e.setMaxListeners('and even this');
|
|
}, /^TypeError: "n" argument must be a positive number$/);
|
|
|
|
e.emit('maxListeners');
|
|
|