Debian Codegraph @

.cargo/vendor/regex/testdata/word-boundary-special.toml

raw
1 # These tests are for the "special" word boundary assertions. That is,
2 # \b{start}, \b{end}, \b{start-half}, \b{end-half}. These are specialty
3 # assertions for more niche use cases, but hitting those cases without these
4 # assertions is difficult. For example, \b{start-half} and \b{end-half} are
5 # used to implement the -w/--word-regexp flag in a grep program.
6
7 # Tests for (?-u:\b{start})
8
9 [[test]]
10 name = "word-start-ascii-010"
11 regex = '\b{start}'
12 haystack = "a"
13 matches = [[0, 0]]
14 unicode = false
15
16 [[test]]
17 name = "word-start-ascii-020"
18 regex = '\b{start}'
19 haystack = "a "
20 matches = [[0, 0]]
21 unicode = false
22
23 [[test]]
24 name = "word-start-ascii-030"
25 regex = '\b{start}'
26 haystack = " a "
27 matches = [[1, 1]]
28 unicode = false
29
30 [[test]]
31 name = "word-start-ascii-040"
32 regex = '\b{start}'
33 haystack = ""
34 matches = []
35 unicode = false
36
37 [[test]]
38 name = "word-start-ascii-050"
39 regex = '\b{start}'
40 haystack = "ab"
41 matches = [[0, 0]]
42 unicode = false
43
44 [[test]]
45 name = "word-start-ascii-060"
46 regex = '\b{start}'
47 haystack = "𝛃"
48 matches = []
49 unicode = false
50
51 [[test]]
52 name = "word-start-ascii-060-bounds"
53 regex = '\b{start}'
54 haystack = "𝛃"
55 bounds = [2, 3]
56 matches = []
57 unicode = false
58
59 [[test]]
60 name = "word-start-ascii-070"
61 regex = '\b{start}'
62 haystack = " 𝛃 "
63 matches = []
64 unicode = false
65
66 [[test]]
67 name = "word-start-ascii-080"
68 regex = '\b{start}'
69 haystack = "𝛃𐆀"
70 matches = []
71 unicode = false
72
73 [[test]]
74 name = "word-start-ascii-090"
75 regex = '\b{start}'
76 haystack = "𝛃b"
77 matches = [[4, 4]]
78 unicode = false
79
80 [[test]]
81 name = "word-start-ascii-110"
82 regex = '\b{start}'
83 haystack = "b𝛃"
84 matches = [[0, 0]]
85 unicode = false
86
87 # Tests for (?-u:\b{end})
88
89 [[test]]
90 name = "word-end-ascii-010"
91 regex = '\b{end}'
92 haystack = "a"
93 matches = [[1, 1]]
94 unicode = false
95
96 [[test]]
97 name = "word-end-ascii-020"
98 regex = '\b{end}'
99 haystack = "a "
100 matches = [[1, 1]]
101 unicode = false
102
103 [[test]]
104 name = "word-end-ascii-030"
105 regex = '\b{end}'
106 haystack = " a "
107 matches = [[2, 2]]
108 unicode = false
109
110 [[test]]
111 name = "word-end-ascii-040"
112 regex = '\b{end}'
113 haystack = ""
114 matches = []
115 unicode = false
116
117 [[test]]
118 name = "word-end-ascii-050"
119 regex = '\b{end}'
120 haystack = "ab"
121 matches = [[2, 2]]
122 unicode = false
123
124 [[test]]
125 name = "word-end-ascii-060"
126 regex = '\b{end}'
127 haystack = "𝛃"
128 matches = []
129 unicode = false
130
131 [[test]]
132 name = "word-end-ascii-060-bounds"
133 regex = '\b{end}'
134 haystack = "𝛃"
135 bounds = [2, 3]
136 matches = []
137 unicode = false
138
139 [[test]]
140 name = "word-end-ascii-070"
141 regex = '\b{end}'
142 haystack = " 𝛃 "
143 matches = []
144 unicode = false
145
146 [[test]]
147 name = "word-end-ascii-080"
148 regex = '\b{end}'
149 haystack = "𝛃𐆀"
150 matches = []
151 unicode = false
152
153 [[test]]
154 name = "word-end-ascii-090"
155 regex = '\b{end}'
156 haystack = "𝛃b"
157 matches = [[5, 5]]
158 unicode = false
159
160 [[test]]
161 name = "word-end-ascii-110"
162 regex = '\b{end}'
163 haystack = "b𝛃"
164 matches = [[1, 1]]
165 unicode = false
166
167 # Tests for \b{start}
168
169 [[test]]
170 name = "word-start-unicode-010"
171 regex = '\b{start}'
172 haystack = "a"
173 matches = [[0, 0]]
174 unicode = true
175
176 [[test]]
177 name = "word-start-unicode-020"
178 regex = '\b{start}'
179 haystack = "a "
180 matches = [[0, 0]]
181 unicode = true
182
183 [[test]]
184 name = "word-start-unicode-030"
185 regex = '\b{start}'
186 haystack = " a "
187 matches = [[1, 1]]
188 unicode = true
189
190 [[test]]
191 name = "word-start-unicode-040"
192 regex = '\b{start}'
193 haystack = ""
194 matches = []
195 unicode = true
196
197 [[test]]
198 name = "word-start-unicode-050"
199 regex = '\b{start}'
200 haystack = "ab"
201 matches = [[0, 0]]
202 unicode = true
203
204 [[test]]
205 name = "word-start-unicode-060"
206 regex = '\b{start}'
207 haystack = "𝛃"
208 matches = [[0, 0]]
209 unicode = true
210
211 [[test]]
212 name = "word-start-unicode-060-bounds"
213 regex = '\b{start}'
214 haystack = "𝛃"
215 bounds = [2, 3]
216 matches = []
217 unicode = true
218
219 [[test]]
220 name = "word-start-unicode-070"
221 regex = '\b{start}'
222 haystack = " 𝛃 "
223 matches = [[1, 1]]
224 unicode = true
225
226 [[test]]
227 name = "word-start-unicode-080"
228 regex = '\b{start}'
229 haystack = "𝛃𐆀"
230 matches = [[0, 0]]
231 unicode = true
232
233 [[test]]
234 name = "word-start-unicode-090"
235 regex = '\b{start}'
236 haystack = "𝛃b"
237 matches = [[0, 0]]
238 unicode = true
239
240 [[test]]
241 name = "word-start-unicode-110"
242 regex = '\b{start}'
243 haystack = "b𝛃"
244 matches = [[0, 0]]
245 unicode = true
246
247 # Tests for \b{end}
248
249 [[test]]
250 name = "word-end-unicode-010"
251 regex = '\b{end}'
252 haystack = "a"
253 matches = [[1, 1]]
254 unicode = true
255
256 [[test]]
257 name = "word-end-unicode-020"
258 regex = '\b{end}'
259 haystack = "a "
260 matches = [[1, 1]]
261 unicode = true
262
263 [[test]]
264 name = "word-end-unicode-030"
265 regex = '\b{end}'
266 haystack = " a "
267 matches = [[2, 2]]
268 unicode = true
269
270 [[test]]
271 name = "word-end-unicode-040"
272 regex = '\b{end}'
273 haystack = ""
274 matches = []
275 unicode = true
276
277 [[test]]
278 name = "word-end-unicode-050"
279 regex = '\b{end}'
280 haystack = "ab"
281 matches = [[2, 2]]
282 unicode = true
283
284 [[test]]
285 name = "word-end-unicode-060"
286 regex = '\b{end}'
287 haystack = "𝛃"
288 matches = [[4, 4]]
289 unicode = true
290
291 [[test]]
292 name = "word-end-unicode-060-bounds"
293 regex = '\b{end}'
294 haystack = "𝛃"
295 bounds = [2, 3]
296 matches = []
297 unicode = true
298
299 [[test]]
300 name = "word-end-unicode-070"
301 regex = '\b{end}'
302 haystack = " 𝛃 "
303 matches = [[5, 5]]
304 unicode = true
305
306 [[test]]
307 name = "word-end-unicode-080"
308 regex = '\b{end}'
309 haystack = "𝛃𐆀"
310 matches = [[4, 4]]
311 unicode = true
312
313 [[test]]
314 name = "word-end-unicode-090"
315 regex = '\b{end}'
316 haystack = "𝛃b"
317 matches = [[5, 5]]
318 unicode = true
319
320 [[test]]
321 name = "word-end-unicode-110"
322 regex = '\b{end}'
323 haystack = "b𝛃"
324 matches = [[5, 5]]
325 unicode = true
326
327 # Tests for (?-u:\b{start-half})
328
329 [[test]]
330 name = "word-start-half-ascii-010"
331 regex = '\b{start-half}'
332 haystack = "a"
333 matches = [[0, 0]]
334 unicode = false
335
336 [[test]]
337 name = "word-start-half-ascii-020"
338 regex = '\b{start-half}'
339 haystack = "a "
340 matches = [[0, 0], [2, 2]]
341 unicode = false
342
343 [[test]]
344 name = "word-start-half-ascii-030"
345 regex = '\b{start-half}'
346 haystack = " a "
347 matches = [[0, 0], [1, 1], [3, 3]]
348 unicode = false
349
350 [[test]]
351 name = "word-start-half-ascii-040"
352 regex = '\b{start-half}'
353 haystack = ""
354 matches = [[0, 0]]
355 unicode = false
356
357 [[test]]
358 name = "word-start-half-ascii-050"
359 regex = '\b{start-half}'
360 haystack = "ab"
361 matches = [[0, 0]]
362 unicode = false
363
364 [[test]]
365 name = "word-start-half-ascii-060"
366 regex = '\b{start-half}'
367 haystack = "𝛃"
368 matches = [[0, 0], [4, 4]]
369 unicode = false
370
371 [[test]]
372 name = "word-start-half-ascii-060-noutf8"
373 regex = '\b{start-half}'
374 haystack = "𝛃"
375 matches = [[0, 0], [1, 1], [2, 2], [3, 3], [4, 4]]
376 unicode = false
377 utf8 = false
378
379 [[test]]
380 name = "word-start-half-ascii-060-bounds"
381 regex = '\b{start-half}'
382 haystack = "𝛃"
383 bounds = [2, 3]
384 matches = []
385 unicode = false
386
387 [[test]]
388 name = "word-start-half-ascii-070"
389 regex = '\b{start-half}'
390 haystack = " 𝛃 "
391 matches = [[0, 0], [1, 1], [5, 5], [6, 6]]
392 unicode = false
393
394 [[test]]
395 name = "word-start-half-ascii-080"
396 regex = '\b{start-half}'
397 haystack = "𝛃𐆀"
398 matches = [[0, 0], [4, 4], [8, 8]]
399 unicode = false
400
401 [[test]]
402 name = "word-start-half-ascii-090"
403 regex = '\b{start-half}'
404 haystack = "𝛃b"
405 matches = [[0, 0], [4, 4]]
406 unicode = false
407
408 [[test]]
409 name = "word-start-half-ascii-110"
410 regex = '\b{start-half}'
411 haystack = "b𝛃"
412 matches = [[0, 0], [5, 5]]
413 unicode = false
414
415 # Tests for (?-u:\b{end-half})
416
417 [[test]]
418 name = "word-end-half-ascii-010"
419 regex = '\b{end-half}'
420 haystack = "a"
421 matches = [[1, 1]]
422 unicode = false
423
424 [[test]]
425 name = "word-end-half-ascii-020"
426 regex = '\b{end-half}'
427 haystack = "a "
428 matches = [[1, 1], [2, 2]]
429 unicode = false
430
431 [[test]]
432 name = "word-end-half-ascii-030"
433 regex = '\b{end-half}'
434 haystack = " a "
435 matches = [[0, 0], [2, 2], [3, 3]]
436 unicode = false
437
438 [[test]]
439 name = "word-end-half-ascii-040"
440 regex = '\b{end-half}'
441 haystack = ""
442 matches = [[0, 0]]
443 unicode = false
444
445 [[test]]
446 name = "word-end-half-ascii-050"
447 regex = '\b{end-half}'
448 haystack = "ab"
449 matches = [[2, 2]]
450 unicode = false
451
452 [[test]]
453 name = "word-end-half-ascii-060"
454 regex = '\b{end-half}'
455 haystack = "𝛃"
456 matches = [[0, 0], [4, 4]]
457 unicode = false
458
459 [[test]]
460 name = "word-end-half-ascii-060-bounds"
461 regex = '\b{end-half}'
462 haystack = "𝛃"
463 bounds = [2, 3]
464 matches = []
465 unicode = false
466
467 [[test]]
468 name = "word-end-half-ascii-070"
469 regex = '\b{end-half}'
470 haystack = " 𝛃 "
471 matches = [[0, 0], [1, 1], [5, 5], [6, 6]]
472 unicode = false
473
474 [[test]]
475 name = "word-end-half-ascii-080"
476 regex = '\b{end-half}'
477 haystack = "𝛃𐆀"
478 matches = [[0, 0], [4, 4], [8, 8]]
479 unicode = false
480
481 [[test]]
482 name = "word-end-half-ascii-090"
483 regex = '\b{end-half}'
484 haystack = "𝛃b"
485 matches = [[0, 0], [5, 5]]
486 unicode = false
487
488 [[test]]
489 name = "word-end-half-ascii-110"
490 regex = '\b{end-half}'
491 haystack = "b𝛃"
492 matches = [[1, 1], [5, 5]]
493 unicode = false
494
495 # Tests for \b{start-half}
496
497 [[test]]
498 name = "word-start-half-unicode-010"
499 regex = '\b{start-half}'
500 haystack = "a"
501 matches = [[0, 0]]
502 unicode = true
503
504 [[test]]
505 name = "word-start-half-unicode-020"
506 regex = '\b{start-half}'
507 haystack = "a "
508 matches = [[0, 0], [2, 2]]
509 unicode = true
510
511 [[test]]
512 name = "word-start-half-unicode-030"
513 regex = '\b{start-half}'
514 haystack = " a "
515 matches = [[0, 0], [1, 1], [3, 3]]
516 unicode = true
517
518 [[test]]
519 name = "word-start-half-unicode-040"
520 regex = '\b{start-half}'
521 haystack = ""
522 matches = [[0, 0]]
523 unicode = true
524
525 [[test]]
526 name = "word-start-half-unicode-050"
527 regex = '\b{start-half}'
528 haystack = "ab"
529 matches = [[0, 0]]
530 unicode = true
531
532 [[test]]
533 name = "word-start-half-unicode-060"
534 regex = '\b{start-half}'
535 haystack = "𝛃"
536 matches = [[0, 0]]
537 unicode = true
538
539 [[test]]
540 name = "word-start-half-unicode-060-bounds"
541 regex = '\b{start-half}'
542 haystack = "𝛃"
543 bounds = [2, 3]
544 matches = []
545 unicode = true
546
547 [[test]]
548 name = "word-start-half-unicode-070"
549 regex = '\b{start-half}'
550 haystack = " 𝛃 "
551 matches = [[0, 0], [1, 1], [6, 6]]
552 unicode = true
553
554 [[test]]
555 name = "word-start-half-unicode-080"
556 regex = '\b{start-half}'
557 haystack = "𝛃𐆀"
558 matches = [[0, 0], [8, 8]]
559 unicode = true
560
561 [[test]]
562 name = "word-start-half-unicode-090"
563 regex = '\b{start-half}'
564 haystack = "𝛃b"
565 matches = [[0, 0]]
566 unicode = true
567
568 [[test]]
569 name = "word-start-half-unicode-110"
570 regex = '\b{start-half}'
571 haystack = "b𝛃"
572 matches = [[0, 0]]
573 unicode = true
574
575 # Tests for \b{end-half}
576
577 [[test]]
578 name = "word-end-half-unicode-010"
579 regex = '\b{end-half}'
580 haystack = "a"
581 matches = [[1, 1]]
582 unicode = true
583
584 [[test]]
585 name = "word-end-half-unicode-020"
586 regex = '\b{end-half}'
587 haystack = "a "
588 matches = [[1, 1], [2, 2]]
589 unicode = true
590
591 [[test]]
592 name = "word-end-half-unicode-030"
593 regex = '\b{end-half}'
594 haystack = " a "
595 matches = [[0, 0], [2, 2], [3, 3]]
596 unicode = true
597
598 [[test]]
599 name = "word-end-half-unicode-040"
600 regex = '\b{end-half}'
601 haystack = ""
602 matches = [[0, 0]]
603 unicode = true
604
605 [[test]]
606 name = "word-end-half-unicode-050"
607 regex = '\b{end-half}'
608 haystack = "ab"
609 matches = [[2, 2]]
610 unicode = true
611
612 [[test]]
613 name = "word-end-half-unicode-060"
614 regex = '\b{end-half}'
615 haystack = "𝛃"
616 matches = [[4, 4]]
617 unicode = true
618
619 [[test]]
620 name = "word-end-half-unicode-060-bounds"
621 regex = '\b{end-half}'
622 haystack = "𝛃"
623 bounds = [2, 3]
624 matches = []
625 unicode = true
626
627 [[test]]
628 name = "word-end-half-unicode-070"
629 regex = '\b{end-half}'
630 haystack = " 𝛃 "
631 matches = [[0, 0], [5, 5], [6, 6]]
632 unicode = true
633
634 [[test]]
635 name = "word-end-half-unicode-080"
636 regex = '\b{end-half}'
637 haystack = "𝛃𐆀"
638 matches = [[4, 4], [8, 8]]
639 unicode = true
640
641 [[test]]
642 name = "word-end-half-unicode-090"
643 regex = '\b{end-half}'
644 haystack = "𝛃b"
645 matches = [[5, 5]]
646 unicode = true
647
648 [[test]]
649 name = "word-end-half-unicode-110"
650 regex = '\b{end-half}'
651 haystack = "b𝛃"
652 matches = [[5, 5]]
653 unicode = true
654
655 # Specialty tests.
656
657 # Since \r is special cased in the start state computation (to deal with CRLF
658 # mode), this test ensures that the correct start state is computed when the
659 # pattern starts with a half word boundary assertion.
660 [[test]]
661 name = "word-start-half-ascii-carriage"
662 regex = '\b{start-half}[a-z]+'
663 haystack = 'ABC\rabc'
664 matches = [[4, 7]]
665 bounds = [4, 7]
666 unescape = true
667
668 # Since \n is also special cased in the start state computation, this test
669 # ensures that the correct start state is computed when the pattern starts with
670 # a half word boundary assertion.
671 [[test]]
672 name = "word-start-half-ascii-linefeed"
673 regex = '\b{start-half}[a-z]+'
674 haystack = 'ABC\nabc'
675 matches = [[4, 7]]
676 bounds = [4, 7]
677 unescape = true
678
679 # Like the carriage return test above, but with a custom line terminator.
680 [[test]]
681 name = "word-start-half-ascii-customlineterm"
682 regex = '\b{start-half}[a-z]+'
683 haystack = 'ABC!abc'
684 matches = [[4, 7]]
685 bounds = [4, 7]
686 unescape = true
687 line-terminator = '!'