1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 22:37:35 +00:00

LibJS: Make the Function() constructor throw a SyntaxError, not return

This commit is contained in:
Linus Groh 2020-05-13 01:09:49 +01:00 committed by Andreas Kling
parent aab998e776
commit 7b8765c311
2 changed files with 8 additions and 1 deletions

View file

@ -26,6 +26,12 @@ try {
assert(new Function().name === "anonymous");
assert(new Function().toString() === "function anonymous() {\n ???\n}");
assertThrowsError(() => {
new Function("[");
}, {
error: SyntaxError
});
console.log("PASS");
} catch (e) {
console.log("FAIL: " + e.message);