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);
// 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();"
]);
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);
+ }
});