diff options
author | Linus Groh <mail@linusgroh.de> | 2021-03-15 22:08:28 +0100 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2021-03-15 22:43:27 +0100 |
commit | d6239b691ffc07f424c237f866859a8172186a44 (patch) | |
tree | fe8b54e4609b2bc9a7ce48c6d3b624c031ed3caa /Userland/Libraries/LibJS/Tests/eval-basic.js | |
parent | 01a49dda85c6f6e14f65cf9bab03f896d74755ed (diff) | |
download | serenity-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.js | 9 |
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)" + ); +}); |