summaryrefslogtreecommitdiff
path: root/test/parallel/test-repl.js
diff options
context:
space:
mode:
authorRich Trott <rtrott@gmail.com>2017-10-17 16:51:40 -0700
committerJames M Snell <jasnell@gmail.com>2017-11-11 17:41:02 -0800
commitad4c9b3a1e923749f5fbaf178ead1e80aba62116 (patch)
tree6e685b5a78ada1608b0f88158797f383c76bcdb9 /test/parallel/test-repl.js
parentc68e35258ca13bcb61082dfe01e01109c937f087 (diff)
downloadandroid-node-v8-ad4c9b3a1e923749f5fbaf178ead1e80aba62116.tar.gz
android-node-v8-ad4c9b3a1e923749f5fbaf178ead1e80aba62116.tar.bz2
android-node-v8-ad4c9b3a1e923749f5fbaf178ead1e80aba62116.zip
test: make test-repl engine agnostic
Remove reliance on V8-specific error messages in test-repl. Test should pass whether V8 is the engine, or V8 changes error message strings, or ChakraCore is the engine, or some other valid JavaScript engine is used in the future. PR-URL: https://github.com/nodejs/node/pull/16272 Reviewed-By: Michaël Zasso <targos@protonmail.com> Reviewed-By: Refael Ackermann <refack@gmail.com> Reviewed-By: Yuta Hiroto <hello@about-hiroppy.com> Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com> Reviewed-By: Tobias Nießen <tniessen@tnie.de>
Diffstat (limited to 'test/parallel/test-repl.js')
-rw-r--r--test/parallel/test-repl.js31
1 files changed, 14 insertions, 17 deletions
diff --git a/test/parallel/test-repl.js b/test/parallel/test-repl.js
index a771b32431..3bdc6c30c0 100644
--- a/test/parallel/test-repl.js
+++ b/test/parallel/test-repl.js
@@ -72,7 +72,7 @@ function clean_up() {
function strict_mode_error_test() {
send_expect([
{ client: client_unix, send: 'ref = 1',
- expect: /^ReferenceError:\sref\sis\snot\sdefined\nnode via Unix socket> $/ },
+ expect: /^ReferenceError:\s/ },
]);
}
@@ -143,7 +143,7 @@ function error_test() {
expect: prompt_unix },
// But passing the same string to eval() should throw
{ client: client_unix, send: 'eval("function test_func() {")',
- expect: /^SyntaxError: Unexpected end of input/ },
+ expect: /^SyntaxError: / },
// Can handle multiline template literals
{ client: client_unix, send: '`io.js',
expect: prompt_multiline },
@@ -172,51 +172,48 @@ function error_test() {
// invalid input to JSON.parse error is special case of syntax error,
// should throw
{ client: client_unix, send: 'JSON.parse(\'{invalid: \\\'json\\\'}\');',
- expect: /^SyntaxError: Unexpected token i/ },
+ expect: /^SyntaxError: / },
// end of input to JSON.parse error is special case of syntax error,
// should throw
{ client: client_unix, send: 'JSON.parse(\'066\');',
- expect: /^SyntaxError: Unexpected number/ },
+ expect: /^SyntaxError: / },
// should throw
{ client: client_unix, send: 'JSON.parse(\'{\');',
- expect: /^SyntaxError: Unexpected end of JSON input/ },
+ expect: /^SyntaxError: / },
// invalid RegExps are a special case of syntax error,
// should throw
{ client: client_unix, send: '/(/;',
- expect: /^SyntaxError: Invalid regular expression:/ },
+ expect: /^SyntaxError: / },
// invalid RegExp modifiers are a special case of syntax error,
// should throw (GH-4012)
{ client: client_unix, send: 'new RegExp("foo", "wrong modifier");',
- expect: /^SyntaxError: Invalid flags supplied to RegExp constructor/ },
+ expect: /^SyntaxError: / },
// strict mode syntax errors should be caught (GH-5178)
{ client: client_unix,
send: '(function() { "use strict"; return 0755; })()',
- expect: /\bSyntaxError: Octal literals are not allowed in strict mode/ },
+ expect: /\bSyntaxError: / },
{
client: client_unix,
send: '(function(a, a, b) { "use strict"; return a + b + c; })()',
- expect:
- /\bSyntaxError: Duplicate parameter name not allowed in this context/
+ expect: /\bSyntaxError: /
},
{
client: client_unix,
send: '(function() { "use strict"; with (this) {} })()',
- expect: /\bSyntaxError: Strict mode code may not include a with statement/
+ expect: /\bSyntaxError: /
},
{
client: client_unix,
send: '(function() { "use strict"; var x; delete x; })()',
- expect:
- /\bSyntaxError: Delete of an unqualified identifier in strict mode/
+ expect: /\bSyntaxError: /
},
{ client: client_unix,
send: '(function() { "use strict"; eval = 17; })()',
- expect: /\bSyntaxError: Unexpected eval or arguments in strict mode/ },
+ expect: /\bSyntaxError: / },
{
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\./
+ expect: /\bSyntaxError: /
},
// Named functions can be used:
{ client: client_unix, send: 'function blah() { return 1; }',
@@ -268,7 +265,7 @@ function error_test() {
expect: `Invalid REPL keyword\n${prompt_unix}` },
// fail when we are not inside a String and a line continuation is used
{ client: client_unix, send: '[] \\',
- expect: /\bSyntaxError: Invalid or unexpected token/ },
+ expect: /\bSyntaxError: / },
// do not fail when a String is created with line continuation
{ client: client_unix, send: '\'the\\\nfourth\\\neye\'',
expect: `${prompt_multiline}${prompt_multiline}'thefourtheye'\n${