diff options
author | Linus Groh <mail@linusgroh.de> | 2020-10-29 17:55:24 +0000 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2020-10-29 22:28:15 +0100 |
commit | 69845ae460d2cd70a256ddca83fbe9a57f1e5b65 (patch) | |
tree | 860069cf67ea7f639177e8b2c44bbc1dd9dc05b3 /Libraries/LibJS/Tests | |
parent | a10d09fababffb1049b342957d79883705257013 (diff) | |
download | serenity-69845ae460d2cd70a256ddca83fbe9a57f1e5b65.zip |
LibJS: "-->" preceded by token on same line isn't start of HTML-like comment
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.
Diffstat (limited to 'Libraries/LibJS/Tests')
-rw-r--r-- | Libraries/LibJS/Tests/comments-basic.js | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/Libraries/LibJS/Tests/comments-basic.js b/Libraries/LibJS/Tests/comments-basic.js index f013d59f70..3dbe6aec1e 100644 --- a/Libraries/LibJS/Tests/comments-basic.js +++ b/Libraries/LibJS/Tests/comments-basic.js @@ -1,25 +1,29 @@ test("regular comments", () => { - const source = `var i = 0; - + const source = ` +var i = 0; // i++; /* i++; */ /* i++; */ +/**/ i++; return i;`; - expect(source).toEvalTo(0); + expect(source).toEvalTo(1); }); test("html comments", () => { - const source = `var i = 0; + const source = ` +var i = 0; +var j = 0; <!-- i++; --> i++; <!-- i++; i++; --> i++; +/**/ --> i++; +j --> i++; return i;`; - - expect(source).toEvalTo(1); + expect(source).toEvalTo(2); }); test("unterminated multi-line comment", () => { |