Serenity Operating System
at master 26 lines 1.1 kB view raw
1test("basic functionality", () => { 2 expect(void "").toBeUndefined(); 3 expect(void "foo").toBeUndefined(); 4 expect(void 1).toBeUndefined(); 5 expect(void 42).toBeUndefined(); 6 expect(void true).toBeUndefined(); 7 expect(void false).toBeUndefined(); 8 expect(void null).toBeUndefined(); 9 expect(void undefined).toBeUndefined(); 10 expect(void function () {}).toBeUndefined(); 11 expect(void (() => {})).toBeUndefined(); 12 expect(void (() => "hello friends")()).toBeUndefined(); 13 expect((() => void "hello friends")()).toBeUndefined(); 14}); 15 16describe("errors", () => { 17 test("treats yield in generator as non variable", () => { 18 expect("function f() { void yield; }").toEval(); 19 expect("async function f() { void yield; }").toEval(); 20 expect("function *f() { void yield; }").not.toEval(); 21 expect("async function *f() { void yield; }").not.toEval(); 22 23 expect("class C { *f() { void yield; } }").not.toEval(); 24 expect("var obj = { async function *f() { void yield; } }").not.toEval(); 25 }); 26});