Browse Source

test: fix redeclared test-event-emitter-* vars

PR-URL: https://github.com/nodejs/node/pull/4985
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Johan Bergström <bugs@bergstroem.nu>
Reviewed-By: Michaël Zasso <mic.besace@gmail.com>
process-exit-stdio-flushing
Rich Trott 9 years ago
parent
commit
7ea34fd624
  1. 8
      test/parallel/test-event-emitter-check-listener-leaks.js
  2. 1
      test/parallel/test-event-emitter-listeners-side-effects.js

8
test/parallel/test-event-emitter-check-listener-leaks.js

@ -6,7 +6,7 @@ var events = require('events');
var e = new events.EventEmitter();
// default
for (var i = 0; i < 10; i++) {
for (let i = 0; i < 10; i++) {
e.on('default', function() {});
}
assert.ok(!e._events['default'].hasOwnProperty('warned'));
@ -15,7 +15,7 @@ assert.ok(e._events['default'].warned);
// specific
e.setMaxListeners(5);
for (var i = 0; i < 5; i++) {
for (let i = 0; i < 5; i++) {
e.on('specific', function() {});
}
assert.ok(!e._events['specific'].hasOwnProperty('warned'));
@ -31,7 +31,7 @@ assert.ok(e._events['only one'].hasOwnProperty('warned'));
// unlimited
e.setMaxListeners(0);
for (var i = 0; i < 1000; i++) {
for (let i = 0; i < 1000; i++) {
e.on('unlimited', function() {});
}
assert.ok(!e._events['unlimited'].hasOwnProperty('warned'));
@ -40,7 +40,7 @@ assert.ok(!e._events['unlimited'].hasOwnProperty('warned'));
events.EventEmitter.defaultMaxListeners = 42;
e = new events.EventEmitter();
for (var i = 0; i < 42; ++i) {
for (let i = 0; i < 42; ++i) {
e.on('fortytwo', function() {});
}
assert.ok(!e._events['fortytwo'].hasOwnProperty('warned'));

1
test/parallel/test-event-emitter-listeners-side-effects.js

@ -4,7 +4,6 @@ require('../common');
var assert = require('assert');
var EventEmitter = require('events').EventEmitter;
var assert = require('assert');
var e = new EventEmitter();
var fl; // foo listeners

Loading…
Cancel
Save