Debian Codegraph @

debian/rust-vendor/regex/testdata/regression.toml

raw
1 # See: https://github.com/rust-lang/regex/issues/48
2 [[test]]
3 name = "invalid-regex-no-crash-100"
4 regex = '(*)'
5 haystack = ""
6 matches = []
7 compiles = false
8
9 # See: https://github.com/rust-lang/regex/issues/48
10 [[test]]
11 name = "invalid-regex-no-crash-200"
12 regex = '(?:?)'
13 haystack = ""
14 matches = []
15 compiles = false
16
17 # See: https://github.com/rust-lang/regex/issues/48
18 [[test]]
19 name = "invalid-regex-no-crash-300"
20 regex = '(?)'
21 haystack = ""
22 matches = []
23 compiles = false
24
25 # See: https://github.com/rust-lang/regex/issues/48
26 [[test]]
27 name = "invalid-regex-no-crash-400"
28 regex = '*'
29 haystack = ""
30 matches = []
31 compiles = false
32
33 # See: https://github.com/rust-lang/regex/issues/75
34 [[test]]
35 name = "unsorted-binary-search-100"
36 regex = '(?i-u)[a_]+'
37 haystack = "A_"
38 matches = [[0, 2]]
39
40 # See: https://github.com/rust-lang/regex/issues/75
41 [[test]]
42 name = "unsorted-binary-search-200"
43 regex = '(?i-u)[A_]+'
44 haystack = "a_"
45 matches = [[0, 2]]
46
47 # See: https://github.com/rust-lang/regex/issues/76
48 [[test]]
49 name = "unicode-case-lower-nocase-flag"
50 regex = '(?i)\p{Ll}+'
51 haystack = "ΛΘΓΔα"
52 matches = [[0, 10]]
53
54 # See: https://github.com/rust-lang/regex/issues/99
55 [[test]]
56 name = "negated-char-class-100"
57 regex = '(?i)[^x]'
58 haystack = "x"
59 matches = []
60
61 # See: https://github.com/rust-lang/regex/issues/99
62 [[test]]
63 name = "negated-char-class-200"
64 regex = '(?i)[^x]'
65 haystack = "X"
66 matches = []
67
68 # See: https://github.com/rust-lang/regex/issues/101
69 [[test]]
70 name = "ascii-word-underscore"
71 regex = '[[:word:]]'
72 haystack = "_"
73 matches = [[0, 1]]
74
75 # See: https://github.com/rust-lang/regex/issues/129
76 [[test]]
77 name = "captures-repeat"
78 regex = '([a-f]){2}(?P<foo>[x-z])'
79 haystack = "abx"
80 matches = [
81 [[0, 3], [1, 2], [2, 3]],
82 ]
83
84 # See: https://github.com/rust-lang/regex/issues/153
85 [[test]]
86 name = "alt-in-alt-100"
87 regex = 'ab?|$'
88 haystack = "az"
89 matches = [[0, 1], [2, 2]]
90
91 # See: https://github.com/rust-lang/regex/issues/153
92 [[test]]
93 name = "alt-in-alt-200"
94 regex = '^(?:.*?)(?:\n|\r\n?|$)'
95 haystack = "ab\rcd"
96 matches = [[0, 3]]
97
98 # See: https://github.com/rust-lang/regex/issues/169
99 [[test]]
100 name = "leftmost-first-prefix"
101 regex = 'z*azb'
102 haystack = "azb"
103 matches = [[0, 3]]
104
105 # See: https://github.com/rust-lang/regex/issues/191
106 [[test]]
107 name = "many-alternates"
108 regex = '1|2|3|4|5|6|7|8|9|10|int'
109 haystack = "int"
110 matches = [[0, 3]]
111
112 # See: https://github.com/rust-lang/regex/issues/204
113 [[test]]
114 name = "word-boundary-alone-100"
115 regex = '\b'
116 haystack = "Should this (work?)"
117 matches = [[0, 0], [6, 6], [7, 7], [11, 11], [13, 13], [17, 17]]
118
119 # See: https://github.com/rust-lang/regex/issues/204
120 [[test]]
121 name = "word-boundary-alone-200"
122 regex = '\b'
123 haystack = "a b c"
124 matches = [[0, 0], [1, 1], [2, 2], [3, 3], [4, 4], [5, 5]]
125
126 # See: https://github.com/rust-lang/regex/issues/264
127 [[test]]
128 name = "word-boundary-ascii-no-capture"
129 regex = '\B'
130 haystack = "\U00028F3E"
131 matches = [[0, 0], [1, 1], [2, 2], [3, 3], [4, 4]]
132 unicode = false
133 utf8 = false
134
135 # See: https://github.com/rust-lang/regex/issues/264
136 [[test]]
137 name = "word-boundary-ascii-capture"
138 regex = '(?:\B)'
139 haystack = "\U00028F3E"
140 matches = [[0, 0], [1, 1], [2, 2], [3, 3], [4, 4]]
141 unicode = false
142 utf8 = false
143
144 # See: https://github.com/rust-lang/regex/issues/268
145 [[test]]
146 name = "partial-anchor"
147 regex = '^a|b'
148 haystack = "ba"
149 matches = [[0, 1]]
150
151 # See: https://github.com/rust-lang/regex/issues/271
152 [[test]]
153 name = "endl-or-word-boundary"
154 regex = '(?m:$)|(?-u:\b)'
155 haystack = "\U0006084E"
156 matches = [[4, 4]]
157
158 # See: https://github.com/rust-lang/regex/issues/271
159 [[test]]
160 name = "zero-or-end"
161 regex = '(?i-u:\x00)|$'
162 haystack = "\U000E682F"
163 matches = [[4, 4]]
164
165 # See: https://github.com/rust-lang/regex/issues/271
166 [[test]]
167 name = "y-or-endl"
168 regex = '(?i-u:y)|(?m:$)'
169 haystack = "\U000B4331"
170 matches = [[4, 4]]
171
172 # See: https://github.com/rust-lang/regex/issues/271
173 [[test]]
174 name = "word-boundary-start-x"
175 regex = '(?u:\b)^(?-u:X)'
176 haystack = "X"
177 matches = [[0, 1]]
178
179 # See: https://github.com/rust-lang/regex/issues/271
180 [[test]]
181 name = "word-boundary-ascii-start-x"
182 regex = '(?-u:\b)^(?-u:X)'
183 haystack = "X"
184 matches = [[0, 1]]
185
186 # See: https://github.com/rust-lang/regex/issues/271
187 [[test]]
188 name = "end-not-word-boundary"
189 regex = '$\B'
190 haystack = "\U0005C124\U000B576C"
191 matches = [[8, 8]]
192 unicode = false
193 utf8 = false
194
195 # See: https://github.com/rust-lang/regex/issues/280
196 [[test]]
197 name = "partial-anchor-alternate-begin"
198 regex = '^a|z'
199 haystack = "yyyyya"
200 matches = []
201
202 # See: https://github.com/rust-lang/regex/issues/280
203 [[test]]
204 name = "partial-anchor-alternate-end"
205 regex = 'a$|z'
206 haystack = "ayyyyy"
207 matches = []
208
209 # See: https://github.com/rust-lang/regex/issues/289
210 [[test]]
211 name = "lits-unambiguous-100"
212 regex = '(?:ABC|CDA|BC)X'
213 haystack = "CDAX"
214 matches = [[0, 4]]
215
216 # See: https://github.com/rust-lang/regex/issues/291
217 [[test]]
218 name = "lits-unambiguous-200"
219 regex = '((IMG|CAM|MG|MB2)_|(DSCN|CIMG))(?P<n>[0-9]+)$'
220 haystack = "CIMG2341"
221 matches = [
222 [[0, 8], [0, 4], [], [0, 4], [4, 8]],
223 ]
224
225 # See: https://github.com/rust-lang/regex/issues/303
226 #
227 # 2022-09-19: This has now been "properly" fixed in that empty character
228 # classes are fully supported as something that can never match. This test
229 # used to be marked as 'compiles = false', but now it works.
230 [[test]]
231 name = "negated-full-byte-range"
232 regex = '[^\x00-\xFF]'
233 haystack = ""
234 matches = []
235 compiles = true
236 unicode = false
237 utf8 = false
238
239 # See: https://github.com/rust-lang/regex/issues/321
240 [[test]]
241 name = "strange-anchor-non-complete-prefix"
242 regex = 'a^{2}'
243 haystack = ""
244 matches = []
245
246 # See: https://github.com/rust-lang/regex/issues/321
247 [[test]]
248 name = "strange-anchor-non-complete-suffix"
249 regex = '${2}a'
250 haystack = ""
251 matches = []
252
253 # See: https://github.com/rust-lang/regex/issues/334
254 # See: https://github.com/rust-lang/regex/issues/557
255 [[test]]
256 name = "captures-after-dfa-premature-end-100"
257 regex = 'a(b*(X|$))?'
258 haystack = "abcbX"
259 matches = [
260 [[0, 1], [], []],
261 ]
262
263 # See: https://github.com/rust-lang/regex/issues/334
264 # See: https://github.com/rust-lang/regex/issues/557
265 [[test]]
266 name = "captures-after-dfa-premature-end-200"
267 regex = 'a(bc*(X|$))?'
268 haystack = "abcbX"
269 matches = [
270 [[0, 1], [], []],
271 ]
272
273 # See: https://github.com/rust-lang/regex/issues/334
274 # See: https://github.com/rust-lang/regex/issues/557
275 [[test]]
276 name = "captures-after-dfa-premature-end-300"
277 regex = '(aa$)?'
278 haystack = "aaz"
279 matches = [
280 [[0, 0], []],
281 [[1, 1], []],
282 [[2, 2], []],
283 [[3, 3], []],
284 ]
285
286 # Plucked from "Why aren’t regular expressions a lingua franca? an empirical
287 # study on the re-use and portability of regular expressions", The ACM Joint
288 # European Software Engineering Conference and Symposium on the Foundations of
289 # Software Engineering (ESEC/FSE), 2019.
290 #
291 # Link: https://dl.acm.org/doi/pdf/10.1145/3338906.3338909
292 [[test]]
293 name = "captures-after-dfa-premature-end-400"
294 regex = '(a)\d*\.?\d+\b'
295 haystack = "a0.0c"
296 matches = [
297 [[0, 2], [0, 1]],
298 ]
299
300 # See: https://github.com/rust-lang/regex/issues/437
301 [[test]]
302 name = "literal-panic"
303 regex = 'typename type\-parameter\-[0-9]+\-[0-9]+::.+'
304 haystack = "test"
305 matches = []
306
307 # See: https://github.com/rust-lang/regex/issues/527
308 [[test]]
309 name = "empty-flag-expr"
310 regex = '(?:(?:(?x)))'
311 haystack = ""
312 matches = [[0, 0]]
313
314 # See: https://github.com/rust-lang/regex/issues/533
315 #[[tests]]
316 #name = "blank-matches-nothing-between-space-and-tab"
317 #regex = '[[:blank:]]'
318 #input = '\x0A\x0B\x0C\x0D\x0E\x0F\x10\x11\x12\x13\x14\x15\x16\x17\x18\x19\x1A\x1B\x1C\x1D\x1E\x1F'
319 #match = false
320 #unescape = true
321
322 # See: https://github.com/rust-lang/regex/issues/533
323 #[[tests]]
324 #name = "blank-matches-nothing-between-space-and-tab-inverted"
325 #regex = '^[[:^blank:]]+$'
326 #input = '\x0A\x0B\x0C\x0D\x0E\x0F\x10\x11\x12\x13\x14\x15\x16\x17\x18\x19\x1A\x1B\x1C\x1D\x1E\x1F'
327 #match = true
328 #unescape = true
329
330 # See: https://github.com/rust-lang/regex/issues/555
331 [[test]]
332 name = "invalid-repetition"
333 regex = '(?m){1,1}'
334 haystack = ""
335 matches = []
336 compiles = false
337
338 # See: https://github.com/rust-lang/regex/issues/640
339 [[test]]
340 name = "flags-are-unset"
341 regex = '(?:(?i)foo)|Bar'
342 haystack = "foo Foo bar Bar"
343 matches = [[0, 3], [4, 7], [12, 15]]
344
345 # Note that 'Ј' is not 'j', but cyrillic Je
346 # https://en.wikipedia.org/wiki/Je_(Cyrillic)
347 #
348 # See: https://github.com/rust-lang/regex/issues/659
349 [[test]]
350 name = "empty-group-with-unicode"
351 regex = '(?:)Ј01'
352 haystack = 'zЈ01'
353 matches = [[1, 5]]
354
355 # See: https://github.com/rust-lang/regex/issues/579
356 [[test]]
357 name = "word-boundary-weird"
358 regex = '\b..\b'
359 haystack = "I have 12, he has 2!"
360 matches = [[0, 2], [7, 9], [9, 11], [11, 13], [17, 19]]
361
362 # See: https://github.com/rust-lang/regex/issues/579
363 [[test]]
364 name = "word-boundary-weird-ascii"
365 regex = '\b..\b'
366 haystack = "I have 12, he has 2!"
367 matches = [[0, 2], [7, 9], [9, 11], [11, 13], [17, 19]]
368 unicode = false
369 utf8 = false
370
371 # See: https://github.com/rust-lang/regex/issues/579
372 [[test]]
373 name = "word-boundary-weird-minimal-ascii"
374 regex = '\b..\b'
375 haystack = "az,,b"
376 matches = [[0, 2], [2, 4]]
377 unicode = false
378 utf8 = false
379
380 # See: https://github.com/BurntSushi/ripgrep/issues/1203
381 [[test]]
382 name = "reverse-suffix-100"
383 regex = '[0-4][0-4][0-4]000'
384 haystack = "153.230000"
385 matches = [[4, 10]]
386
387 # See: https://github.com/BurntSushi/ripgrep/issues/1203
388 [[test]]
389 name = "reverse-suffix-200"
390 regex = '[0-9][0-9][0-9]000'
391 haystack = "153.230000\n"
392 matches = [[4, 10]]
393
394 # This is a tricky case for the reverse suffix optimization, because it
395 # finds the 'foobar' match but the reverse scan must fail to find a match by
396 # correctly dealing with the word boundary following the 'foobar' literal when
397 # computing the start state.
398 #
399 # This test exists because I tried to break the following assumption that
400 # is currently in the code: that if a suffix is found and the reverse scan
401 # succeeds, then it's guaranteed that there is an overall match. Namely, the
402 # 'is_match' routine does *not* do another forward scan in this case because of
403 # this assumption.
404 [[test]]
405 name = "reverse-suffix-300"
406 regex = '\w+foobar\b'
407 haystack = "xyzfoobarZ"
408 matches = []
409 unicode = false
410 utf8 = false
411
412 # See: https://github.com/rust-lang/regex/issues/1354
413 [[test]]
414 name = 'reverse-suffix-start-of-match-failure-010'
415 regex = '.abb|b'
416 haystack = 'zabb'
417 matches = [[0, 4]]
418
419 # See: https://github.com/rust-lang/regex/issues/1354
420 [[test]]
421 name = 'reverse-suffix-start-of-match-failure-011'
422 regex = '.bb|b'
423 haystack = 'zabb'
424 matches = [[1, 4]]
425
426 # See: https://github.com/rust-lang/regex/issues/1354
427 # See: https://github.com/rust-lang/regex/pull/1355
428 [[test]]
429 name = 'reverse-suffix-start-of-match-failure-012'
430 regex = '.abb|b'
431 haystack = 'zzzabbz'
432 matches = [[2, 6]]
433
434 # Like above, but use something other than a fixed `.`. Just as something more
435 # robust to potential future optimizations that could hide this bug.
436 #
437 # See: https://github.com/rust-lang/regex/issues/1354
438 [[test]]
439 name = 'reverse-suffix-start-of-match-failure-020'
440 regex = '\s+\w+bb|b'
441 haystack = " zabb"
442 matches = [[0, 5]]
443
444 # A trailing class can consume the entire suffix literal, but the variable
445 # length prefix before it can still make the first candidate non-leftmost.
446 [[test]]
447 name = 'reverse-suffix-start-of-match-failure-030'
448 regex = '(?:[a-wyz]{3}|[a-wyz]).b'
449 haystack = 'xaaabb'
450 matches = [[1, 6]]
451
452 # A component immediately before the suffix can be disjoint from the suffix
453 # while an earlier candidate still occurs in the prefix before it.
454 [[test]]
455 name = 'reverse-suffix-start-of-match-failure-040'
456 regex = '(?:[ac-z]{2}b[ac-z])?[ac-z]b'
457 haystack = '!aabaab'
458 matches = [[1, 7]]
459
460 # An unbounded trailing class can absorb the suffix without making the first
461 # literal candidate correspond to the leftmost match.
462 [[test]]
463 name = 'reverse-suffix-start-of-match-failure-050'
464 regex = '(?:[a-z]cb|c)[a-z]*b'
465 haystack = '!acbzb'
466 matches = [[1, 6]]
467
468 # Rejecting the reverse suffix strategy falls back to Core. Its automatic
469 # prefix prefilter must not skip the leftmost match.
470 [[test]]
471 name = 'reverse-suffix-rejected-fallback-prefilter-010'
472 regex = '(?:ab|c)*c'
473 haystack = 'cabac'
474 matches = [[0, 1]]
475 match-limit = 1
476
477 # A required character-class separator lets the reverse suffix scan reject an
478 # earlier literal occurrence inside the prefix without rescanning the haystack.
479 [[test]]
480 name = 'reverse-suffix-required-class-separator-010'
481 regex = '\w+\s+Holmes'
482 haystack = 'abcHolmes xyz Holmes'
483 matches = [[10, 20]]
484
485 # Checking only the component immediately before the separator is not enough.
486 # The earlier prefix can contain another complete separator alignment.
487 [[test]]
488 name = 'reverse-suffix-required-class-separator-020'
489 regex = '(?:.abc)?a+b+c'
490 haystack = 'xabcabc'
491 matches = [[0, 7]]
492
493 # See: https://github.com/rust-lang/regex/issues/1354
494 [[test]]
495 name = 'reverse-suffix-all-no-early-matches-010'
496 regex = '.abb|b'
497 haystack = 'xxfoobarbar'
498 match-kind = 'all'
499 matches = [[8, 9]]
500
501 # See: https://github.com/BurntSushi/ripgrep/issues/1247
502 [[test]]
503 name = "stops"
504 regex = '\bs(?:[ab])'
505 haystack = 's\xE4'
506 matches = []
507 unescape = true
508 utf8 = false
509
510 # See: https://github.com/BurntSushi/ripgrep/issues/1247
511 [[test]]
512 name = "stops-ascii"
513 regex = '(?-u:\b)s(?:[ab])'
514 haystack = 's\xE4'
515 matches = []
516 unescape = true
517 utf8 = false
518
519 # See: https://github.com/rust-lang/regex/issues/850
520 [[test]]
521 name = "adjacent-line-boundary-100"
522 regex = '(?m)^(?:[^ ]+?)$'
523 haystack = "line1\nline2"
524 matches = [[0, 5], [6, 11]]
525
526 # Continued.
527 [[test]]
528 name = "adjacent-line-boundary-200"
529 regex = '(?m)^(?:[^ ]+?)$'
530 haystack = "A\nB"
531 matches = [[0, 1], [2, 3]]
532
533 # There is no issue for this bug.
534 [[test]]
535 name = "anchored-prefix-100"
536 regex = '^a[[:^space:]]'
537 haystack = "a "
538 matches = []
539
540 # There is no issue for this bug.
541 [[test]]
542 name = "anchored-prefix-200"
543 regex = '^a[[:^space:]]'
544 haystack = "foo boo a"
545 matches = []
546
547 # There is no issue for this bug.
548 [[test]]
549 name = "anchored-prefix-300"
550 regex = '^-[a-z]'
551 haystack = "r-f"
552 matches = []
553
554 # Tests that a possible Aho-Corasick optimization works correctly. It only
555 # kicks in when we have a lot of literals. By "works correctly," we mean that
556 # leftmost-first match semantics are properly respected. That is, samwise
557 # should match, not sam.
558 #
559 # There is no issue for this bug.
560 [[test]]
561 name = "aho-corasick-100"
562 regex = 'samwise|sam|a|b|c|d|e|f|g|h|i|j|k|l|m|n|o|p|q|r|s|t|u|v|w|x|y|z|A|B|C|D|E|F|G|H|I|J|K|L|M|N|O|P|Q|R|S|T|U|V|W|X|Y|Z'
563 haystack = "samwise"
564 matches = [[0, 7]]
565
566 # See: https://github.com/rust-lang/regex/issues/921
567 [[test]]
568 name = "interior-anchor-capture"
569 regex = '(a$)b$'
570 haystack = 'ab'
571 matches = []
572
573 # I found this bug in the course of adding some of the regexes that Ruff uses
574 # to rebar. It turns out that the lazy DFA was finding a match that was being
575 # rejected by the one-pass DFA. Yikes. I then minimized the regex and haystack.
576 #
577 # Source: https://github.com/charliermarsh/ruff/blob/a919041ddaa64cdf6f216f90dd0480dab69fd3ba/crates/ruff/src/rules/pycodestyle/rules/whitespace_around_keywords.rs#L52
578 [[test]]
579 name = "ruff-whitespace-around-keywords"
580 regex = '^(a|ab)$'
581 haystack = "ab"
582 anchored = true
583 unicode = false
584 utf8 = true
585 matches = [[[0, 2], [0, 2]]]
586
587 # From: https://github.com/rust-lang/regex/issues/429
588 [[test]]
589 name = "i429-0"
590 regex = '(?:(?-u:\b)|(?u:h))+'
591 haystack = "h"
592 unicode = true
593 utf8 = false
594 matches = [[0, 0], [1, 1]]
595
596 # From: https://github.com/rust-lang/regex/issues/429
597 [[test]]
598 name = "i429-1"
599 regex = '(?u:\B)'
600 haystack = "鋸"
601 unicode = true
602 utf8 = false
603 matches = []
604
605 # From: https://github.com/rust-lang/regex/issues/429
606 [[test]]
607 name = "i429-2"
608 regex = '(?:(?u:\b)|(?s-u:.))+'
609 haystack = "oB"
610 unicode = true
611 utf8 = false
612 matches = [[0, 0], [1, 2]]
613
614 # From: https://github.com/rust-lang/regex/issues/429
615 [[test]]
616 name = "i429-3"
617 regex = '(?:(?-u:\B)|(?su:.))+'
618 haystack = "\U000FEF80"
619 unicode = true
620 utf8 = false
621 matches = [[0, 0], [1, 1], [2, 2], [3, 3], [4, 4]]
622
623 # From: https://github.com/rust-lang/regex/issues/429
624 [[test]]
625 name = "i429-3-utf8"
626 regex = '(?:(?-u:\B)|(?su:.))+'
627 haystack = "\U000FEF80"
628 unicode = true
629 utf8 = true
630 matches = [[0, 0], [4, 4]]
631
632 # From: https://github.com/rust-lang/regex/issues/429
633 [[test]]
634 name = "i429-4"
635 regex = '(?m:$)(?m:^)(?su:.)'
636 haystack = "\n‣"
637 unicode = true
638 utf8 = false
639 matches = [[0, 1]]
640
641 # From: https://github.com/rust-lang/regex/issues/429
642 [[test]]
643 name = "i429-5"
644 regex = '(?m:$)^(?m:^)'
645 haystack = "\n"
646 unicode = true
647 utf8 = false
648 matches = [[0, 0]]
649
650 # From: https://github.com/rust-lang/regex/issues/429
651 [[test]]
652 name = "i429-6"
653 regex = '(?P<kp>(?iu:do)(?m:$))*'
654 haystack = "dodo"
655 unicode = true
656 utf8 = false
657 matches = [
658 [[0, 0], []],
659 [[1, 1], []],
660 [[2, 4], [2, 4]],
661 ]
662
663 # From: https://github.com/rust-lang/regex/issues/429
664 [[test]]
665 name = "i429-7"
666 regex = '(?u:\B)'
667 haystack = "䡁"
668 unicode = true
669 utf8 = false
670 matches = []
671
672 # From: https://github.com/rust-lang/regex/issues/429
673 [[test]]
674 name = "i429-8"
675 regex = '(?:(?-u:\b)|(?u:[\u{0}-W]))+'
676 haystack = "0"
677 unicode = true
678 utf8 = false
679 matches = [[0, 0], [1, 1]]
680
681 # From: https://github.com/rust-lang/regex/issues/429
682 [[test]]
683 name = "i429-9"
684 regex = '((?m:$)(?-u:\B)(?s-u:.)(?-u:\B)$)'
685 haystack = "\n\n"
686 unicode = true
687 utf8 = false
688 matches = [
689 [[1, 2], [1, 2]],
690 ]
691
692 # From: https://github.com/rust-lang/regex/issues/429
693 [[test]]
694 name = "i429-10"
695 regex = '(?m:$)(?m:$)^(?su:.)'
696 haystack = "\n\u0081¨\u200a"
697 unicode = true
698 utf8 = false
699 matches = [[0, 1]]
700
701 # From: https://github.com/rust-lang/regex/issues/429
702 [[test]]
703 name = "i429-11"
704 regex = '(?-u:\B)(?m:^)'
705 haystack = "0\n"
706 unicode = true
707 utf8 = false
708 matches = [[2, 2]]
709
710 # From: https://github.com/rust-lang/regex/issues/429
711 [[test]]
712 name = "i429-12"
713 regex = '(?:(?u:\b)|(?-u:.))+'
714 haystack = "0"
715 unicode = true
716 utf8 = false
717 matches = [[0, 0], [1, 1]]
718
719 # From: https://github.com/rust-lang/regex/issues/969
720 [[test]]
721 name = "i969"
722 regex = 'c.*d\z'
723 haystack = "ababcd"
724 bounds = [4, 6]
725 search-kind = "earliest"
726 matches = [[4, 6]]
727
728 # I found this during the regex-automata migration. This is the fowler basic
729 # 154 test, but without anchored = true and without a match limit.
730 #
731 # This test caught a subtle bug in the hybrid reverse DFA search, where it
732 # would skip over the termination condition if it entered a start state. This
733 # was a double bug. Firstly, the reverse DFA shouldn't have had start states
734 # specialized in the first place, and thus it shouldn't have possible to detect
735 # that the DFA had entered a start state. The second bug was that the start
736 # state handling was incorrect by jumping over the termination condition.
737 [[test]]
738 name = "fowler-basic154-unanchored"
739 regex = '''a([bc]*)c*'''
740 haystack = '''abc'''
741 matches = [[[0, 3], [1, 3]]]
742
743 # From: https://github.com/rust-lang/regex/issues/981
744 #
745 # This was never really a problem in the new architecture because the
746 # regex-automata engines are far more principled about how they deal with
747 # look-around. (This was one of the many reasons I wanted to re-work the
748 # original regex crate engines.)
749 [[test]]
750 name = "word-boundary-interact-poorly-with-literal-optimizations"
751 regex = '(?i:(?:\b|_)win(?:32|64|dows)?(?:\b|_))'
752 haystack = 'ubi-Darwin-x86_64.tar.gz'
753 matches = []
754
755 # This was found during fuzz testing of regex. It provoked a panic in the meta
756 # engine as a result of the reverse suffix optimization. Namely, it hit a case
757 # where a suffix match was found, a corresponding reverse match was found, but
758 # the forward search turned up no match. The forward search should always match
759 # if the suffix and reverse search match.
760 #
761 # This in turn uncovered an inconsistency between the PikeVM and the DFA (lazy
762 # and fully compiled) engines. It was caused by a mishandling of the collection
763 # of NFA state IDs in the generic determinization code (which is why both types
764 # of DFA were impacted). Namely, when a fail state was encountered (that's the
765 # `[^\s\S]` in the pattern below), then it would just stop collecting states.
766 # But that's not correct since a later state could lead to a match.
767 [[test]]
768 name = "impossible-branch"
769 regex = '.*[^\s\S]A|B'
770 haystack = "B"
771 matches = [[0, 1]]
772
773 # This was found during fuzz testing in regex-lite. The regex crate never
774 # suffered from this bug, but it causes regex-lite to incorrectly compile
775 # captures.
776 [[test]]
777 name = "captures-wrong-order"
778 regex = '(a){0}(a)'
779 haystack = 'a'
780 matches = [[[0, 1], [], [0, 1]]]
781
782 # This tests a bug in how quit states are handled in the DFA. At some point
783 # during development, the DFAs were tweaked slightly such that if they hit
784 # a quit state (which means, they hit a byte that the caller configured should
785 # stop the search), then it might not return an error necessarily. Namely, if a
786 # match had already been found, then it would be returned instead of an error.
787 #
788 # But this is actually wrong! Why? Because even though a match had been found,
789 # it wouldn't be fully correct to return it once a quit state has been seen
790 # because you can't determine whether the match offset returned is the correct
791 # greedy/leftmost-first match. Since you can't complete the search as requested
792 # by the caller, the DFA should just stop and return an error.
793 #
794 # Interestingly, this does seem to produce an unavoidable difference between
795 # 'try_is_match().unwrap()' and 'try_find().unwrap().is_some()' for the DFAs.
796 # The former will stop immediately once a match is known to occur and return
797 # 'Ok(true)', where as the latter could find the match but quit with an
798 # 'Err(..)' first.
799 #
800 # Thankfully, I believe this inconsistency between 'is_match()' and 'find()'
801 # cannot be observed in the higher level meta regex API because it specifically
802 # will try another engine that won't fail in the case of a DFA failing.
803 #
804 # This regression happened in the regex crate rewrite, but before anything got
805 # released.
806 [[test]]
807 name = "negated-unicode-word-boundary-dfa-fail"
808 regex = '\B.*'
809 haystack = "!\u02D7"
810 matches = [[0, 3]]
811
812 # This failure was found in the *old* regex crate (prior to regex 1.9), but
813 # I didn't investigate why. My best guess is that it's a literal optimization
814 # bug. It didn't occur in the rewrite.
815 [[test]]
816 name = "missed-match"
817 regex = 'e..+e.ee>'
818 haystack = 'Zeee.eZZZZZZZZeee>eeeeeee>'
819 matches = [[1, 26]]
820
821 # This test came from the 'ignore' crate and tripped a bug in how accelerated
822 # DFA states were handled in an overlapping search.
823 [[test]]
824 name = "regex-to-glob"
825 regex = ['(?-u)^path1/[^/]*$']
826 haystack = "path1/foo"
827 matches = [[0, 9]]
828 utf8 = false
829 match-kind = "all"
830 search-kind = "overlapping"
831
832 # See: https://github.com/rust-lang/regex/issues/1060
833 [[test]]
834 name = "reverse-inner-plus-shorter-than-expected"
835 regex = '(?:(\d+)[:.])?(\d{1,2})[:.](\d{2})'
836 haystack = '102:12:39'
837 matches = [[[0, 9], [0, 3], [4, 6], [7, 9]]]
838
839 # Like reverse-inner-plus-shorter-than-expected, but using a far simpler regex
840 # to demonstrate the extent of the rot. Sigh.
841 #
842 # See: https://github.com/rust-lang/regex/issues/1060
843 [[test]]
844 name = "reverse-inner-short"
845 regex = '(?:([0-9][0-9][0-9]):)?([0-9][0-9]):([0-9][0-9])'
846 haystack = '102:12:39'
847 matches = [[[0, 9], [0, 3], [4, 6], [7, 9]]]
848
849
850 # See: https://github.com/rust-lang/regex/issues/1354
851 [[test]]
852 name = 'reverse-inner-start-of-match-failure-010'
853 regex = '(?:..acbb|b)a(?:c|d)'
854 haystack = 'xzbacbbac'
855 matches = [[1, 9]]
856
857 # Like above, but use something other than a fixed `.`. Just as something more
858 # robust to potential future optimizations that could hide this bug.
859 #
860 # See: https://github.com/rust-lang/regex/issues/1354
861 [[test]]
862 name = 'reverse-inner-start-of-match-failure-011'
863 regex = '(?:\s+.\w+acbb|b)a(?:c|d)'
864 haystack = ' xzbacbbac'
865 matches = [[0, 10]]
866
867 # See: https://github.com/rust-lang/regex/issues/1354
868 [[test]]
869 name = 'reverse-inner-later-literal-010'
870 regex = '(?:..acbb|b)a(?:c|d)'
871 haystack = 'xzbacbbac'
872 matches = [[1, 9]]
873
874 # A literal candidate can cross from the prefix into a different extracted
875 # literal even when the prefix cannot contain either complete literal.
876 [[test]]
877 name = 'reverse-inner-start-of-match-failure-020'
878 regex = '(?:[ac-z]{3}|[ac-z])(?:aba|baa)'
879 haystack = '!aaabaa'
880 matches = [[1, 7]]
881
882 # Rejecting the reverse inner strategy falls back to Core. Its automatic
883 # prefix prefilter must not skip the leftmost match.
884 [[test]]
885 name = 'reverse-inner-rejected-fallback-prefilter-010'
886 regex = '(?:ab|c)*c[de]*'
887 haystack = 'cabac'
888 matches = [[0, 1]]
889 match-limit = 1
890
891 # A required class separator prevents the first inner literal occurrence from
892 # confirming inside the prefix.
893 [[test]]
894 name = 'reverse-inner-required-class-separator-010'
895 regex = '\w+\s+Holmes\s+\w+'
896 haystack = 'abcHolmes xyz Holmes tail'
897 matches = [[10, 25]]
898
899 # The entire prefix before the separator must be disjoint from it. Checking
900 # only the immediately preceding component would incorrectly return 1..7.
901 [[test]]
902 name = 'reverse-inner-required-class-separator-020'
903 regex = '(?:.abc)?a+b+c.*'
904 haystack = 'xabcabc'
905 matches = [[0, 7]]
906
907 # A required class separator at the beginning of the prefix makes an inner
908 # literal occurrence inside the bounded repetition safe to reject.
909 [[test]]
910 name = 'reverse-inner-leading-class-separator-010'
911 regex = '\s[A-Za-z]{0,12}ing\s'
912 haystack = ' xingabcing '
913 matches = [[0, 12]]
914
915 # This regression test was found via the RegexSet APIs. It triggered a
916 # particular code path where a regex was compiled with 'All' match semantics
917 # (to support overlapping search), but got funneled down into a standard
918 # leftmost search when calling 'is_match'. This is fine on its own, but the
919 # leftmost search will use a prefilter and that's where this went awry.
920 #
921 # Namely, since 'All' semantics were used, the aho-corasick prefilter was
922 # incorrectly compiled with 'Standard' semantics. This was wrong because
923 # 'Standard' immediately attempts to report a match at every position, even if
924 # that would mean reporting a match past the leftmost match before reporting
925 # the leftmost match. This breaks the prefilter contract of never having false
926 # negatives and leads overall to the engine not finding a match.
927 #
928 # See: https://github.com/rust-lang/regex/issues/1070
929 [[test]]
930 name = "prefilter-with-aho-corasick-standard-semantics"
931 regex = '(?m)^ *v [0-9]'
932 haystack = 'v 0'
933 matches = [
934 { id = 0, spans = [[0, 3]] },
935 ]
936 match-kind = "all"
937 search-kind = "overlapping"
938 unicode = true
939 utf8 = true
940
941 # This tests that the PikeVM and the meta regex agree on a particular regex.
942 # This test previously failed when the ad hoc engines inside the meta engine
943 # did not handle quit states correctly. Namely, the Unicode word boundary here
944 # combined with a non-ASCII codepoint provokes the quit state. The ad hoc
945 # engines were previously returning a match even after entering the quit state
946 # if a match had been previously detected, but this is incorrect. The reason
947 # is that if a quit state is found, then the search must give up *immediately*
948 # because it prevents the search from finding the "proper" leftmost-first
949 # match. If it instead returns a match that has been found, it risks reporting
950 # an improper match, as it did in this case.
951 #
952 # See: https://github.com/rust-lang/regex/issues/1046
953 [[test]]
954 name = "non-prefix-literal-quit-state"
955 regex = '.+\b\n'
956 haystack = "β77\n"
957 matches = [[0, 5]]
958
959 # This is a regression test for some errant HIR interval set operations that
960 # were made in the regex-syntax 0.8.0 release and then reverted in 0.8.1. The
961 # issue here is that the HIR produced from the regex had out-of-order ranges.
962 #
963 # See: https://github.com/rust-lang/regex/issues/1103
964 # Ref: https://github.com/rust-lang/regex/pull/1051
965 # Ref: https://github.com/rust-lang/regex/pull/1102
966 [[test]]
967 name = "hir-optimization-out-of-order-class"
968 regex = '^[[:alnum:]./-]+$'
969 haystack = "a-b"
970 matches = [[0, 3]]
971
972 # This is a regression test for an improper reverse suffix optimization. This
973 # occurred when I "broadened" the applicability of the optimization to include
974 # multiple possible literal suffixes instead of only sticking to a non-empty
975 # longest common suffix. It turns out that, at least given how the reverse
976 # suffix optimization works, we need to stick to the longest common suffix for
977 # now.
978 #
979 # See: https://github.com/rust-lang/regex/issues/1110
980 # See also: https://github.com/astral-sh/ruff/pull/7980
981 [[test]]
982 name = 'improper-reverse-suffix-optimization'
983 regex = '(\\N\{[^}]+})|([{}])'
984 haystack = 'hiya \N{snowman} bye'
985 matches = [[[5, 16], [5, 16], []]]