Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

repl: eval empty lines, fixing debugger repeat #6025

Closed
wants to merge 4 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions lib/repl.js
Original file line number Diff line number Diff line change
Expand Up @@ -421,7 +421,7 @@ function REPLServer(prompt,
}
}

if (!skipCatchall && (cmd || (!cmd && self.bufferedCommand))) {
if (!skipCatchall) {
var evalCmd = self.bufferedCommand + cmd;
if (/^\s*\{/.test(evalCmd) && /\}\s*$/.test(evalCmd)) {
// It's confusing for `{ a : 1 }` to be interpreted as a block
Expand Down Expand Up @@ -483,7 +483,7 @@ function REPLServer(prompt,
// immediately. We don't have to print anything else. So, only when
// the second argument to this function is there, print it.
arguments.length === 2 &&
(!self.ignoreUndefined || ret !== undefined)) {
(!(self.ignoreUndefined || evalCmd === '\n') || ret !== undefined)) {
if (!self.underscoreAssigned) {
self.last = ret;
}
Expand Down
4 changes: 2 additions & 2 deletions test/debugger/test-debugger-pid.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ interfacer.stderr.on('data', onData);

interfacer.on('line', function(line) {
line = line.replace(/^(debug> *)+/, '');
var expected = 'Target process: 655555 doesn\'t exist.';
assert.ok(expected == line, 'Got unexpected line: ' + line);
var expected = /Target process: 655555 doesn\'t exist./;
assert.ok(line.match(expected), 'Got unexpected line: ' + line);
});

interfacer.on('exit', function(code, signal) {
Expand Down
16 changes: 8 additions & 8 deletions test/debugger/test-debugger-repl-break-in-module.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ repl.startDebugger('break-in-module/main.js');
// -- SET BREAKPOINT --

// Set breakpoint by file name + line number where the file is not loaded yet
repl.addTest('sb("mod.js", 23)', [
repl.addTest('sb("mod.js", 2)', [
/Warning: script 'mod\.js' was not loaded yet\./,
/1/, /2/, /3/, /4/, /5/, /6/
]);
Expand All @@ -20,8 +20,8 @@ repl.addTest('sb(")^$*+?}{|][(.js\\\\", 1)', [

// continue - the breakpoint should be triggered
repl.addTest('c', [
/break in .*[\\\/]mod\.js:23/,
/21/, /22/, /23/, /24/, /25/
/break in .*[\\\/]mod\.js:2/,
/1/, /2/, /3/, /4/
]);

// -- RESTORE BREAKPOINT ON RESTART --
Expand All @@ -33,7 +33,7 @@ repl.addTest('restart', [].concat(
],
repl.handshakeLines,
[
/Restoring breakpoint mod.js:23/,
/Restoring breakpoint mod.js:2/,
/Warning: script 'mod\.js' was not loaded yet\./,
/Restoring breakpoint \).*:\d+/,
/Warning: script '\)[^']*' was not loaded yet\./
Expand All @@ -42,14 +42,14 @@ repl.addTest('restart', [].concat(

// continue - the breakpoint should be triggered
repl.addTest('c', [
/break in .*[\\\/]mod\.js:23/,
/21/, /22/, /23/, /24/, /25/
/break in .*[\\\/]mod\.js:2/,
/1/, /2/, /3/, /4/
]);

// -- CLEAR BREAKPOINT SET IN MODULE TO BE LOADED --

repl.addTest('cb("mod.js", 23)', [
/18/, /./, /./, /./, /./, /./, /./, /./, /26/
repl.addTest('cb("mod.js", 2)', [
/1/, /2/, /3/, /4/, /5/
]);

repl.addTest('c', [
Expand Down
12 changes: 6 additions & 6 deletions test/debugger/test-debugger-repl-term.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,16 +22,16 @@ addTest('', [
/3/, /4/, /5/, /6/, /7/,
]);

// continue
addTest('c', [
/debug>.*c/,
// out
addTest('o', [
/debug>.*o/,
/break in .*:12/,
/10/, /11/, /12/, /13/, /14/
]);

// should repeat continue
addTest('', [
/debug>/,
// continue
addTest('c', [
/debug>.*c/,
/break in .*:5/,
/3/, /4/, /5/, /6/, /7/,
]);
Expand Down