| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 39f7aaa commit a27098d
1 file changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1,4 +1,3 @@ | |||
| 1 | - /* eslint-disable max-len */ | ||
| 2 | 1 | 'use strict'; | |
| 3 | 2 | ||
| 4 | 3 | const common = require('../common'); | |
@@ -168,18 +167,32 @@ function error_test() { | |||
| 168 | 167 | { client: client_unix, send: 'new RegExp("foo", "wrong modifier");', | |
| 169 | 168 | expect: /\bSyntaxError: Invalid flags supplied to RegExp constructor/ }, | |
| 170 | 169 | // strict mode syntax errors should be caught (GH-5178) | |
| 171 | - { client: client_unix, send: '(function() { "use strict"; return 0755; })()', | ||
| 170 | + { client: client_unix, | ||
| 171 | + send: '(function() { "use strict"; return 0755; })()', | ||
| 172 | 172 | expect: /\bSyntaxError: Octal literals are not allowed in strict mode/ }, | |
| 173 | - { client: client_unix, send: '(function(a, a, b) { "use strict"; return a + b + c; })()', | ||
| 174 | - expect: /\bSyntaxError: Duplicate parameter name not allowed in this context/ }, | ||
| 175 | - { client: client_unix, send: '(function() { "use strict"; with (this) {} })()', | ||
| 176 | - expect: /\bSyntaxError: Strict mode code may not include a with statement/ }, | ||
| 177 | - { client: client_unix, send: '(function() { "use strict"; var x; delete x; })()', | ||
| 178 | - expect: /\bSyntaxError: Delete of an unqualified identifier in strict mode/ }, | ||
| 179 | - { client: client_unix, send: '(function() { "use strict"; eval = 17; })()', | ||
| 173 | + { | ||
| 174 | + client: client_unix, | ||
| 175 | + send: '(function(a, a, b) { "use strict"; return a + b + c; })()', | ||
| 176 | + expect: /\bSyntaxError: Duplicate parameter name not allowed in this context/ // eslint-disable-line max-len | ||
| 177 | + }, | ||
| 178 | + { | ||
| 179 | + client: client_unix, | ||
| 180 | + send: '(function() { "use strict"; with (this) {} })()', | ||
| 181 | + expect: /\bSyntaxError: Strict mode code may not include a with statement/ | ||
| 182 | + }, | ||
| 183 | + { | ||
| 184 | + client: client_unix, | ||
| 185 | + send: '(function() { "use strict"; var x; delete x; })()', | ||
| 186 | + expect: /\bSyntaxError: Delete of an unqualified identifier in strict mode/ // eslint-disable-line max-len | ||
| 187 | + }, | ||
| 188 | + { client: client_unix, | ||
| 189 | + send: '(function() { "use strict"; eval = 17; })()', | ||
| 180 | 190 | expect: /\bSyntaxError: Unexpected eval or arguments in strict mode/ }, | |
| 181 | - { client: client_unix, send: '(function() { "use strict"; if (true) function f() { } })()', | ||
| 182 | - expect: /\bSyntaxError: In strict mode code, functions can only be declared at top level or inside a block./ }, | ||
| 191 | + { | ||
| 192 | + client: client_unix, | ||
| 193 | + send: '(function() { "use strict"; if (true) function f() { } })()', | ||
| 194 | + expect: /\bSyntaxError: In strict mode code, functions can only be declared at top level or inside a block./ // eslint-disable-line max-len | ||
| 195 | + }, | ||
| 183 | 196 | // Named functions can be used: | |
| 184 | 197 | { client: client_unix, send: 'function blah() { return 1; }', | |
| 185 | 198 | expect: prompt_unix }, | |
@@ -312,16 +325,20 @@ function error_test() { | |||
| 312 | 325 | { client: client_unix, send: 'require("internal/repl")', | |
| 313 | 326 | expect: /^Error: Cannot find module 'internal\/repl'/ }, | |
| 314 | 327 | // REPL should handle quotes within regexp literal in multiline mode | |
| 315 | - { client: client_unix, send: "function x(s) {\nreturn s.replace(/'/,'');\n}", | ||
| 328 | + { client: client_unix, | ||
| 329 | + send: "function x(s) {\nreturn s.replace(/'/,'');\n}", | ||
| 316 | 330 | expect: prompt_multiline + prompt_multiline + | |
| 317 | 331 | 'undefined\n' + prompt_unix }, | |
| 318 | - { client: client_unix, send: "function x(s) {\nreturn s.replace(/'/,'');\n}", | ||
| 332 | + { client: client_unix, | ||
| 333 | + send: "function x(s) {\nreturn s.replace(/'/,'');\n}", | ||
| 319 | 334 | expect: prompt_multiline + prompt_multiline + | |
| 320 | 335 | 'undefined\n' + prompt_unix }, | |
| 321 | - { client: client_unix, send: 'function x(s) {\nreturn s.replace(/"/,"");\n}', | ||
| 336 | + { client: client_unix, | ||
| 337 | + send: 'function x(s) {\nreturn s.replace(/"/,"");\n}', | ||
| 322 | 338 | expect: prompt_multiline + prompt_multiline + | |
| 323 | 339 | 'undefined\n' + prompt_unix }, | |
| 324 | - { client: client_unix, send: 'function x(s) {\nreturn s.replace(/.*/,"");\n}', | ||
| 340 | + { client: client_unix, | ||
| 341 | + send: 'function x(s) {\nreturn s.replace(/.*/,"");\n}', | ||
| 325 | 342 | expect: prompt_multiline + prompt_multiline + | |
| 326 | 343 | 'undefined\n' + prompt_unix }, | |
| 327 | 344 | { client: client_unix, send: '{ var x = 4; }', | |
@@ -356,14 +373,20 @@ function error_test() { | |||
| 356 | 373 | expect: '{ value: undefined, done: true }' }, | |
| 357 | 374 | ||
| 358 | 375 | // https://github.com/nodejs/node/issues/9300 | |
| 359 | - { client: client_unix, send: 'function foo() {\nvar bar = 1 / 1; // "/"\n}', | ||
| 360 | - expect: prompt_multiline + prompt_multiline + 'undefined\n' + prompt_unix }, | ||
| 361 | - | ||
| 362 | - { client: client_unix, send: '(function() {\nreturn /foo/ / /bar/;\n}())', | ||
| 363 | - expect: prompt_multiline + prompt_multiline + 'NaN\n' + prompt_unix }, | ||
| 364 | - | ||
| 365 | - { client: client_unix, send: '(function() {\nif (false) {} /bar"/;\n}())', | ||
| 366 | - expect: prompt_multiline + prompt_multiline + 'undefined\n' + prompt_unix } | ||
| 376 | + { | ||
| 377 | + client: client_unix, send: 'function foo() {\nvar bar = 1 / 1; // "/"\n}', | ||
| 378 | + expect: `${prompt_multiline}${prompt_multiline}undefined\n${prompt_unix}` | ||
| 379 | + }, | ||
| 380 | + | ||
| 381 | + { | ||
| 382 | + client: client_unix, send: '(function() {\nreturn /foo/ / /bar/;\n}())', | ||
| 383 | + expect: prompt_multiline + prompt_multiline + 'NaN\n' + prompt_unix | ||
| 384 | + }, | ||
| 385 | + | ||
| 386 | + { | ||
| 387 | + client: client_unix, send: '(function() {\nif (false) {} /bar"/;\n}())', | ||
| 388 | + expect: prompt_multiline + prompt_multiline + 'undefined\n' + prompt_unix | ||
| 389 | + } | ||
| 367 | 390 | ]); | |
| 368 | 391 | } | |
| 369 | 392 | ||
| Back | FazBrowse Home | New Git URL |
0 commit comments