Skip to content

Commit

Permalink
Update unit tests for no-warning-comments
Browse files Browse the repository at this point in the history
  • Loading branch information
lachlanhunt committed Aug 7, 2022
1 parent f1432ae commit f6d40f1
Showing 1 changed file with 67 additions and 1 deletion.
68 changes: 67 additions & 1 deletion tests/lib/rules/no-warning-comments.js
Expand Up @@ -37,7 +37,8 @@ ruleTester.run("no-warning-comments", rule, {
{ code: "// special regex characters don't cause a problem", options: [{ terms: ["[aeiou]"], location: "anywhere" }] },
"/*eslint no-warning-comments: [2, { \"terms\": [\"todo\", \"fixme\", \"any other term\"], \"location\": \"anywhere\" }]*/\n\nvar x = 10;\n",
{ code: "/*eslint no-warning-comments: [2, { \"terms\": [\"todo\", \"fixme\", \"any other term\"], \"location\": \"anywhere\" }]*/\n\nvar x = 10;\n", options: [{ location: "anywhere" }] },
{ code: "// foo", options: [{ terms: ["foo-bar"] }] }
{ code: "// foo", options: [{ terms: ["foo-bar"] }] },
"/** multi-line block comment with lines starting with\nTODO\nFIXME or\nXXX\n*/"
],
invalid: [
{
Expand Down Expand Up @@ -387,6 +388,71 @@ ruleTester.run("no-warning-comments", rule, {
}
}
]
},
{
code: "/*\nTODO undecorated multi-line block comment (start)\n*/",
options: [{ terms: ["todo"], location: "start" }],
errors: [
{
messageId: "unexpectedComment",
data: {
matchedTerm: "todo",
comment: "TODO undecorated multi-line block..."
}
}
]
},
{
code: "/** TODO decorated single line block comment (start) */",
options: [{ terms: ["todo"], location: "start", decoration: "*" }],
errors: [
{
messageId: "unexpectedComment",
data: {
matchedTerm: "todo",
comment: "* TODO decorated single line block..."
}
}
]
},
{
code: "/**\n * TODO decorated multi-line block comment (start) \n */",
options: [{ terms: ["todo"], location: "start", decoration: "*" }],
errors: [
{
messageId: "unexpectedComment",
data: {
matchedTerm: "todo",
comment: "* * TODO decorated multi-line block..."
}
}
]
},
{
code: "///// TODO decorated single-line comment (start) \n /////",
options: [{ terms: ["todo"], location: "start", decoration: "*/" }],
errors: [
{
messageId: "unexpectedComment",
data: {
matchedTerm: "todo",
comment: "/// TODO decorated single-line comment..."
}
}
]
},
{
code: "///*/*/ TODO decorated single-line comment with multiple decoration characters (start) \n /////",
options: [{ terms: ["todo"], location: "start", decoration: "*/" }],
errors: [
{
messageId: "unexpectedComment",
data: {
matchedTerm: "todo",
comment: "/*/*/ TODO decorated single-line comment..."
}
}
]
}
]
});

0 comments on commit f6d40f1

Please sign in to comment.