2020-07-05 17:26:26 -07:00
|
|
|
test("basic functionality", () => {
|
2020-07-06 07:37:45 -07:00
|
|
|
expect(void "").toBeUndefined();
|
|
|
|
|
expect(void "foo").toBeUndefined();
|
|
|
|
|
expect(void 1).toBeUndefined();
|
|
|
|
|
expect(void 42).toBeUndefined();
|
|
|
|
|
expect(void true).toBeUndefined();
|
|
|
|
|
expect(void false).toBeUndefined();
|
|
|
|
|
expect(void null).toBeUndefined();
|
|
|
|
|
expect(void undefined).toBeUndefined();
|
|
|
|
|
expect(void function () {}).toBeUndefined();
|
|
|
|
|
expect(void (() => {})).toBeUndefined();
|
|
|
|
|
expect(void (() => "hello friends")()).toBeUndefined();
|
|
|
|
|
expect((() => void "hello friends")()).toBeUndefined();
|
2020-07-05 17:26:26 -07:00
|
|
|
});
|
2021-12-19 02:28:18 +01:00
|
|
|
|
|
|
|
|
describe("errors", () => {
|
|
|
|
|
test("treats yield in generator as non variable", () => {
|
|
|
|
|
expect("function f() { void yield; }").toEval();
|
|
|
|
|
expect("async function f() { void yield; }").toEval();
|
|
|
|
|
expect("function *f() { void yield; }").not.toEval();
|
|
|
|
|
expect("async function *f() { void yield; }").not.toEval();
|
|
|
|
|
|
|
|
|
|
expect("class C { *f() { void yield; } }").not.toEval();
|
|
|
|
|
expect("var obj = { async function *f() { void yield; } }").not.toEval();
|
|
|
|
|
});
|
|
|
|
|
});
|