repl: fix passing an empty line inserting "undefined" into the buffer

There was a possiblity of insering the string "undefined" into the repl's
command buffer, which would cause interesting results while evaluating.
pull/24503/head
Nathan Rajlich 2012-07-04 11:51:24 -07:00
parent 6a11f3edf4
commit 9126dd2d90
2 changed files with 4 additions and 1 deletions

View File

@ -883,6 +883,7 @@ function trimWhitespace(cmd) {
if (matches && matches.length === 2) {
return matches[1];
}
return '';
}

View File

@ -152,7 +152,9 @@ function error_test() {
{ client: client_unix, send: 'npm install foobar',
expect: expect_npm },
{ client: client_unix, send: '(function () {\n\nreturn 1;\n})()',
expect: '1' }
expect: '1' },
{ client: client_unix, send: '{\n\na: 1\n}',
expect: '{ a: 1 }' }
]);
}