mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-01-25 18:52:22 -05:00
69845ae460
B.1.3 HTML-like Comments The syntax and semantics of 11.4 is extended as follows except that this extension is not allowed when parsing source code using the goal symbol Module: Syntax (only relevant part included) SingleLineHTMLCloseComment :: LineTerminatorSequence HTMLCloseComment HTMLCloseComment :: WhiteSpaceSequence[opt] SingleLineDelimitedCommentSequence[opt] --> SingleLineCommentChars[opt] Fixes #3810.
35 lines
562 B
JavaScript
35 lines
562 B
JavaScript
test("regular comments", () => {
|
|
const source = `
|
|
var i = 0;
|
|
// i++;
|
|
/* i++; */
|
|
/*
|
|
i++;
|
|
*/
|
|
/**/ i++;
|
|
return i;`;
|
|
|
|
expect(source).toEvalTo(1);
|
|
});
|
|
|
|
test("html comments", () => {
|
|
const source = `
|
|
var i = 0;
|
|
var j = 0;
|
|
<!-- i++; --> i++;
|
|
<!-- i++;
|
|
i++;
|
|
--> i++;
|
|
/**/ --> i++;
|
|
j --> i++;
|
|
return 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();
|
|
});
|