debugger: remove useless clearlines, updated test
* remove useless clearline call at Interface start * silence after .handleBreak() * output '\b' if this.stdout is not a tty (debugger) * add '\b' checks for clearline (test)
This commit is contained in:
parent
e406613ee5
commit
39fec6003e
@ -785,7 +785,6 @@ function Interface(stdin, stdout, args) {
|
||||
this.breakpoints = [];
|
||||
|
||||
// Run script automatically
|
||||
this.clearline();
|
||||
this.pause();
|
||||
|
||||
// XXX Need to figure out why we need this delay
|
||||
@ -827,6 +826,8 @@ Interface.prototype.clearline = function() {
|
||||
if (this.stdout.isTTY) {
|
||||
this.stdout.cursorTo(0);
|
||||
this.stdout.clearLine(1);
|
||||
} else {
|
||||
this.stdout.write('\b');
|
||||
}
|
||||
};
|
||||
|
||||
@ -876,7 +877,7 @@ Interface.prototype.handleBreak = function(r) {
|
||||
// And list source
|
||||
this.list(2);
|
||||
|
||||
this.resume();
|
||||
this.resume(true);
|
||||
};
|
||||
|
||||
|
||||
|
@ -45,8 +45,6 @@ var expected = [];
|
||||
child.on('line', function(line) {
|
||||
assert.ok(expected.length > 0, 'Got unexpected line: ' + line);
|
||||
|
||||
console.log(JSON.stringify(line) + ',');
|
||||
|
||||
var expectedLine = expected[0].lines.shift();
|
||||
assert.equal(line, expectedLine);
|
||||
|
||||
@ -72,45 +70,44 @@ function addTest(input, output) {
|
||||
|
||||
// Initial lines
|
||||
addTest(null, [
|
||||
"debug> < debugger listening on port 5858",
|
||||
"debug> connecting... ok",
|
||||
"debug> break in [unnamed]:3",
|
||||
" 1 ",
|
||||
" 2 debugger;",
|
||||
" 3 debugger;",
|
||||
" 4 function a(x) {",
|
||||
" 5 var i = 10;"
|
||||
"debug> \b< debugger listening on port 5858",
|
||||
"debug> \bconnecting... ok",
|
||||
"debug> \bbreak in [unnamed]:3",
|
||||
"\b 1 ",
|
||||
"\b 2 debugger;",
|
||||
"\b 3 debugger;",
|
||||
"\b 4 function a(x) {",
|
||||
"\b 5 var i = 10;"
|
||||
]);
|
||||
|
||||
// Next
|
||||
addTest('n', [
|
||||
"debug> debug> debug> break in [unnamed]:13",
|
||||
" 11 return [\"hello\", \"world\"].join(\" \");",
|
||||
" 12 };",
|
||||
" 13 a();",
|
||||
" 14 a(1);",
|
||||
" 15 b();"
|
||||
"debug> debug> debug> \bbreak in [unnamed]:13",
|
||||
"\b 11 return ['hello', 'world'].join(' ');",
|
||||
"\b 12 };",
|
||||
"\b 13 a();",
|
||||
"\b 14 a(1);",
|
||||
"\b 15 b();"
|
||||
]);
|
||||
|
||||
// Continue
|
||||
addTest('c', [
|
||||
"debug> debug> debug> break in [unnamed]:7",
|
||||
" 5 var i = 10;",
|
||||
" 6 while (--i != 0);",
|
||||
" 7 debugger;",
|
||||
" 8 return i;",
|
||||
" 9 };"
|
||||
"debug> debug> debug> \bbreak in [unnamed]:7",
|
||||
"\b 5 var i = 10;",
|
||||
"\b 6 while (--i != 0);",
|
||||
"\b 7 debugger;",
|
||||
"\b 8 return i;",
|
||||
"\b 9 };"
|
||||
]);
|
||||
|
||||
|
||||
// Step out
|
||||
addTest('o', [
|
||||
"debug> debug> debug> break in [unnamed]:14",
|
||||
" 12 };",
|
||||
" 13 a();",
|
||||
" 14 a(1);",
|
||||
" 15 b();",
|
||||
" 16 b();"
|
||||
"debug> debug> debug> \bbreak in [unnamed]:14",
|
||||
"\b 12 };",
|
||||
"\b 13 a();",
|
||||
"\b 14 a(1);",
|
||||
"\b 15 b();",
|
||||
"\b 16 b();"
|
||||
]);
|
||||
|
||||
|
||||
@ -130,9 +127,13 @@ setTimeout(function() {
|
||||
|
||||
process.once('uncaughtException', function(e) {
|
||||
quit();
|
||||
throw e;
|
||||
console.error(e.toString());
|
||||
process.exit(1);
|
||||
});
|
||||
|
||||
process.on('exit', function() {
|
||||
process.on('exit', function(code) {
|
||||
quit();
|
||||
if (code === 0) {
|
||||
assert.equal(expected.length, 0);
|
||||
}
|
||||
});
|
||||
|
Loading…
x
Reference in New Issue
Block a user