summaryrefslogtreecommitdiff
path: root/test/parallel/test-repl.js
diff options
context:
space:
mode:
authorRich Trott <rtrott@gmail.com>2017-02-25 16:23:49 -0800
committerRich Trott <rtrott@gmail.com>2017-03-02 06:49:26 -0800
commitebe8c3debeea708ca69b8724dda9ad9c5c32e72c (patch)
treeae56a4c76d9c838aeaeb62056d141d11e3986528 /test/parallel/test-repl.js
parente317a616a91487b7dd43d3215839d9c6f3be55d0 (diff)
downloadandroid-node-v8-ebe8c3debeea708ca69b8724dda9ad9c5c32e72c.tar.gz
android-node-v8-ebe8c3debeea708ca69b8724dda9ad9c5c32e72c.tar.bz2
android-node-v8-ebe8c3debeea708ca69b8724dda9ad9c5c32e72c.zip
test: enable max-len for test-repl
Instead of disabling max-len (ESLint's line-length rule) for the entire file, reformat to avoid exceeding length restrictions in most cases and disable the rule only on specific lines where exceeding the length restriction may be a better choice than conforming to it. PR-URL: https://github.com/nodejs/node/pull/11559 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Yuta Hiroto <hello@about-hiroppy.com>
Diffstat (limited to 'test/parallel/test-repl.js')
-rw-r--r--test/parallel/test-repl.js69
1 files changed, 46 insertions, 23 deletions
diff --git a/test/parallel/test-repl.js b/test/parallel/test-repl.js
index 420010e1a3..3cf1b52e61 100644
--- a/test/parallel/test-repl.js
+++ b/test/parallel/test-repl.js
@@ -1,4 +1,3 @@
-/* eslint-disable max-len */
'use strict';
const common = require('../common');
@@ -168,18 +167,32 @@ function error_test() {
{ client: client_unix, send: 'new RegExp("foo", "wrong modifier");',
expect: /\bSyntaxError: Invalid flags supplied to RegExp constructor/ },
// strict mode syntax errors should be caught (GH-5178)
- { client: client_unix, send: '(function() { "use strict"; return 0755; })()',
+ { client: client_unix,
+ send: '(function() { "use strict"; return 0755; })()',
expect: /\bSyntaxError: Octal literals are not allowed in strict mode/ },
- { client: client_unix, send: '(function(a, a, b) { "use strict"; return a + b + c; })()',
- expect: /\bSyntaxError: Duplicate parameter name not allowed in this context/ },
- { client: client_unix, send: '(function() { "use strict"; with (this) {} })()',
- expect: /\bSyntaxError: Strict mode code may not include a with statement/ },
- { client: client_unix, send: '(function() { "use strict"; var x; delete x; })()',
- expect: /\bSyntaxError: Delete of an unqualified identifier in strict mode/ },
- { client: client_unix, send: '(function() { "use strict"; eval = 17; })()',
+ {
+ client: client_unix,
+ send: '(function(a, a, b) { "use strict"; return a + b + c; })()',
+ expect: /\bSyntaxError: Duplicate parameter name not allowed in this context/ // eslint-disable-line max-len
+ },
+ {
+ client: client_unix,
+ send: '(function() { "use strict"; with (this) {} })()',
+ expect: /\bSyntaxError: Strict mode code may not include a with statement/
+ },
+ {
+ client: client_unix,
+ send: '(function() { "use strict"; var x; delete x; })()',
+ expect: /\bSyntaxError: Delete of an unqualified identifier in strict mode/ // eslint-disable-line max-len
+ },
+ { client: client_unix,
+ send: '(function() { "use strict"; eval = 17; })()',
expect: /\bSyntaxError: Unexpected eval or arguments in strict mode/ },
- { client: client_unix, send: '(function() { "use strict"; if (true) function f() { } })()',
- expect: /\bSyntaxError: In strict mode code, functions can only be declared at top level or inside a block./ },
+ {
+ client: client_unix,
+ send: '(function() { "use strict"; if (true) function f() { } })()',
+ expect: /\bSyntaxError: In strict mode code, functions can only be declared at top level or inside a block./ // eslint-disable-line max-len
+ },
// Named functions can be used:
{ client: client_unix, send: 'function blah() { return 1; }',
expect: prompt_unix },
@@ -312,16 +325,20 @@ function error_test() {
{ client: client_unix, send: 'require("internal/repl")',
expect: /^Error: Cannot find module 'internal\/repl'/ },
// REPL should handle quotes within regexp literal in multiline mode
- { client: client_unix, send: "function x(s) {\nreturn s.replace(/'/,'');\n}",
+ { client: client_unix,
+ send: "function x(s) {\nreturn s.replace(/'/,'');\n}",
expect: prompt_multiline + prompt_multiline +
'undefined\n' + prompt_unix },
- { client: client_unix, send: "function x(s) {\nreturn s.replace(/'/,'');\n}",
+ { client: client_unix,
+ send: "function x(s) {\nreturn s.replace(/'/,'');\n}",
expect: prompt_multiline + prompt_multiline +
'undefined\n' + prompt_unix },
- { client: client_unix, send: 'function x(s) {\nreturn s.replace(/"/,"");\n}',
+ { client: client_unix,
+ send: 'function x(s) {\nreturn s.replace(/"/,"");\n}',
expect: prompt_multiline + prompt_multiline +
'undefined\n' + prompt_unix },
- { client: client_unix, send: 'function x(s) {\nreturn s.replace(/.*/,"");\n}',
+ { 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; }',
@@ -356,14 +373,20 @@ function error_test() {
expect: '{ value: undefined, done: true }' },
// https://github.com/nodejs/node/issues/9300
- { client: client_unix, send: 'function foo() {\nvar bar = 1 / 1; // "/"\n}',
- expect: prompt_multiline + prompt_multiline + 'undefined\n' + prompt_unix },
-
- { client: client_unix, send: '(function() {\nreturn /foo/ / /bar/;\n}())',
- expect: prompt_multiline + prompt_multiline + 'NaN\n' + prompt_unix },
-
- { client: client_unix, send: '(function() {\nif (false) {} /bar"/;\n}())',
- expect: prompt_multiline + prompt_multiline + 'undefined\n' + prompt_unix }
+ {
+ client: client_unix, send: 'function foo() {\nvar bar = 1 / 1; // "/"\n}',
+ expect: `${prompt_multiline}${prompt_multiline}undefined\n${prompt_unix}`
+ },
+
+ {
+ client: client_unix, send: '(function() {\nreturn /foo/ / /bar/;\n}())',
+ expect: prompt_multiline + prompt_multiline + 'NaN\n' + prompt_unix
+ },
+
+ {
+ client: client_unix, send: '(function() {\nif (false) {} /bar"/;\n}())',
+ expect: prompt_multiline + prompt_multiline + 'undefined\n' + prompt_unix
+ }
]);
}