diff options
author | Rich Trott <rtrott@gmail.com> | 2017-02-26 03:23:49 +0300 |
---|---|---|
committer | Anna Henningsen <anna@addaleax.net> | 2017-03-06 01:23:51 +0300 |
commit | 91a222de9903ba77c14d54ccd60908646837dc80 (patch) | |
tree | 8e298a57c18233746b1b215e651743f698556121 /test | |
parent | 924b785d509e3d308fd0f211182b49d3c2aecbad (diff) |
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')
-rw-r--r-- | test/parallel/test-repl.js | 69 |
1 files changed, 46 insertions, 23 deletions
diff --git a/test/parallel/test-repl.js b/test/parallel/test-repl.js index 420010e1a3d..3cf1b52e617 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 + } ]); } |