]>
Commit | Line | Data |
---|---|---|
eb39fafa DC |
1 | /** |
2 | * @fileoverview Tests for no-irregular-whitespace rule. | |
3 | * @author Jonathan Kingston | |
4 | */ | |
5 | ||
6 | "use strict"; | |
7 | ||
8 | //------------------------------------------------------------------------------ | |
9 | // Requirements | |
10 | //------------------------------------------------------------------------------ | |
11 | ||
12 | const rule = require("../../../lib/rules/no-irregular-whitespace"), | |
13 | { RuleTester } = require("../../../lib/rule-tester"); | |
14 | ||
15 | //------------------------------------------------------------------------------ | |
16 | // Tests | |
17 | //------------------------------------------------------------------------------ | |
18 | ||
19 | const ruleTester = new RuleTester(); | |
20 | ||
21 | const expectedErrors = [{ | |
22 | messageId: "noIrregularWhitespace", | |
23 | type: "Program" | |
24 | }]; | |
25 | const expectedCommentErrors = [{ | |
26 | messageId: "noIrregularWhitespace", | |
27 | type: "Program", | |
28 | line: 1, | |
29 | column: 4 | |
30 | }]; | |
31 | ||
32 | ruleTester.run("no-irregular-whitespace", rule, { | |
33 | valid: [ | |
34 | "'\\u000B';", | |
35 | "'\\u000C';", | |
36 | "'\\u0085';", | |
37 | "'\\u00A0';", | |
38 | "'\\u180E';", | |
39 | "'\\ufeff';", | |
40 | "'\\u2000';", | |
41 | "'\\u2001';", | |
42 | "'\\u2002';", | |
43 | "'\\u2003';", | |
44 | "'\\u2004';", | |
45 | "'\\u2005';", | |
46 | "'\\u2006';", | |
47 | "'\\u2007';", | |
48 | "'\\u2008';", | |
49 | "'\\u2009';", | |
50 | "'\\u200A';", | |
51 | "'\\u200B';", | |
52 | "'\\u2028';", | |
53 | "'\\u2029';", | |
54 | "'\\u202F';", | |
55 | "'\\u205f';", | |
56 | "'\\u3000';", | |
57 | "'\u000B';", | |
58 | "'\u000C';", | |
59 | "'\u0085';", | |
60 | "'\u00A0';", | |
61 | "'\u180E';", | |
62 | "'\ufeff';", | |
63 | "'\u2000';", | |
64 | "'\u2001';", | |
65 | "'\u2002';", | |
66 | "'\u2003';", | |
67 | "'\u2004';", | |
68 | "'\u2005';", | |
69 | "'\u2006';", | |
70 | "'\u2007';", | |
71 | "'\u2008';", | |
72 | "'\u2009';", | |
73 | "'\u200A';", | |
74 | "'\u200B';", | |
75 | "'\\\u2028';", // multiline string | |
76 | "'\\\u2029';", // multiline string | |
77 | "'\u202F';", | |
78 | "'\u205f';", | |
79 | "'\u3000';", | |
80 | { code: "// \u000B", options: [{ skipComments: true }] }, | |
81 | { code: "// \u000C", options: [{ skipComments: true }] }, | |
82 | { code: "// \u0085", options: [{ skipComments: true }] }, | |
83 | { code: "// \u00A0", options: [{ skipComments: true }] }, | |
84 | { code: "// \u180E", options: [{ skipComments: true }] }, | |
85 | { code: "// \ufeff", options: [{ skipComments: true }] }, | |
86 | { code: "// \u2000", options: [{ skipComments: true }] }, | |
87 | { code: "// \u2001", options: [{ skipComments: true }] }, | |
88 | { code: "// \u2002", options: [{ skipComments: true }] }, | |
89 | { code: "// \u2003", options: [{ skipComments: true }] }, | |
90 | { code: "// \u2004", options: [{ skipComments: true }] }, | |
91 | { code: "// \u2005", options: [{ skipComments: true }] }, | |
92 | { code: "// \u2006", options: [{ skipComments: true }] }, | |
93 | { code: "// \u2007", options: [{ skipComments: true }] }, | |
94 | { code: "// \u2008", options: [{ skipComments: true }] }, | |
95 | { code: "// \u2009", options: [{ skipComments: true }] }, | |
96 | { code: "// \u200A", options: [{ skipComments: true }] }, | |
97 | { code: "// \u200B", options: [{ skipComments: true }] }, | |
98 | { code: "// \u202F", options: [{ skipComments: true }] }, | |
99 | { code: "// \u205f", options: [{ skipComments: true }] }, | |
100 | { code: "// \u3000", options: [{ skipComments: true }] }, | |
101 | { code: "/* \u000B */", options: [{ skipComments: true }] }, | |
102 | { code: "/* \u000C */", options: [{ skipComments: true }] }, | |
103 | { code: "/* \u0085 */", options: [{ skipComments: true }] }, | |
104 | { code: "/* \u00A0 */", options: [{ skipComments: true }] }, | |
105 | { code: "/* \u180E */", options: [{ skipComments: true }] }, | |
106 | { code: "/* \ufeff */", options: [{ skipComments: true }] }, | |
107 | { code: "/* \u2000 */", options: [{ skipComments: true }] }, | |
108 | { code: "/* \u2001 */", options: [{ skipComments: true }] }, | |
109 | { code: "/* \u2002 */", options: [{ skipComments: true }] }, | |
110 | { code: "/* \u2003 */", options: [{ skipComments: true }] }, | |
111 | { code: "/* \u2004 */", options: [{ skipComments: true }] }, | |
112 | { code: "/* \u2005 */", options: [{ skipComments: true }] }, | |
113 | { code: "/* \u2006 */", options: [{ skipComments: true }] }, | |
114 | { code: "/* \u2007 */", options: [{ skipComments: true }] }, | |
115 | { code: "/* \u2008 */", options: [{ skipComments: true }] }, | |
116 | { code: "/* \u2009 */", options: [{ skipComments: true }] }, | |
117 | { code: "/* \u200A */", options: [{ skipComments: true }] }, | |
118 | { code: "/* \u200B */", options: [{ skipComments: true }] }, | |
119 | { code: "/* \u2028 */", options: [{ skipComments: true }] }, | |
120 | { code: "/* \u2029 */", options: [{ skipComments: true }] }, | |
121 | { code: "/* \u202F */", options: [{ skipComments: true }] }, | |
122 | { code: "/* \u205f */", options: [{ skipComments: true }] }, | |
123 | { code: "/* \u3000 */", options: [{ skipComments: true }] }, | |
124 | { code: "/\u000B/", options: [{ skipRegExps: true }] }, | |
125 | { code: "/\u000C/", options: [{ skipRegExps: true }] }, | |
126 | { code: "/\u0085/", options: [{ skipRegExps: true }] }, | |
127 | { code: "/\u00A0/", options: [{ skipRegExps: true }] }, | |
128 | { code: "/\u180E/", options: [{ skipRegExps: true }] }, | |
129 | { code: "/\ufeff/", options: [{ skipRegExps: true }] }, | |
130 | { code: "/\u2000/", options: [{ skipRegExps: true }] }, | |
131 | { code: "/\u2001/", options: [{ skipRegExps: true }] }, | |
132 | { code: "/\u2002/", options: [{ skipRegExps: true }] }, | |
133 | { code: "/\u2003/", options: [{ skipRegExps: true }] }, | |
134 | { code: "/\u2004/", options: [{ skipRegExps: true }] }, | |
135 | { code: "/\u2005/", options: [{ skipRegExps: true }] }, | |
136 | { code: "/\u2006/", options: [{ skipRegExps: true }] }, | |
137 | { code: "/\u2007/", options: [{ skipRegExps: true }] }, | |
138 | { code: "/\u2008/", options: [{ skipRegExps: true }] }, | |
139 | { code: "/\u2009/", options: [{ skipRegExps: true }] }, | |
140 | { code: "/\u200A/", options: [{ skipRegExps: true }] }, | |
141 | { code: "/\u200B/", options: [{ skipRegExps: true }] }, | |
142 | { code: "/\u202F/", options: [{ skipRegExps: true }] }, | |
143 | { code: "/\u205f/", options: [{ skipRegExps: true }] }, | |
144 | { code: "/\u3000/", options: [{ skipRegExps: true }] }, | |
145 | { code: "`\u000B`", options: [{ skipTemplates: true }], parserOptions: { ecmaVersion: 6 } }, | |
146 | { code: "`\u000C`", options: [{ skipTemplates: true }], parserOptions: { ecmaVersion: 6 } }, | |
147 | { code: "`\u0085`", options: [{ skipTemplates: true }], parserOptions: { ecmaVersion: 6 } }, | |
148 | { code: "`\u00A0`", options: [{ skipTemplates: true }], parserOptions: { ecmaVersion: 6 } }, | |
149 | { code: "`\u180E`", options: [{ skipTemplates: true }], parserOptions: { ecmaVersion: 6 } }, | |
150 | { code: "`\ufeff`", options: [{ skipTemplates: true }], parserOptions: { ecmaVersion: 6 } }, | |
151 | { code: "`\u2000`", options: [{ skipTemplates: true }], parserOptions: { ecmaVersion: 6 } }, | |
152 | { code: "`\u2001`", options: [{ skipTemplates: true }], parserOptions: { ecmaVersion: 6 } }, | |
153 | { code: "`\u2002`", options: [{ skipTemplates: true }], parserOptions: { ecmaVersion: 6 } }, | |
154 | { code: "`\u2003`", options: [{ skipTemplates: true }], parserOptions: { ecmaVersion: 6 } }, | |
155 | { code: "`\u2004`", options: [{ skipTemplates: true }], parserOptions: { ecmaVersion: 6 } }, | |
156 | { code: "`\u2005`", options: [{ skipTemplates: true }], parserOptions: { ecmaVersion: 6 } }, | |
157 | { code: "`\u2006`", options: [{ skipTemplates: true }], parserOptions: { ecmaVersion: 6 } }, | |
158 | { code: "`\u2007`", options: [{ skipTemplates: true }], parserOptions: { ecmaVersion: 6 } }, | |
159 | { code: "`\u2008`", options: [{ skipTemplates: true }], parserOptions: { ecmaVersion: 6 } }, | |
160 | { code: "`\u2009`", options: [{ skipTemplates: true }], parserOptions: { ecmaVersion: 6 } }, | |
161 | { code: "`\u200A`", options: [{ skipTemplates: true }], parserOptions: { ecmaVersion: 6 } }, | |
162 | { code: "`\u200B`", options: [{ skipTemplates: true }], parserOptions: { ecmaVersion: 6 } }, | |
163 | { code: "`\u202F`", options: [{ skipTemplates: true }], parserOptions: { ecmaVersion: 6 } }, | |
164 | { code: "`\u205f`", options: [{ skipTemplates: true }], parserOptions: { ecmaVersion: 6 } }, | |
165 | { code: "`\u3000`", options: [{ skipTemplates: true }], parserOptions: { ecmaVersion: 6 } }, | |
166 | ||
167 | // Unicode BOM. | |
168 | "\uFEFFconsole.log('hello BOM');" | |
169 | ], | |
170 | ||
171 | invalid: [ | |
172 | { | |
173 | code: "var any \u000B = 'thing';", | |
174 | errors: expectedErrors | |
175 | }, | |
176 | { | |
177 | code: "var any \u000C = 'thing';", | |
178 | errors: expectedErrors | |
179 | }, | |
180 | { | |
181 | code: "var any \u00A0 = 'thing';", | |
182 | errors: expectedErrors | |
183 | }, | |
184 | ||
185 | /* | |
186 | * it was moved out of General_Category=Zs (separator, space) in Unicode 6.3.0, so should not be considered a whitespace character. | |
187 | * https://codeblog.jonskeet.uk/2014/12/01/when-is-an-identifier-not-an-identifier-attack-of-the-mongolian-vowel-separator/ | |
188 | * { | |
189 | * code: "var any \u180E = 'thing';", | |
190 | * errors: expectedErrors | |
191 | * }, | |
192 | */ | |
193 | { | |
194 | code: "var any \ufeff = 'thing';", | |
195 | errors: expectedErrors | |
196 | }, | |
197 | { | |
198 | code: "var any \u2000 = 'thing';", | |
199 | errors: expectedErrors | |
200 | }, | |
201 | { | |
202 | code: "var any \u2001 = 'thing';", | |
203 | errors: expectedErrors | |
204 | }, | |
205 | { | |
206 | code: "var any \u2002 = 'thing';", | |
207 | errors: expectedErrors | |
208 | }, | |
209 | { | |
210 | code: "var any \u2003 = 'thing';", | |
211 | errors: expectedErrors | |
212 | }, | |
213 | { | |
214 | code: "var any \u2004 = 'thing';", | |
215 | errors: expectedErrors | |
216 | }, | |
217 | { | |
218 | code: "var any \u2005 = 'thing';", | |
219 | errors: expectedErrors | |
220 | }, | |
221 | { | |
222 | code: "var any \u2006 = 'thing';", | |
223 | errors: expectedErrors | |
224 | }, | |
225 | { | |
226 | code: "var any \u2007 = 'thing';", | |
227 | errors: expectedErrors | |
228 | }, | |
229 | { | |
230 | code: "var any \u2008 = 'thing';", | |
231 | errors: expectedErrors | |
232 | }, | |
233 | { | |
234 | code: "var any \u2009 = 'thing';", | |
235 | errors: expectedErrors | |
236 | }, | |
237 | { | |
238 | code: "var any \u200A = 'thing';", | |
239 | errors: expectedErrors | |
240 | }, | |
241 | { | |
242 | code: "var any \u2028 = 'thing';", | |
243 | errors: expectedErrors | |
244 | }, | |
245 | { | |
246 | code: "var any \u2029 = 'thing';", | |
247 | errors: expectedErrors | |
248 | }, | |
249 | { | |
250 | code: "var any \u202F = 'thing';", | |
251 | errors: expectedErrors | |
252 | }, | |
253 | { | |
254 | code: "var any \u205f = 'thing';", | |
255 | errors: expectedErrors | |
256 | }, | |
257 | { | |
258 | code: "var any \u3000 = 'thing';", | |
259 | errors: expectedErrors | |
260 | }, | |
261 | { | |
262 | code: "var a = 'b',\u2028c = 'd',\ne = 'f'\u2028", | |
263 | errors: [ | |
264 | { | |
265 | messageId: "noIrregularWhitespace", | |
266 | type: "Program", | |
267 | line: 1, | |
268 | column: 13 | |
269 | }, | |
270 | { | |
271 | messageId: "noIrregularWhitespace", | |
272 | type: "Program", | |
273 | line: 3, | |
274 | column: 8 | |
275 | } | |
276 | ] | |
277 | }, | |
278 | { | |
279 | code: "var any \u3000 = 'thing', other \u3000 = 'thing';\nvar third \u3000 = 'thing';", | |
280 | errors: [ | |
281 | { | |
282 | messageId: "noIrregularWhitespace", | |
283 | type: "Program", | |
284 | line: 1, | |
285 | column: 9 | |
286 | }, | |
287 | { | |
288 | messageId: "noIrregularWhitespace", | |
289 | type: "Program", | |
290 | line: 1, | |
291 | column: 28 | |
292 | }, | |
293 | { | |
294 | messageId: "noIrregularWhitespace", | |
295 | type: "Program", | |
296 | line: 2, | |
297 | column: 11 | |
298 | } | |
299 | ] | |
300 | }, | |
301 | { | |
302 | code: "// \u000B", | |
303 | errors: expectedCommentErrors | |
304 | }, | |
305 | { | |
306 | code: "// \u000C", | |
307 | errors: expectedCommentErrors | |
308 | }, | |
309 | { | |
310 | code: "// \u0085", | |
311 | errors: expectedCommentErrors | |
312 | }, | |
313 | { | |
314 | code: "// \u00A0", | |
315 | errors: expectedCommentErrors | |
316 | }, | |
317 | { | |
318 | code: "// \u180E", | |
319 | errors: expectedCommentErrors | |
320 | }, | |
321 | { | |
322 | code: "// \ufeff", | |
323 | errors: expectedCommentErrors | |
324 | }, | |
325 | { | |
326 | code: "// \u2000", | |
327 | errors: expectedCommentErrors | |
328 | }, | |
329 | { | |
330 | code: "// \u2001", | |
331 | errors: expectedCommentErrors | |
332 | }, | |
333 | { | |
334 | code: "// \u2002", | |
335 | errors: expectedCommentErrors | |
336 | }, | |
337 | { | |
338 | code: "// \u2003", | |
339 | errors: expectedCommentErrors | |
340 | }, | |
341 | { | |
342 | code: "// \u2004", | |
343 | errors: expectedCommentErrors | |
344 | }, | |
345 | { | |
346 | code: "// \u2005", | |
347 | errors: expectedCommentErrors | |
348 | }, | |
349 | { | |
350 | code: "// \u2006", | |
351 | errors: expectedCommentErrors | |
352 | }, | |
353 | { | |
354 | code: "// \u2007", | |
355 | errors: expectedCommentErrors | |
356 | }, | |
357 | { | |
358 | code: "// \u2008", | |
359 | errors: expectedCommentErrors | |
360 | }, | |
361 | { | |
362 | code: "// \u2009", | |
363 | errors: expectedCommentErrors | |
364 | }, | |
365 | { | |
366 | code: "// \u200A", | |
367 | errors: expectedCommentErrors | |
368 | }, | |
369 | { | |
370 | code: "// \u200B", | |
371 | errors: expectedCommentErrors | |
372 | }, | |
373 | { | |
374 | code: "// \u202F", | |
375 | errors: expectedCommentErrors | |
376 | }, | |
377 | { | |
378 | code: "// \u205f", | |
379 | errors: expectedCommentErrors | |
380 | }, | |
381 | { | |
382 | code: "// \u3000", | |
383 | errors: expectedCommentErrors | |
384 | }, | |
385 | { | |
386 | code: "/* \u000B */", | |
387 | errors: expectedCommentErrors | |
388 | }, | |
389 | { | |
390 | code: "/* \u000C */", | |
391 | errors: expectedCommentErrors | |
392 | }, | |
393 | { | |
394 | code: "/* \u0085 */", | |
395 | errors: expectedCommentErrors | |
396 | }, | |
397 | { | |
398 | code: "/* \u00A0 */", | |
399 | errors: expectedCommentErrors | |
400 | }, | |
401 | { | |
402 | code: "/* \u180E */", | |
403 | errors: expectedCommentErrors | |
404 | }, | |
405 | { | |
406 | code: "/* \ufeff */", | |
407 | errors: expectedCommentErrors | |
408 | }, | |
409 | { | |
410 | code: "/* \u2000 */", | |
411 | errors: expectedCommentErrors | |
412 | }, | |
413 | { | |
414 | code: "/* \u2001 */", | |
415 | errors: expectedCommentErrors | |
416 | }, | |
417 | { | |
418 | code: "/* \u2002 */", | |
419 | errors: expectedCommentErrors | |
420 | }, | |
421 | { | |
422 | code: "/* \u2003 */", | |
423 | errors: expectedCommentErrors | |
424 | }, | |
425 | { | |
426 | code: "/* \u2004 */", | |
427 | errors: expectedCommentErrors | |
428 | }, | |
429 | { | |
430 | code: "/* \u2005 */", | |
431 | errors: expectedCommentErrors | |
432 | }, | |
433 | { | |
434 | code: "/* \u2006 */", | |
435 | errors: expectedCommentErrors | |
436 | }, | |
437 | { | |
438 | code: "/* \u2007 */", | |
439 | errors: expectedCommentErrors | |
440 | }, | |
441 | { | |
442 | code: "/* \u2008 */", | |
443 | errors: expectedCommentErrors | |
444 | }, | |
445 | { | |
446 | code: "/* \u2009 */", | |
447 | errors: expectedCommentErrors | |
448 | }, | |
449 | { | |
450 | code: "/* \u200A */", | |
451 | errors: expectedCommentErrors | |
452 | }, | |
453 | { | |
454 | code: "/* \u200B */", | |
455 | errors: expectedCommentErrors | |
456 | }, | |
457 | { | |
458 | code: "/* \u2028 */", | |
459 | errors: expectedCommentErrors | |
460 | }, | |
461 | { | |
462 | code: "/* \u2029 */", | |
463 | errors: expectedCommentErrors | |
464 | }, | |
465 | { | |
466 | code: "/* \u202F */", | |
467 | errors: expectedCommentErrors | |
468 | }, | |
469 | { | |
470 | code: "/* \u205f */", | |
471 | errors: expectedCommentErrors | |
472 | }, | |
473 | { | |
474 | code: "/* \u3000 */", | |
475 | errors: expectedCommentErrors | |
476 | }, | |
477 | { | |
478 | code: "var any = /\u3000/, other = /\u000B/;", | |
479 | errors: [ | |
480 | { | |
481 | messageId: "noIrregularWhitespace", | |
482 | type: "Program", | |
483 | line: 1, | |
484 | column: 12 | |
485 | }, | |
486 | { | |
487 | messageId: "noIrregularWhitespace", | |
488 | type: "Program", | |
489 | line: 1, | |
490 | column: 25 | |
491 | } | |
492 | ] | |
493 | }, | |
494 | { | |
495 | code: "var any = '\u3000', other = '\u000B';", | |
496 | options: [{ skipStrings: false }], | |
497 | errors: [ | |
498 | { | |
499 | messageId: "noIrregularWhitespace", | |
500 | type: "Program", | |
501 | line: 1, | |
502 | column: 12 | |
503 | }, | |
504 | { | |
505 | messageId: "noIrregularWhitespace", | |
506 | type: "Program", | |
507 | line: 1, | |
508 | column: 25 | |
509 | } | |
510 | ] | |
511 | }, | |
512 | { | |
513 | code: "var any = `\u3000`, other = `\u000B`;", | |
514 | options: [{ skipTemplates: false }], | |
515 | parserOptions: { ecmaVersion: 6 }, | |
516 | errors: [ | |
517 | { | |
518 | messageId: "noIrregularWhitespace", | |
519 | type: "Program", | |
520 | line: 1, | |
521 | column: 12 | |
522 | }, | |
523 | { | |
524 | messageId: "noIrregularWhitespace", | |
525 | type: "Program", | |
526 | line: 1, | |
527 | column: 25 | |
528 | } | |
529 | ] | |
530 | }, | |
531 | { | |
532 | code: "`something ${\u3000 10} another thing`", | |
533 | options: [{ skipTemplates: true }], | |
534 | parserOptions: { ecmaVersion: 6 }, | |
535 | errors: [ | |
536 | { | |
537 | messageId: "noIrregularWhitespace", | |
538 | type: "Program", | |
539 | line: 1, | |
540 | column: 14 | |
541 | } | |
542 | ] | |
6f036462 TL |
543 | }, |
544 | ||
545 | // full location tests | |
546 | { | |
547 | code: "var foo = \u000B bar;", | |
548 | errors: [ | |
549 | { | |
550 | messageId: "noIrregularWhitespace", | |
551 | type: "Program", | |
552 | line: 1, | |
553 | column: 11, | |
554 | endLine: 1, | |
555 | endColumn: 12 | |
556 | } | |
557 | ] | |
558 | }, | |
559 | { | |
560 | code: "var foo =\u000Bbar;", | |
561 | errors: [ | |
562 | { | |
563 | messageId: "noIrregularWhitespace", | |
564 | type: "Program", | |
565 | line: 1, | |
566 | column: 10, | |
567 | endLine: 1, | |
568 | endColumn: 11 | |
569 | } | |
570 | ] | |
571 | }, | |
572 | { | |
573 | code: "var foo = \u000B\u000B bar;", | |
574 | errors: [ | |
575 | { | |
576 | messageId: "noIrregularWhitespace", | |
577 | type: "Program", | |
578 | line: 1, | |
579 | column: 11, | |
580 | endLine: 1, | |
581 | endColumn: 13 | |
582 | } | |
583 | ] | |
584 | }, | |
585 | { | |
586 | code: "var foo = \u000B\u000C bar;", | |
587 | errors: [ | |
588 | { | |
589 | messageId: "noIrregularWhitespace", | |
590 | type: "Program", | |
591 | line: 1, | |
592 | column: 11, | |
593 | endLine: 1, | |
594 | endColumn: 13 | |
595 | } | |
596 | ] | |
597 | }, | |
598 | { | |
599 | code: "var foo = \u000B \u000B bar;", | |
600 | errors: [ | |
601 | { | |
602 | messageId: "noIrregularWhitespace", | |
603 | type: "Program", | |
604 | line: 1, | |
605 | column: 11, | |
606 | endLine: 1, | |
607 | endColumn: 12 | |
608 | }, | |
609 | { | |
610 | messageId: "noIrregularWhitespace", | |
611 | type: "Program", | |
612 | line: 1, | |
613 | column: 13, | |
614 | endLine: 1, | |
615 | endColumn: 14 | |
616 | } | |
617 | ] | |
618 | }, | |
619 | { | |
620 | code: "var foo = \u000Bbar\u000B;", | |
621 | errors: [ | |
622 | { | |
623 | messageId: "noIrregularWhitespace", | |
624 | type: "Program", | |
625 | line: 1, | |
626 | column: 11, | |
627 | endLine: 1, | |
628 | endColumn: 12 | |
629 | }, | |
630 | { | |
631 | messageId: "noIrregularWhitespace", | |
632 | type: "Program", | |
633 | line: 1, | |
634 | column: 15, | |
635 | endLine: 1, | |
636 | endColumn: 16 | |
637 | } | |
638 | ] | |
639 | }, | |
640 | { | |
641 | code: "\u000B", | |
642 | errors: [ | |
643 | { | |
644 | messageId: "noIrregularWhitespace", | |
645 | type: "Program", | |
646 | line: 1, | |
647 | column: 1, | |
648 | endLine: 1, | |
649 | endColumn: 2 | |
650 | } | |
651 | ] | |
652 | }, | |
653 | { | |
654 | code: "\u00A0\u2002\u2003", | |
655 | errors: [ | |
656 | { | |
657 | messageId: "noIrregularWhitespace", | |
658 | type: "Program", | |
659 | line: 1, | |
660 | column: 1, | |
661 | endLine: 1, | |
662 | endColumn: 4 | |
663 | } | |
664 | ] | |
665 | }, | |
666 | { | |
667 | code: "var foo = \u000B\nbar;", | |
668 | errors: [ | |
669 | { | |
670 | messageId: "noIrregularWhitespace", | |
671 | type: "Program", | |
672 | line: 1, | |
673 | column: 11, | |
674 | endLine: 1, | |
675 | endColumn: 12 | |
676 | } | |
677 | ] | |
678 | }, | |
679 | { | |
680 | code: "var foo =\u000B\n\u000Bbar;", | |
681 | errors: [ | |
682 | { | |
683 | messageId: "noIrregularWhitespace", | |
684 | type: "Program", | |
685 | line: 1, | |
686 | column: 10, | |
687 | endLine: 1, | |
688 | endColumn: 11 | |
689 | }, | |
690 | { | |
691 | messageId: "noIrregularWhitespace", | |
692 | type: "Program", | |
693 | line: 2, | |
694 | column: 1, | |
695 | endLine: 2, | |
696 | endColumn: 2 | |
697 | } | |
698 | ] | |
699 | }, | |
700 | { | |
701 | code: "var foo = \u000C\u000B\n\u000C\u000B\u000Cbar\n;\u000B\u000C\n", | |
702 | errors: [ | |
703 | { | |
704 | messageId: "noIrregularWhitespace", | |
705 | type: "Program", | |
706 | line: 1, | |
707 | column: 11, | |
708 | endLine: 1, | |
709 | endColumn: 13 | |
710 | }, | |
711 | { | |
712 | messageId: "noIrregularWhitespace", | |
713 | type: "Program", | |
714 | line: 2, | |
715 | column: 1, | |
716 | endLine: 2, | |
717 | endColumn: 4 | |
718 | }, | |
719 | { | |
720 | messageId: "noIrregularWhitespace", | |
721 | type: "Program", | |
722 | line: 3, | |
723 | column: 2, | |
724 | endLine: 3, | |
725 | endColumn: 4 | |
726 | } | |
727 | ] | |
728 | }, | |
729 | { | |
730 | code: "var foo = \u2028bar;", | |
731 | errors: [ | |
732 | { | |
733 | messageId: "noIrregularWhitespace", | |
734 | type: "Program", | |
735 | line: 1, | |
736 | column: 11, | |
737 | endLine: 2, | |
738 | endColumn: 1 | |
739 | } | |
740 | ] | |
741 | }, | |
742 | { | |
743 | code: "var foo =\u2029 bar;", | |
744 | errors: [ | |
745 | { | |
746 | messageId: "noIrregularWhitespace", | |
747 | type: "Program", | |
748 | line: 1, | |
749 | column: 10, | |
750 | endLine: 2, | |
751 | endColumn: 1 | |
752 | } | |
753 | ] | |
754 | }, | |
755 | { | |
756 | code: "var foo = bar;\u2028", | |
757 | errors: [ | |
758 | { | |
759 | messageId: "noIrregularWhitespace", | |
760 | type: "Program", | |
761 | line: 1, | |
762 | column: 15, | |
763 | endLine: 2, | |
764 | endColumn: 1 | |
765 | } | |
766 | ] | |
767 | }, | |
768 | { | |
769 | code: "\u2029", | |
770 | errors: [ | |
771 | { | |
772 | messageId: "noIrregularWhitespace", | |
773 | type: "Program", | |
774 | line: 1, | |
775 | column: 1, | |
776 | endLine: 2, | |
777 | endColumn: 1 | |
778 | } | |
779 | ] | |
780 | }, | |
781 | { | |
782 | code: "foo\u2028\u2028", | |
783 | errors: [ | |
784 | { | |
785 | messageId: "noIrregularWhitespace", | |
786 | type: "Program", | |
787 | line: 1, | |
788 | column: 4, | |
789 | endLine: 2, | |
790 | endColumn: 1 | |
791 | }, | |
792 | { | |
793 | messageId: "noIrregularWhitespace", | |
794 | type: "Program", | |
795 | line: 2, | |
796 | column: 1, | |
797 | endLine: 3, | |
798 | endColumn: 1 | |
799 | } | |
800 | ] | |
801 | }, | |
802 | { | |
803 | code: "foo\u2029\u2028", | |
804 | errors: [ | |
805 | { | |
806 | messageId: "noIrregularWhitespace", | |
807 | type: "Program", | |
808 | line: 1, | |
809 | column: 4, | |
810 | endLine: 2, | |
811 | endColumn: 1 | |
812 | }, | |
813 | { | |
814 | messageId: "noIrregularWhitespace", | |
815 | type: "Program", | |
816 | line: 2, | |
817 | column: 1, | |
818 | endLine: 3, | |
819 | endColumn: 1 | |
820 | } | |
821 | ] | |
822 | }, | |
823 | { | |
824 | code: "foo\u2028\n\u2028", | |
825 | errors: [ | |
826 | { | |
827 | messageId: "noIrregularWhitespace", | |
828 | type: "Program", | |
829 | line: 1, | |
830 | column: 4, | |
831 | endLine: 2, | |
832 | endColumn: 1 | |
833 | }, | |
834 | { | |
835 | messageId: "noIrregularWhitespace", | |
836 | type: "Program", | |
837 | line: 3, | |
838 | column: 1, | |
839 | endLine: 4, | |
840 | endColumn: 1 | |
841 | } | |
842 | ] | |
843 | }, | |
844 | { | |
845 | code: "foo\u000B\u2028\u000B", | |
846 | errors: [ | |
847 | { | |
848 | messageId: "noIrregularWhitespace", | |
849 | type: "Program", | |
850 | line: 1, | |
851 | column: 4, | |
852 | endLine: 1, | |
853 | endColumn: 5 | |
854 | }, | |
855 | { | |
856 | messageId: "noIrregularWhitespace", | |
857 | type: "Program", | |
858 | line: 1, | |
859 | column: 5, | |
860 | endLine: 2, | |
861 | endColumn: 1 | |
862 | }, | |
863 | { | |
864 | messageId: "noIrregularWhitespace", | |
865 | type: "Program", | |
866 | line: 2, | |
867 | column: 1, | |
868 | endLine: 2, | |
869 | endColumn: 2 | |
870 | } | |
871 | ] | |
eb39fafa DC |
872 | } |
873 | ] | |
874 | }); |