mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-08-02 14:19:48 +00:00
LibJS: Throw SyntaxError in eval() when parser has error(s)
This commit is contained in:
parent
01a49dda85
commit
d6239b691f
Notes:
sideshowbarker
2024-07-18 21:19:08 +09:00
Author: https://github.com/linusg
Commit: d6239b691f
Pull-request: https://github.com/SerenityOS/serenity/pull/5811
2 changed files with 15 additions and 0 deletions
|
@ -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)"
|
||||
);
|
||||
});
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue