diff options
author | Prince J Wesley <princejohnwesley@gmail.com> | 2016-03-07 10:31:33 +0530 |
---|---|---|
committer | James M Snell <jasnell@gmail.com> | 2016-03-18 17:13:09 -0700 |
commit | a38d6ad4be02528c8975c1e6c796556531de68e1 (patch) | |
tree | 235830889598515a6f2bf339562b72309a9c3e04 /test | |
parent | 9e30129fa7dd75389bcd178ae5f65482438d6978 (diff) | |
download | android-node-v8-a38d6ad4be02528c8975c1e6c796556531de68e1.tar.gz android-node-v8-a38d6ad4be02528c8975c1e6c796556531de68e1.tar.bz2 android-node-v8-a38d6ad4be02528c8975c1e6c796556531de68e1.zip |
repl: support standalone blocks
Enable support for standalone block statements.
```js
node 🙈 ₹ git:(upstream ⚡ bare-block) ./node
> { var x = 3; console.log(x); }
3
undefined
> {}
{}
> { x:1, y:"why not", z: function() {} }
{ x: 1, y: 'why not', z: [Function] }
>
```
For the ambiguous inputs like `{ x }`, the existing REPL
behaviour (ES6 literal shorthand) is preserved (prefers
expression over statement).
Fixes: https://github.com/nodejs/node/issues/5576
PR-URL: https://github.com/nodejs/node/pull/5581
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Evan Lucas <evanlucas@me.com>
Diffstat (limited to 'test')
-rw-r--r-- | test/parallel/test-repl.js | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/test/parallel/test-repl.js b/test/parallel/test-repl.js index 7ec9f1c363..ab7df802ad 100644 --- a/test/parallel/test-repl.js +++ b/test/parallel/test-repl.js @@ -323,6 +323,8 @@ function error_test() { { client: client_unix, send: 'function x(s) {\nreturn s.replace(/.*/,"");\n}', expect: prompt_multiline + prompt_multiline + 'undefined\n' + prompt_unix }, + { client: client_unix, send: '{ var x = 4; }', + expect: 'undefined\n' + prompt_unix }, ]); } |