Skip to content
This repository has been archived by the owner on Apr 22, 2023. It is now read-only.

Commit

Permalink
test: debugger-repl should wait for 'drain' event
Browse files Browse the repository at this point in the history
  • Loading branch information
indutny authored and bnoordhuis committed Nov 5, 2011
1 parent febe5c4 commit da82daf
Showing 1 changed file with 13 additions and 8 deletions.
21 changes: 13 additions & 8 deletions test/simple/test-debugger-repl.js
Expand Up @@ -58,15 +58,20 @@ child.on('line', function(line) {
function addTest(input, output) {
function next() {
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) {
setTimeout(function() {
var callback = expected[0].callback;
expected.shift();
callback = expected[0].callback;
expected.shift();
}

callback && callback();
}, 50);
if (callback) {
if (res !== true) {
child.stdin.on('drain', callback);
} else {
process.nextTick(callback);
}
}
} else {
finish();
Expand All @@ -90,7 +95,7 @@ addTest('n', [
]);

// Watch
addTest('watch("\'x\'")');
addTest('watch("\'x\'"), true', [/true/]);

// Continue
addTest('c', [
Expand All @@ -107,7 +112,7 @@ addTest('watchers', [
]);

// Unwatch
addTest('unwatch("\'x\'")');
addTest('unwatch("\'x\'"), true', [ /true/ ]);

// Step out
addTest('o', [
Expand Down

0 comments on commit da82daf

Please sign in to comment.