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

Commit

Permalink
Browse files Browse the repository at this point in the history
test-debugger-repl improvements
  • Loading branch information
indutny authored and ry committed Sep 23, 2011
1 parent 78d91ff commit e406613
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 29 deletions.
16 changes: 16 additions & 0 deletions test/fixtures/breakpoints.js
@@ -0,0 +1,16 @@
// wrapper line
debugger;
debugger;
function a(x) {
var i = 10;
while (--i != 0);
debugger;
return i;
};
function b() {
return ['hello', 'world'].join(' ');
};
a();
a(1);
b();
b();
41 changes: 12 additions & 29 deletions test/simple/test-debugger-repl.js
Expand Up @@ -25,28 +25,12 @@ var assert = require('assert');
var spawn = require('child_process').spawn;
var debug = require('_debugger');

var code = [
'',
'debugger;',
'debugger;',
'function a(x) {',
' var i = 10;',
' while (--i != 0);',
' debugger;',
' return i;',
'}',
'function b() {',
' return ["hello", "world"].join(" ");',
'}',
'a()',
'a(1)',
'b()',
'b()'
].join('\n');
var code = require('fs').readFileSync(common.fixturesDir + '/breakpoints.js');

var child = spawn(process.execPath, ['debug', '-e', code]);

var buffer = '';
child.stdout.setEncoding('utf-8');
child.stdout.on('data', function(data) {
data = (buffer + data.toString()).split(/\n/g);
buffer = data.pop();
Expand Down Expand Up @@ -102,10 +86,10 @@ addTest(null, [
addTest('n', [
"debug> debug> debug> break in [unnamed]:13",
" 11 return [\"hello\", \"world\"].join(\" \");",
" 12 }",
" 13 a()",
" 14 a(1)",
" 15 b()"
" 12 };",
" 13 a();",
" 14 a(1);",
" 15 b();"
]);

// Continue
Expand All @@ -115,23 +99,22 @@ addTest('c', [
" 6 while (--i != 0);",
" 7 debugger;",
" 8 return i;",
" 9 }"
" 9 };"
]);


// Step out
addTest('o', [
"debug> debug> debug> break in [unnamed]:14",
" 12 }",
" 13 a()",
" 14 a(1)",
" 15 b()",
" 16 b()"
" 12 };",
" 13 a();",
" 14 a(1);",
" 15 b();",
" 16 b();"
]);


function finish() {
console.log('passed');
process.exit(0);
};

Expand Down

0 comments on commit e406613

Please sign in to comment.