summaryrefslogtreecommitdiff
path: root/Userland/Libraries/LibJS/Tests/eval-basic.js
diff options
context:
space:
mode:
authorLinus Groh <mail@linusgroh.de>2021-03-15 22:08:28 +0100
committerAndreas Kling <kling@serenityos.org>2021-03-15 22:43:27 +0100
commitd6239b691ffc07f424c237f866859a8172186a44 (patch)
treefe8b54e4609b2bc9a7ce48c6d3b624c031ed3caa /Userland/Libraries/LibJS/Tests/eval-basic.js
parent01a49dda85c6f6e14f65cf9bab03f896d74755ed (diff)
downloadserenity-d6239b691ffc07f424c237f866859a8172186a44.zip
LibJS: Throw SyntaxError in eval() when parser has error(s)
Diffstat (limited to 'Userland/Libraries/LibJS/Tests/eval-basic.js')
-rw-r--r--Userland/Libraries/LibJS/Tests/eval-basic.js9
1 files changed, 9 insertions, 0 deletions
diff --git a/Userland/Libraries/LibJS/Tests/eval-basic.js b/Userland/Libraries/LibJS/Tests/eval-basic.js
index 955e86dc22..e00c7fcbd9 100644
--- a/Userland/Libraries/LibJS/Tests/eval-basic.js
+++ b/Userland/Libraries/LibJS/Tests/eval-basic.js
@@ -8,3 +8,12 @@ test("basic eval() functionality", () => {
}
expect(foo(7)).toBe(12);
});
+
+test("syntax error", () => {
+ expect(() => {
+ eval("{");
+ }).toThrowWithMessage(
+ SyntaxError,
+ "Unexpected token Eof. Expected CurlyClose (line: 1, column: 2)"
+ );
+});