Browse Source

test: check for multiple "emit" calls in repl-end-emits-exit.js

v0.9.1-release
Nathan Rajlich 13 years ago
parent
commit
c5d35aca33
  1. 12
      test/simple/test-repl-end-emits-exit.js

12
test/simple/test-repl-end-emits-exit.js

@ -23,8 +23,8 @@ var common = require('../common'),
assert = require('assert'), assert = require('assert'),
Stream = require('stream'), Stream = require('stream'),
repl = require('repl'), repl = require('repl'),
gotTerminalExit = false, terminalExit = 0,
gotRegularExit = false; regularExit = 0;
// create a dummy stream that does nothing // create a dummy stream that does nothing
var stream = new Stream(); var stream = new Stream();
@ -45,7 +45,7 @@ function testTerminalMode() {
r1.on('exit', function() { r1.on('exit', function() {
// should be fired from the simulated ^D keypress // should be fired from the simulated ^D keypress
gotTerminalExit = true; terminalExit++;
testRegularMode(); testRegularMode();
}); });
} }
@ -63,13 +63,13 @@ function testRegularMode() {
r2.on('exit', function() { r2.on('exit', function() {
// should be fired from the simulated 'end' event // should be fired from the simulated 'end' event
gotRegularExit = true; regularExit++;
}); });
} }
process.on('exit', function() { process.on('exit', function() {
assert(gotTerminalExit); assert.equal(terminalExit, 1);
assert(gotRegularExit); assert.equal(regularExit, 1);
}); });

Loading…
Cancel
Save