10BC0
We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent b93ad5a commit cb971ccCopy full SHA for cb971cc
lib/repl.js
@@ -288,8 +288,9 @@ function REPLServer(prompt,
288
289
for (var i = 0; i < line.length; i += 1) {
290
if (previous === '\\') {
291
- // if it is a valid escaping, then skip processing
292
- previous = current;
+ // if it is a valid escaping, then skip processing and the previous
+ // character doesn't matter anymore.
293
+ previous = null;
294
continue;
295
}
296
test/parallel/test-repl.js
@@ -242,6 +242,13 @@ function error_test() {
242
'RegExp.$6\nRegExp.$7\nRegExp.$8\nRegExp.$9\n',
243
expect: ['\'1\'\n', '\'2\'\n', '\'3\'\n', '\'4\'\n', '\'5\'\n', '\'6\'\n',
244
'\'7\'\n', '\'8\'\n', '\'9\'\n'].join(`${prompt_unix}`) },
245
+ // regression tests for https://github.com/nodejs/node/issues/2749
246
+ { client: client_unix, send: 'function x() {\nreturn \'\\n\';\n }',
247
+ expect: prompt_multiline + prompt_multiline +
248
+ 'undefined\n' + prompt_unix },
249
+ { client: client_unix, send: 'function x() {\nreturn \'\\\\\';\n }',
250
251
252
]);
253
254