Browse Source

test: debugger-repl should wait for 'drain' event

v0.7.4-release
Fedor Indutny 13 years ago
committed by Ben Noordhuis
parent
commit
da82daf54c
  1. 21
      test/simple/test-debugger-repl.js

21
test/simple/test-debugger-repl.js

@ -58,15 +58,20 @@ child.on('line', function(line) {
function addTest(input, output) { function addTest(input, output) {
function next() { function next() {
if (expected.length > 0) { if (expected.length > 0) {
child.stdin.write(expected[0].input + '\n'); var res = child.stdin.write(expected[0].input + '\n'),
callback;
if (!expected[0].lines) { if (!expected[0].lines) {
setTimeout(function() { callback = expected[0].callback;
var callback = expected[0].callback; expected.shift();
expected.shift(); }
callback && callback(); if (callback) {
}, 50); if (res !== true) {
child.stdin.on('drain', callback);
} else {
process.nextTick(callback);
}
} }
} else { } else {
finish(); finish();
@ -90,7 +95,7 @@ addTest('n', [
]); ]);
// Watch // Watch
addTest('watch("\'x\'")'); addTest('watch("\'x\'"), true', [/true/]);
// Continue // Continue
addTest('c', [ addTest('c', [
@ -107,7 +112,7 @@ addTest('watchers', [
]); ]);
// Unwatch // Unwatch
addTest('unwatch("\'x\'")'); addTest('unwatch("\'x\'"), true', [ /true/ ]);
// Step out // Step out
addTest('o', [ addTest('o', [

Loading…
Cancel
Save