From 563290194f42e5040348a985abf4cceb8a1abb4b Mon Sep 17 00:00:00 2001 From: Oliver Dunk Date: Thu, 6 Jun 2019 19:35:53 +0000 Subject: [PATCH] Add quotes around unexpected token SyntaxError Quotes have been added around the token to make the message clearer. Bug: chromium:943636 Change-Id: Ic38f3e6d307157af2c0146e69fb611a2cfb46564 Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/1593307 Commit-Queue: Jakob Gruber Reviewed-by: Jakob Gruber Cr-Commit-Position: refs/heads/master@{#62074} --- AUTHORS | 1 + src/execution/message-template.h | 2 +- test/cctest/test-liveedit.cc | 2 +- test/cctest/test-parsing.cc | 6 +++--- .../evaluate-on-call-frame-return-values-expected.txt | 4 ++-- .../runtime/call-function-on-async-expected.txt | 4 ++-- test/inspector/runtime/es6-module-expected.txt | 10 +++++----- test/inspector/runtime/evaluate-async-expected.txt | 6 +++--- test/inspector/runtime/exception-thrown-expected.txt | 10 +++++----- .../runtime/exceptionthrown-on-connect-expected.txt | 4 ++-- test/inspector/runtime/run-script-async-expected.txt | 6 +++--- test/message/fail/arrow-bare-rest-param.out | 4 ++-- test/message/fail/arrow-missing.out | 4 ++-- test/message/fail/class-spread-property.out | 4 ++-- test/message/fail/formal-parameters-trailing-comma.out | 4 ++-- test/message/fail/invalid-spread.out | 4 ++-- test/message/fail/modules-export-illformed-class.out | 4 ++-- test/message/regress/fail/regress-8409.out | 4 ++-- test/mjsunit/regress/regress-797581.js | 2 +- test/webkit/class-syntax-declaration-expected.txt | 6 +++--- test/webkit/class-syntax-declaration.js | 6 +++--- test/webkit/class-syntax-expression-expected.txt | 2 +- test/webkit/class-syntax-expression.js | 2 +- test/webkit/class-syntax-extends-expected.txt | 6 +++--- test/webkit/class-syntax-name-expected.txt | 8 ++++---- test/webkit/class-syntax-semicolon-expected.txt | 10 +++++----- test/webkit/class-syntax-semicolon.js | 10 +++++----- .../fast/js/function-constructor-error-expected.txt | 4 ++-- test/webkit/fast/js/object-extra-comma-expected.txt | 4 ++-- .../function-toString-object-literals-expected.txt | 10 +++++----- 30 files changed, 77 insertions(+), 76 deletions(-) diff --git a/AUTHORS b/AUTHORS index 0462ae8ea3..76fc83d3b2 100644 --- a/AUTHORS +++ b/AUTHORS @@ -139,6 +139,7 @@ Nicolas Antonius Ernst Leopold Maria Kaiser Niklas Hambüchen Noj Vek Oleksandr Chekhovskyi +Oliver Dunk Paolo Giarrusso Patrick Gansterer Peng Fei diff --git a/src/execution/message-template.h b/src/execution/message-template.h index ae88aa4411..06a721005f 100644 --- a/src/execution/message-template.h +++ b/src/execution/message-template.h @@ -495,7 +495,7 @@ namespace internal { T(UnexpectedSuper, "'super' keyword unexpected here") \ T(UnexpectedNewTarget, "new.target expression is not allowed here") \ T(UnexpectedTemplateString, "Unexpected template string") \ - T(UnexpectedToken, "Unexpected token %") \ + T(UnexpectedToken, "Unexpected token '%'") \ T(UnexpectedTokenUnaryExponentiation, \ "Unary operator used immediately before exponentiation expression. " \ "Parenthesis must be used to disambiguate operator precedence") \ diff --git a/test/cctest/test-liveedit.cc b/test/cctest/test-liveedit.cc index 4319d5bebe..1ef2c12966 100644 --- a/test/cctest/test-liveedit.cc +++ b/test/cctest/test-liveedit.cc @@ -505,7 +505,7 @@ TEST(LiveEditCompileError) { CHECK_EQ(result.column_number, 51); v8::String::Utf8Value result_message(env->GetIsolate(), result.message); CHECK_NOT_NULL( - strstr(*result_message, "Uncaught SyntaxError: Unexpected token )")); + strstr(*result_message, "Uncaught SyntaxError: Unexpected token ')'")); { v8::Local result = diff --git a/test/cctest/test-parsing.cc b/test/cctest/test-parsing.cc index aaef09b91e..596a302d4f 100644 --- a/test/cctest/test-parsing.cc +++ b/test/cctest/test-parsing.cc @@ -4701,10 +4701,10 @@ TEST(ImportExpressionSuccess) { // context. // For example, a top level "import(" is parsed as an // import declaration. The parser parses the import token correctly - // and then shows an "Unexpected token (" error message. The + // and then shows an "Unexpected token '('" error message. The // preparser does not understand the import keyword (this test is // run without kAllowHarmonyDynamicImport flag), so this results in - // an "Unexpected token import" error. + // an "Unexpected token 'import'" error. RunParserSyncTest(context_data, data, kError); RunModuleParserSyncTest(context_data, data, kError, nullptr, 0, nullptr, 0, nullptr, 0, true, true); @@ -4772,7 +4772,7 @@ TEST(ImportExpressionErrors) { // as an import declaration. The parser parses the import token // correctly and then shows an "Unexpected end of input" error // message because of the '{'. The preparser shows an "Unexpected - // token {" because it's not a valid token in a CallExpression. + // token '{'" because it's not a valid token in a CallExpression. RunModuleParserSyncTest(context_data, data, kError, nullptr, 0, flags, arraysize(flags), nullptr, 0, true, true); } diff --git a/test/inspector/debugger/evaluate-on-call-frame-return-values-expected.txt b/test/inspector/debugger/evaluate-on-call-frame-return-values-expected.txt index dfca60e0c2..0fdce93661 100644 --- a/test/inspector/debugger/evaluate-on-call-frame-return-values-expected.txt +++ b/test/inspector/debugger/evaluate-on-call-frame-return-values-expected.txt @@ -308,7 +308,7 @@ ReleaseObjectGroup with invalid params Running test: testEvaluateSyntaxError { className : SyntaxError - description : SyntaxError: Unexpected token ] at :1:1 + description : SyntaxError: Unexpected token ']' at :1:1 objectId : subtype : error type : object @@ -351,4 +351,4 @@ Running test: testNullExpression message : Invalid parameters } id : -} \ No newline at end of file +} diff --git a/test/inspector/runtime/call-function-on-async-expected.txt b/test/inspector/runtime/call-function-on-async-expected.txt index 930999bb2b..1a64b576c3 100644 --- a/test/inspector/runtime/call-function-on-async-expected.txt +++ b/test/inspector/runtime/call-function-on-async-expected.txt @@ -43,7 +43,7 @@ Running test: testSyntaxErrorInFunction columnNumber : 2 exception : { className : SyntaxError - description : SyntaxError: Unexpected token } + description : SyntaxError: Unexpected token '}' objectId : subtype : error type : object @@ -55,7 +55,7 @@ Running test: testSyntaxErrorInFunction } result : { className : SyntaxError - description : SyntaxError: Unexpected token } + description : SyntaxError: Unexpected token '}' objectId : subtype : error type : object diff --git a/test/inspector/runtime/es6-module-expected.txt b/test/inspector/runtime/es6-module-expected.txt index 25ba52e034..8d8ad5a391 100644 --- a/test/inspector/runtime/es6-module-expected.txt +++ b/test/inspector/runtime/es6-module-expected.txt @@ -206,21 +206,21 @@ console.log(239) columnNumber : 0 exception : { className : SyntaxError - description : SyntaxError: Unexpected token } + description : SyntaxError: Unexpected token '}' objectId : preview : { - description : SyntaxError: Unexpected token } + description : SyntaxError: Unexpected token '}' overflow : false properties : [ [0] : { name : stack type : string - value : SyntaxError: Unexpected token } + value : SyntaxError: Unexpected token '}' } [1] : { name : message type : string - value : Unexpected token } + value : Unexpected token '}' } ] subtype : error @@ -233,7 +233,7 @@ console.log(239) executionContextId : lineNumber : 0 scriptId : - text : Uncaught SyntaxError: Unexpected token } + text : Uncaught SyntaxError: Unexpected token '}' url : module4 } timestamp : diff --git a/test/inspector/runtime/evaluate-async-expected.txt b/test/inspector/runtime/evaluate-async-expected.txt index ea47520ef8..95d2955252 100644 --- a/test/inspector/runtime/evaluate-async-expected.txt +++ b/test/inspector/runtime/evaluate-async-expected.txt @@ -89,7 +89,7 @@ Running test: testRejectedPromiseWithSyntaxError columnNumber : 5 exception : { className : SyntaxError - description : SyntaxError: Unexpected token } at foo (:21:5) at throwSyntaxError (:23:3) + description : SyntaxError: Unexpected token '}' at foo (:21:5) at throwSyntaxError (:23:3) objectId : subtype : error type : object @@ -115,11 +115,11 @@ Running test: testRejectedPromiseWithSyntaxError } ] } - text : Uncaught (in promise) SyntaxError: Unexpected token } + text : Uncaught (in promise) SyntaxError: Unexpected token '}' } result : { className : SyntaxError - description : SyntaxError: Unexpected token } at foo (:21:5) at throwSyntaxError (:23:3) + description : SyntaxError: Unexpected token '}' at foo (:21:5) at throwSyntaxError (:23:3) objectId : subtype : error type : object diff --git a/test/inspector/runtime/exception-thrown-expected.txt b/test/inspector/runtime/exception-thrown-expected.txt index 7c58a0421e..916ed61b68 100644 --- a/test/inspector/runtime/exception-thrown-expected.txt +++ b/test/inspector/runtime/exception-thrown-expected.txt @@ -50,21 +50,21 @@ Check that exceptionThrown is supported by test runner. columnNumber : 1 exception : { className : SyntaxError - description : SyntaxError: Unexpected token } + description : SyntaxError: Unexpected token '}' objectId : preview : { - description : SyntaxError: Unexpected token } + description : SyntaxError: Unexpected token '}' overflow : false properties : [ [0] : { name : stack type : string - value : SyntaxError: Unexpected token } + value : SyntaxError: Unexpected token '}' } [1] : { name : message type : string - value : Unexpected token } + value : Unexpected token '}' } ] subtype : error @@ -77,7 +77,7 @@ Check that exceptionThrown is supported by test runner. executionContextId : lineNumber : 0 scriptId : - text : Uncaught SyntaxError: Unexpected token } + text : Uncaught SyntaxError: Unexpected token '}' } timestamp : } diff --git a/test/inspector/runtime/exceptionthrown-on-connect-expected.txt b/test/inspector/runtime/exceptionthrown-on-connect-expected.txt index 4bcde813fc..976eaa4d4f 100644 --- a/test/inspector/runtime/exceptionthrown-on-connect-expected.txt +++ b/test/inspector/runtime/exceptionthrown-on-connect-expected.txt @@ -7,7 +7,7 @@ Enabling Runtime Domain. columnNumber : 12 exception : { className : SyntaxError - description : SyntaxError: Unexpected token ; + description : SyntaxError: Unexpected token ';' objectId : subtype : error type : object @@ -16,7 +16,7 @@ Enabling Runtime Domain. executionContextId : lineNumber : 1 scriptId : - text : Uncaught SyntaxError: Unexpected token ; + text : Uncaught SyntaxError: Unexpected token ';' url : syntaxError.js } timestamp : diff --git a/test/inspector/runtime/run-script-async-expected.txt b/test/inspector/runtime/run-script-async-expected.txt index 29b9c526dd..8befa1399c 100644 --- a/test/inspector/runtime/run-script-async-expected.txt +++ b/test/inspector/runtime/run-script-async-expected.txt @@ -24,7 +24,7 @@ Running test: testSyntaxErrorInScript columnNumber : 1 exception : { className : SyntaxError - description : SyntaxError: Unexpected token } + description : SyntaxError: Unexpected token '}' objectId : subtype : error type : object @@ -45,7 +45,7 @@ Running test: testSyntaxErrorInEvalInScript columnNumber : 0 exception : { className : SyntaxError - description : SyntaxError: Unexpected token } at boo.js:2:2 + description : SyntaxError: Unexpected token '}' at boo.js:2:2 objectId : subtype : error type : object @@ -68,7 +68,7 @@ Running test: testSyntaxErrorInEvalInScript } result : { className : SyntaxError - description : SyntaxError: Unexpected token } at boo.js:2:2 + description : SyntaxError: Unexpected token '}' at boo.js:2:2 objectId : subtype : error type : object diff --git a/test/message/fail/arrow-bare-rest-param.out b/test/message/fail/arrow-bare-rest-param.out index 76a25a455d..18e5cb825b 100644 --- a/test/message/fail/arrow-bare-rest-param.out +++ b/test/message/fail/arrow-bare-rest-param.out @@ -1,4 +1,4 @@ -*%(basename)s:7: SyntaxError: Unexpected token ... +*%(basename)s:7: SyntaxError: Unexpected token '...' ...x => 10 ^^^ -SyntaxError: Unexpected token ... +SyntaxError: Unexpected token '...' diff --git a/test/message/fail/arrow-missing.out b/test/message/fail/arrow-missing.out index bad6157a0a..1784ada6a5 100644 --- a/test/message/fail/arrow-missing.out +++ b/test/message/fail/arrow-missing.out @@ -1,4 +1,4 @@ -*%(basename)s:7: SyntaxError: Unexpected token ) +*%(basename)s:7: SyntaxError: Unexpected token ')' function foo() { return(); } ^ -SyntaxError: Unexpected token ) +SyntaxError: Unexpected token ')' diff --git a/test/message/fail/class-spread-property.out b/test/message/fail/class-spread-property.out index df15e50262..cfdefc425d 100644 --- a/test/message/fail/class-spread-property.out +++ b/test/message/fail/class-spread-property.out @@ -1,4 +1,4 @@ -*%(basename)s:5: SyntaxError: Unexpected token ... +*%(basename)s:5: SyntaxError: Unexpected token '...' class C { ...[] } ^^^ -SyntaxError: Unexpected token ... \ No newline at end of file +SyntaxError: Unexpected token '...' diff --git a/test/message/fail/formal-parameters-trailing-comma.out b/test/message/fail/formal-parameters-trailing-comma.out index 5c46552628..9f44ea8573 100644 --- a/test/message/fail/formal-parameters-trailing-comma.out +++ b/test/message/fail/formal-parameters-trailing-comma.out @@ -1,4 +1,4 @@ -*%(basename)s:5: SyntaxError: Unexpected token , +*%(basename)s:5: SyntaxError: Unexpected token ',' function foo(b, a, a,,) { return a } ^ -SyntaxError: Unexpected token , +SyntaxError: Unexpected token ',' diff --git a/test/message/fail/invalid-spread.out b/test/message/fail/invalid-spread.out index 5694ad6e88..3710f60317 100644 --- a/test/message/fail/invalid-spread.out +++ b/test/message/fail/invalid-spread.out @@ -1,4 +1,4 @@ -*%(basename)s:7: SyntaxError: Unexpected token ... +*%(basename)s:7: SyntaxError: Unexpected token '...' (x, ...y) ^^^ -SyntaxError: Unexpected token ... +SyntaxError: Unexpected token '...' diff --git a/test/message/fail/modules-export-illformed-class.out b/test/message/fail/modules-export-illformed-class.out index cf26e55134..545e9a8dbc 100644 --- a/test/message/fail/modules-export-illformed-class.out +++ b/test/message/fail/modules-export-illformed-class.out @@ -1,5 +1,5 @@ -*%(basename)s:7: SyntaxError: Unexpected token ] +*%(basename)s:7: SyntaxError: Unexpected token ']' export class foo {[]}; ^ -SyntaxError: Unexpected token ] +SyntaxError: Unexpected token ']' diff --git a/test/message/regress/fail/regress-8409.out b/test/message/regress/fail/regress-8409.out index 3ca7690366..4387259420 100644 --- a/test/message/regress/fail/regress-8409.out +++ b/test/message/regress/fail/regress-8409.out @@ -1,4 +1,4 @@ -*%(basename)s:5: SyntaxError: Unexpected token ) +*%(basename)s:5: SyntaxError: Unexpected token ')' [().x] = 1 ^ -SyntaxError: Unexpected token ) +SyntaxError: Unexpected token ')' diff --git a/test/mjsunit/regress/regress-797581.js b/test/mjsunit/regress/regress-797581.js index 3dfad4c463..0613d1cd43 100644 --- a/test/mjsunit/regress/regress-797581.js +++ b/test/mjsunit/regress/regress-797581.js @@ -21,7 +21,7 @@ function TryToLoadModule(filename, expect_error, token) { if (expect_error) { assertTrue(caught_error instanceof SyntaxError); - assertEquals("Unexpected token " + token, caught_error.message); + assertEquals("Unexpected token '" + token + "'", caught_error.message); } else { assertEquals(undefined, caught_error); } diff --git a/test/webkit/class-syntax-declaration-expected.txt b/test/webkit/class-syntax-declaration-expected.txt index c198f26914..4a9e60978a 100644 --- a/test/webkit/class-syntax-declaration-expected.txt +++ b/test/webkit/class-syntax-declaration-expected.txt @@ -16,10 +16,10 @@ PASS setterValue = undefined; (new A).someSetter = 789; setterValue is 789 PASS (new A).__proto__ is A.prototype PASS A.prototype.constructor is A PASS class threw exception SyntaxError: Unexpected end of input. -PASS class [ threw exception SyntaxError: Unexpected token [. -PASS class { threw exception SyntaxError: Unexpected token {. +PASS class [ threw exception SyntaxError: Unexpected token '['. +PASS class { threw exception SyntaxError: Unexpected token '{'. PASS class X { threw exception SyntaxError: Unexpected end of input. -PASS class X { ( } threw exception SyntaxError: Unexpected token (. +PASS class X { ( } threw exception SyntaxError: Unexpected token '('. PASS class X {} did not throw exception. PASS class X { constructor() {} constructor() {} } threw exception SyntaxError: A class may only have one constructor. PASS class X { get constructor() {} } threw exception SyntaxError: Class constructor may not be an accessor. diff --git a/test/webkit/class-syntax-declaration.js b/test/webkit/class-syntax-declaration.js index bc6c31d312..dcefccac87 100644 --- a/test/webkit/class-syntax-declaration.js +++ b/test/webkit/class-syntax-declaration.js @@ -52,10 +52,10 @@ shouldBe("(new A).__proto__", "A.prototype"); shouldBe("A.prototype.constructor", "A"); shouldThrow("class", "'SyntaxError: Unexpected end of input'"); -shouldThrow("class [", "'SyntaxError: Unexpected token ['"); -shouldThrow("class {", "'SyntaxError: Unexpected token {'"); +shouldThrow("class [", '"SyntaxError: Unexpected token \'[\'"'); +shouldThrow("class {", '"SyntaxError: Unexpected token \'{\'"'); shouldThrow("class X {", "'SyntaxError: Unexpected end of input'"); -shouldThrow("class X { ( }", "'SyntaxError: Unexpected token ('"); +shouldThrow("class X { ( }", '"SyntaxError: Unexpected token \'(\'"'); shouldNotThrow("class X {}"); shouldThrow("class X { constructor() {} constructor() {} }", "'SyntaxError: A class may only have one constructor'"); diff --git a/test/webkit/class-syntax-expression-expected.txt b/test/webkit/class-syntax-expression-expected.txt index acda6272f0..9d51576bdd 100644 --- a/test/webkit/class-syntax-expression-expected.txt +++ b/test/webkit/class-syntax-expression-expected.txt @@ -17,7 +17,7 @@ PASS (new A).__proto__ is A.prototype PASS A.prototype.constructor is A PASS x = class threw exception SyntaxError: Unexpected end of input. PASS x = class { threw exception SyntaxError: Unexpected end of input. -PASS x = class { ( } threw exception SyntaxError: Unexpected token (. +PASS x = class { ( } threw exception SyntaxError: Unexpected token '('. PASS x = class {} did not throw exception. PASS x = class { constructor() {} constructor() {} } threw exception SyntaxError: A class may only have one constructor. PASS x = class { get constructor() {} } threw exception SyntaxError: Class constructor may not be an accessor. diff --git a/test/webkit/class-syntax-expression.js b/test/webkit/class-syntax-expression.js index 0cea5d70e4..e57ac72555 100644 --- a/test/webkit/class-syntax-expression.js +++ b/test/webkit/class-syntax-expression.js @@ -53,7 +53,7 @@ shouldBe("A.prototype.constructor", "A"); shouldThrow("x = class", "'SyntaxError: Unexpected end of input'"); shouldThrow("x = class {", "'SyntaxError: Unexpected end of input'"); -shouldThrow("x = class { ( }", "'SyntaxError: Unexpected token ('"); +shouldThrow("x = class { ( }", '"SyntaxError: Unexpected token \'(\'"'); shouldNotThrow("x = class {}"); shouldThrow("x = class { constructor() {} constructor() {} }", "'SyntaxError: A class may only have one constructor'"); diff --git a/test/webkit/class-syntax-extends-expected.txt b/test/webkit/class-syntax-extends-expected.txt index 73ac66fa97..8f4b0323ac 100644 --- a/test/webkit/class-syntax-extends-expected.txt +++ b/test/webkit/class-syntax-extends-expected.txt @@ -30,8 +30,8 @@ PASS x = class extends baseWithBadPrototype { constructor() { } } threw exceptio PASS baseWithBadPrototype.prototype = "abc" did not throw exception. PASS x = class extends baseWithBadPrototype { constructor() { } } threw exception TypeError: Class extends value does not have valid prototype property abc. PASS baseWithBadPrototype.prototype = null; x = class extends baseWithBadPrototype { constructor() { } } did not throw exception. -PASS x = 1; c = class extends ++x { constructor() { } }; threw exception SyntaxError: Unexpected token ++. -PASS x = 1; c = class extends x++ { constructor() { } }; threw exception SyntaxError: Unexpected token ++. +PASS x = 1; c = class extends ++x { constructor() { } }; threw exception SyntaxError: Unexpected token '++'. +PASS x = 1; c = class extends x++ { constructor() { } }; threw exception SyntaxError: Unexpected token '++'. PASS x = 1; c = class extends (++x) { constructor() { } }; threw exception TypeError: Class extends value 2 is not a constructor or null. PASS x = 1; c = class extends (x++) { constructor() { } }; threw exception TypeError: Class extends value 1 is not a constructor or null. PASS x = 1; try { c = class extends (++x) { constructor() { } } } catch (e) { }; x is 2 @@ -45,7 +45,7 @@ PASS namespace = {}; namespace.A = class { constructor() { } }; namespace.B = cl PASS namespace = {}; namespace.A = class { constructor() { } }; function getClassA() { return namespace.A }; namespace.B = class extends getClassA() { constructor() { } } did not throw exception. PASS namespace = {}; namespace.A = class { constructor() { } }; function getClass(prop) { return namespace[prop] }; namespace.B = class extends getClass("A") { constructor() { } } did not throw exception. PASS namespace = {}; namespace.A = class { constructor() { } }; namespace.B = class extends (false||null||namespace.A) { constructor() { } } did not throw exception. -PASS namespace = {}; namespace.A = class { constructor() { } }; namespace.B = class extends false||null||namespace.A { constructor() { } } threw exception SyntaxError: Unexpected token ||. +PASS namespace = {}; namespace.A = class { constructor() { } }; namespace.B = class extends false||null||namespace.A { constructor() { } } threw exception SyntaxError: Unexpected token '||'. PASS x = 1; namespace = {}; namespace.A = class { constructor() { } }; namespace.B = class extends (x++, namespace.A) { constructor() { } }; did not throw exception. PASS x = 1; namespace = {}; namespace.A = class { constructor() { } }; namespace.B = class extends (namespace.A, x++) { constructor() { } }; threw exception TypeError: Class extends value 1 is not a constructor or null. PASS namespace = {}; namespace.A = class { constructor() { } }; namespace.B = class extends new namespace.A { constructor() { } } threw exception TypeError: Class extends value [object Object] is not a constructor or null. diff --git a/test/webkit/class-syntax-name-expected.txt b/test/webkit/class-syntax-name-expected.txt index 27ae3088c2..dce382b0af 100644 --- a/test/webkit/class-syntax-name-expected.txt +++ b/test/webkit/class-syntax-name-expected.txt @@ -6,10 +6,10 @@ On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE Class statement PASS A threw exception ReferenceError: A is not defined. PASS 'use strict'; A threw exception ReferenceError: A is not defined. -PASS class {} threw exception SyntaxError: Unexpected token {. -PASS 'use strict'; class {} threw exception SyntaxError: Unexpected token {. -PASS class { constructor() {} } threw exception SyntaxError: Unexpected token {. -PASS 'use strict'; class { constructor() {} } threw exception SyntaxError: Unexpected token {. +PASS class {} threw exception SyntaxError: Unexpected token '{'. +PASS 'use strict'; class {} threw exception SyntaxError: Unexpected token '{'. +PASS class { constructor() {} } threw exception SyntaxError: Unexpected token '{'. +PASS 'use strict'; class { constructor() {} } threw exception SyntaxError: Unexpected token '{'. PASS class A { constructor() {} } did not throw exception. PASS 'use strict'; class A { constructor() {} } did not throw exception. PASS class A { constructor() {} }; A.toString() is 'class A { constructor() {} }' diff --git a/test/webkit/class-syntax-semicolon-expected.txt b/test/webkit/class-syntax-semicolon-expected.txt index c45eabac9c..4611bf7cae 100644 --- a/test/webkit/class-syntax-semicolon-expected.txt +++ b/test/webkit/class-syntax-semicolon-expected.txt @@ -3,11 +3,11 @@ Tests for ES6 class syntax containing semicolon in the class body On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE". -PASS class A { foo() ; { } } threw exception SyntaxError: Unexpected token ;. -PASS class A { get foo;() { } } threw exception SyntaxError: Unexpected token ;. -PASS class A { get foo() ; { } } threw exception SyntaxError: Unexpected token ;. -PASS class A { set foo;(x) { } } threw exception SyntaxError: Unexpected token ;. -PASS class A { set foo(x) ; { } } threw exception SyntaxError: Unexpected token ;. +PASS class A { foo() ; { } } threw exception SyntaxError: Unexpected token ';'. +PASS class A { get foo;() { } } threw exception SyntaxError: Unexpected token ';'. +PASS class A { get foo() ; { } } threw exception SyntaxError: Unexpected token ';'. +PASS class A { set foo;(x) { } } threw exception SyntaxError: Unexpected token ';'. +PASS class A { set foo(x) ; { } } threw exception SyntaxError: Unexpected token ';'. PASS class A { ; } did not throw exception. PASS class A { foo() { } ; } did not throw exception. PASS class A { get foo() { } ; } did not throw exception. diff --git a/test/webkit/class-syntax-semicolon.js b/test/webkit/class-syntax-semicolon.js index 88609dcbc7..9daeddb9c0 100644 --- a/test/webkit/class-syntax-semicolon.js +++ b/test/webkit/class-syntax-semicolon.js @@ -23,11 +23,11 @@ description('Tests for ES6 class syntax containing semicolon in the class body'); -shouldThrow("class A { foo() ; { } }", "'SyntaxError: Unexpected token ;'"); -shouldThrow("class A { get foo;() { } }", "'SyntaxError: Unexpected token ;'"); -shouldThrow("class A { get foo() ; { } }", "'SyntaxError: Unexpected token ;'"); -shouldThrow("class A { set foo;(x) { } }", "'SyntaxError: Unexpected token ;'"); -shouldThrow("class A { set foo(x) ; { } }", "'SyntaxError: Unexpected token ;'"); +shouldThrow("class A { foo() ; { } }", '"SyntaxError: Unexpected token \';\'"'); +shouldThrow("class A { get foo;() { } }", '"SyntaxError: Unexpected token \';\'"'); +shouldThrow("class A { get foo() ; { } }", '"SyntaxError: Unexpected token \';\'"'); +shouldThrow("class A { set foo;(x) { } }", '"SyntaxError: Unexpected token \';\'"'); +shouldThrow("class A { set foo(x) ; { } }", '"SyntaxError: Unexpected token \';\'"'); shouldNotThrow("class A { ; }"); shouldNotThrow("class A { foo() { } ; }"); diff --git a/test/webkit/fast/js/function-constructor-error-expected.txt b/test/webkit/fast/js/function-constructor-error-expected.txt index e42d01e650..e7897b098b 100644 --- a/test/webkit/fast/js/function-constructor-error-expected.txt +++ b/test/webkit/fast/js/function-constructor-error-expected.txt @@ -26,8 +26,8 @@ This test checks that the Function constructor detects some syntax errors correc On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE". -FAIL Function('(i + (j)') should throw SyntaxError: Expected token ')'. Threw exception SyntaxError: Unexpected token }. -FAIL Function('return (i + (j)') should throw SyntaxError: Expected token ')'. Threw exception SyntaxError: Unexpected token }. +FAIL Function('(i + (j)') should throw SyntaxError: Expected token ')'. Threw exception SyntaxError: Unexpected token '}'. +FAIL Function('return (i + (j)') should throw SyntaxError: Expected token ')'. Threw exception SyntaxError: Unexpected token '}'. PASS successfullyParsed is true TEST COMPLETE diff --git a/test/webkit/fast/js/object-extra-comma-expected.txt b/test/webkit/fast/js/object-extra-comma-expected.txt index 22511af833..87041c37a2 100644 --- a/test/webkit/fast/js/object-extra-comma-expected.txt +++ b/test/webkit/fast/js/object-extra-comma-expected.txt @@ -29,8 +29,8 @@ On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE PASS var foo = { 'bar' : 'YES' }; foo.bar is 'YES' PASS var foo = { 'bar' : 'YES', }; foo.bar is 'YES' PASS var foo = { 'bar' : 'YES' , }; foo.bar is 'YES' -PASS var foo = { , 'bar' : 'YES' }; foo.bar threw exception SyntaxError: Unexpected token ,. -PASS var foo = { 'bar' : 'YES',, }; foo.bar threw exception SyntaxError: Unexpected token ,. +PASS var foo = { , 'bar' : 'YES' }; foo.bar threw exception SyntaxError: Unexpected token ','. +PASS var foo = { 'bar' : 'YES',, }; foo.bar threw exception SyntaxError: Unexpected token ','. PASS successfullyParsed is true TEST COMPLETE diff --git a/test/webkit/function-toString-object-literals-expected.txt b/test/webkit/function-toString-object-literals-expected.txt index 1b37162a34..410e5ce151 100644 --- a/test/webkit/function-toString-object-literals-expected.txt +++ b/test/webkit/function-toString-object-literals-expected.txt @@ -42,11 +42,11 @@ PASS compileAndSerialize('a = { "\'": null }') is 'a = { "\'": null }' PASS compileAndSerialize('a = { "\\"": null }') is 'a = { "\\"": null }' PASS compileAndSerialize('a = { get x() { } }') is 'a = { get x() { } }' PASS compileAndSerialize('a = { set x(y) { } }') is 'a = { set x(y) { } }' -PASS compileAndSerialize('a = { --1: null }') threw exception SyntaxError: Unexpected token --. -PASS compileAndSerialize('a = { -NaN: null }') threw exception SyntaxError: Unexpected token -. -PASS compileAndSerialize('a = { -0: null }') threw exception SyntaxError: Unexpected token -. -PASS compileAndSerialize('a = { -0.0: null }') threw exception SyntaxError: Unexpected token -. -PASS compileAndSerialize('a = { -Infinity: null }') threw exception SyntaxError: Unexpected token -. +PASS compileAndSerialize('a = { --1: null }') threw exception SyntaxError: Unexpected token '--'. +PASS compileAndSerialize('a = { -NaN: null }') threw exception SyntaxError: Unexpected token '-'. +PASS compileAndSerialize('a = { -0: null }') threw exception SyntaxError: Unexpected token '-'. +PASS compileAndSerialize('a = { -0.0: null }') threw exception SyntaxError: Unexpected token '-'. +PASS compileAndSerialize('a = { -Infinity: null }') threw exception SyntaxError: Unexpected token '-'. PASS successfullyParsed is true TEST COMPLETE