2021-07-02 14:46:58 +04:30
|
|
|
test("slash token resolution in lexer", () => {
|
|
|
|
expect(`{ blah.blah; }\n/foo/`).toEval();
|
|
|
|
expect("``/foo/").not.toEval();
|
|
|
|
expect("1/foo/").not.toEval();
|
|
|
|
expect("1/foo").toEval();
|
2021-07-29 23:28:28 +02:00
|
|
|
|
|
|
|
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();
|
2021-11-26 21:10:24 +01:00
|
|
|
expect("class A { #name; d = a.#name / b; }").toEval();
|
2021-07-29 23:28:28 +02:00
|
|
|
|
|
|
|
// 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();
|
2021-07-02 14:46:58 +04:30
|
|
|
});
|