1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 10:48:11 +00:00

LibJS: Force the lexer to parse a regex when expecting a statement

This commit is contained in:
davidot 2021-07-29 23:28:28 +02:00 committed by Linus Groh
parent 05444103e3
commit 106f9e30d7
4 changed files with 103 additions and 21 deletions

View file

@ -3,4 +3,22 @@ test("slash token resolution in lexer", () => {
expect("``/foo/").not.toEval();
expect("1/foo/").not.toEval();
expect("1/foo").toEval();
expect("{} /foo/").toEval();
expect("{} /=/").toEval();
expect("{} /=a/").toEval();
expect("{} /* */ /=a/").toEval();
expect("{} /* /a/ */ /=a/").toEval();
expect("(function () {} / 1)").toEval();
expect("(function () {} / 1)").toEval();
expect("+a++ / 1").toEval();
expect("+a-- / 1").toEval();
expect("a.in / b").toEval();
expect("a.instanceof / b").toEval();
// FIXME: Even more 'reserved' words are valid however the cases below do still need to pass.
//expect("a.void / b").toEval();
expect("void / b/").toEval();
});