diff options
author | Matthew Olsson <matthewcolsson@gmail.com> | 2020-05-28 22:50:06 -0700 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2020-06-01 13:11:21 +0200 |
commit | ab576e610cb98c6e0ece8d4b8f81189468a1044c (patch) | |
tree | 9292bb3cafcb76d2c1b53016882390276c75a40e /Libraries/LibJS/Tests/object-basic.js | |
parent | 05b7fec5174e5bb547d4a82bb349546f921ca3b7 (diff) | |
download | serenity-ab576e610cb98c6e0ece8d4b8f81189468a1044c.zip |
LibJS: Rewrite Parser.parse_object_expression()
This rewrite drastically increases the accuracy of object literals.
Additionally, an "assertIsSyntaxError" function has been added to
test-common.js to assist in testing syntax errors.
Diffstat (limited to 'Libraries/LibJS/Tests/object-basic.js')
-rw-r--r-- | Libraries/LibJS/Tests/object-basic.js | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/Libraries/LibJS/Tests/object-basic.js b/Libraries/LibJS/Tests/object-basic.js index beebed1f35..d8dfcce02f 100644 --- a/Libraries/LibJS/Tests/object-basic.js +++ b/Libraries/LibJS/Tests/object-basic.js @@ -66,6 +66,17 @@ try { assert(a[2] === 3); assert(o4.test === undefined); + assertIsSyntaxError("({ get ...foo })"); + assertIsSyntaxError("({ get... foo })"); + assertIsSyntaxError("({ get foo })"); + assertIsSyntaxError("({ get foo: bar })"); + assertIsSyntaxError("({ get [foo]: bar })"); + assertIsSyntaxError("({ get ...[foo] })"); + assertIsSyntaxError("({ get foo(bar) {} })"); + assertIsSyntaxError("({ set foo() {} })"); + assertIsSyntaxError("({ set foo(bar, baz) {} })"); + assertIsSyntaxError("({ ...foo: bar })"); + console.log("PASS"); } catch (e) { console.log("FAIL: " + e); |