Update definition of helpers.isBlankLine to treat unterminated start/end comments as potentially blank lines (fixes #431).

This commit is contained in:
David Anson 2021-12-20 04:18:45 +00:00 committed by GitHub
parent 1b23976aa2
commit 6dea67825a
4 changed files with 67 additions and 11 deletions

View file

@ -226,7 +226,7 @@ bar`
});
test("isBlankLine", (t) => {
t.plan(25);
t.plan(29);
const blankLines = [
null,
"",
@ -244,7 +244,11 @@ test("isBlankLine", (t) => {
"> ",
"> > > \t",
"> <!--text-->",
">><!--text-->"
">><!--text-->",
"<!--",
" <!-- text",
"text --> ",
"-->"
];
blankLines.forEach((line) => t.true(helpers.isBlankLine(line), line || ""));
const nonBlankLines = [
@ -253,9 +257,9 @@ test("isBlankLine", (t) => {
".",
"> .",
"<!--text--> text",
"<!--->",
"<!--",
"-->"
"text <!--text-->",
"text <!--",
"--> text"
];
nonBlankLines.forEach((line) => t.true(!helpers.isBlankLine(line), line));
});