Skip to content

Commit b23c49d

Browse files
committed
testing: add tests for explicit licensePattern option
1 parent eed7dde commit b23c49d

File tree

2 files changed

+57
-0
lines changed

2 files changed

+57
-0
lines changed

README.md

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3249,6 +3249,17 @@ function quux (foo) {
32493249
}
32503250
// Message: Invalid JSDoc @license: "(MIT OR GPL-2.5)"; expected SPDX expression: https://spdx.org/licenses/.
32513251

3252+
/**
3253+
* @license MIT
3254+
* Some extra text
3255+
*/
3256+
function quux (foo) {
3257+
3258+
}
3259+
// Options: [{"licensePattern":"[\\s\\S]*"}]
3260+
// Message: Invalid JSDoc @license: "MIT
3261+
Some extra text"; expected SPDX expression: https://spdx.org/licenses/.
3262+
32523263
/**
32533264
* @author
32543265
*/
@@ -3322,6 +3333,15 @@ function quux (foo) {
33223333
}
33233334
// Options: [{"allowedLicenses":true}]
33243335
3336+
/**
3337+
* @license MIT
3338+
* Some extra text
3339+
*/
3340+
function quux (foo) {
3341+
3342+
}
3343+
// Options: [{"licensePattern":"[^\n]*"}]
3344+
33253345
/**
33263346
* @author Gajus Kuizinas
33273347
*/

test/rules/assertions/checkValues.js

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -148,6 +148,27 @@ export default {
148148
},
149149
],
150150
},
151+
{
152+
code: `
153+
/**
154+
* @license MIT
155+
* Some extra text
156+
*/
157+
function quux (foo) {
158+
159+
}
160+
`,
161+
errors: [
162+
{
163+
message: 'Invalid JSDoc @license: "MIT\nSome extra text"; expected SPDX expression: https://spdx.org/licenses/.',
164+
},
165+
],
166+
options: [
167+
{
168+
licensePattern: '[\\s\\S]*',
169+
},
170+
],
171+
},
151172
{
152173
code: `
153174
/**
@@ -268,6 +289,22 @@ export default {
268289
},
269290
],
270291
},
292+
{
293+
code: `
294+
/**
295+
* @license MIT
296+
* Some extra text
297+
*/
298+
function quux (foo) {
299+
300+
}
301+
`,
302+
options: [
303+
{
304+
licensePattern: '[^\n]*',
305+
},
306+
],
307+
},
271308
{
272309
code: `
273310
/**

0 commit comments

Comments
 (0)