Skip to content
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions test/parallel/test-event-emitter-prototype-bleeding.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
'use strict';
var util = require('util');
var EventEmitter = require('events').EventEmitter;

var TestClass = function () {};
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why not function TestClass () {}?

TestClass.prototype = new EventEmitter;

function listener_n1() {
// This one is okay to be called!
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This function must be called, right? Why not assign some value to a variable here and check if the value is set in process.exit?

}
function listener_n2() {
throw new Error("This one should not be called!")
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the number of spaces required is 2. Is make lint happy about this?

}

var ok = new TestClass();
var broken = new TestClass();
broken.on('end', listener_n2);
ok.on('end', listener_n1);
ok.emit('end');