Something went wrong. Try again.
[READ-ONLY] Mirror of https://github.com/samualtnorman/js-interpreter.
Something went wrong. Try again.
123456789101112131415161718192021222324252627282930313233343536373839404142434445test("regular comments", () => { const source = `var i = 0;// i++;/* i++; *//*i++;*//**/ i++;i;`;
expect(source).toEvalTo(1);});
test("html comments", () => { const source = `var i = 0;var j = 0;<!-- i++; --> i++;<!-- i++;i++;--> i++;/**/ --> i++;j --> i++;i;`; expect(source).toEvalTo(2);});
test("unterminated multi-line comment", () => { expect("/*").not.toEval(); expect("/**").not.toEval(); expect("/*/").not.toEval(); expect("/* foo").not.toEval(); expect("foo /*").not.toEval();});
test("hashbang comments", () => { expect("#!").toEvalTo(undefined); expect("#!/bin/js").toEvalTo(undefined); expect("#!\n1").toEvalTo(1); expect(" #!").not.toEval(); expect("\n#!").not.toEval(); expect("#!\n#!").not.toEval();});