summaryrefslogtreecommitdiffstats
path: root/vendor/regex/testdata/overlapping.toml
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-06-19 09:26:03 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-06-19 09:26:03 +0000
commit9918693037dce8aa4bb6f08741b6812923486c18 (patch)
tree21d2b40bec7e6a7ea664acee056eb3d08e15a1cf /vendor/regex/testdata/overlapping.toml
parentReleasing progress-linux version 1.75.0+dfsg1-5~progress7.99u1. (diff)
downloadrustc-9918693037dce8aa4bb6f08741b6812923486c18.tar.xz
rustc-9918693037dce8aa4bb6f08741b6812923486c18.zip
Merging upstream version 1.76.0+dfsg1.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'vendor/regex/testdata/overlapping.toml')
-rw-r--r--vendor/regex/testdata/overlapping.toml280
1 files changed, 280 insertions, 0 deletions
diff --git a/vendor/regex/testdata/overlapping.toml b/vendor/regex/testdata/overlapping.toml
new file mode 100644
index 000000000..7bcd45a2f
--- /dev/null
+++ b/vendor/regex/testdata/overlapping.toml
@@ -0,0 +1,280 @@
+# NOTE: We define a number of tests where the *match* kind is 'leftmost-first'
+# but the *search* kind is 'overlapping'. This is a somewhat nonsensical
+# combination and can produce odd results. Nevertheless, those results should
+# be consistent so we test them here. (At the time of writing this note, I
+# hadn't yet decided whether to make 'leftmost-first' with 'overlapping' result
+# in unspecified behavior.)
+
+# This demonstrates how a full overlapping search is obvious quadratic. This
+# regex reports a match for every substring in the haystack.
+[[test]]
+name = "ungreedy-dotstar-matches-everything-100"
+regex = [".*?"]
+haystack = "zzz"
+matches = [
+ { id = 0, span = [0, 0] },
+ { id = 0, span = [1, 1] },
+ { id = 0, span = [0, 1] },
+ { id = 0, span = [2, 2] },
+ { id = 0, span = [1, 2] },
+ { id = 0, span = [0, 2] },
+ { id = 0, span = [3, 3] },
+ { id = 0, span = [2, 3] },
+ { id = 0, span = [1, 3] },
+ { id = 0, span = [0, 3] },
+]
+match-kind = "all"
+search-kind = "overlapping"
+
+[[test]]
+name = "greedy-dotstar-matches-everything-100"
+regex = [".*"]
+haystack = "zzz"
+matches = [
+ { id = 0, span = [0, 0] },
+ { id = 0, span = [1, 1] },
+ { id = 0, span = [0, 1] },
+ { id = 0, span = [2, 2] },
+ { id = 0, span = [1, 2] },
+ { id = 0, span = [0, 2] },
+ { id = 0, span = [3, 3] },
+ { id = 0, span = [2, 3] },
+ { id = 0, span = [1, 3] },
+ { id = 0, span = [0, 3] },
+]
+match-kind = "all"
+search-kind = "overlapping"
+
+[[test]]
+name = "repetition-plus-leftmost-first-100"
+regex = 'a+'
+haystack = "aaa"
+matches = [[0, 1], [1, 2], [0, 2], [2, 3], [1, 3], [0, 3]]
+match-kind = "leftmost-first"
+search-kind = "overlapping"
+
+[[test]]
+name = "repetition-plus-leftmost-first-110"
+regex = '☃+'
+haystack = "☃☃☃"
+matches = [[0, 3], [3, 6], [0, 6], [6, 9], [3, 9], [0, 9]]
+match-kind = "leftmost-first"
+search-kind = "overlapping"
+
+[[test]]
+name = "repetition-plus-all-100"
+regex = 'a+'
+haystack = "aaa"
+matches = [[0, 1], [1, 2], [0, 2], [2, 3], [1, 3], [0, 3]]
+match-kind = "all"
+search-kind = "overlapping"
+
+[[test]]
+name = "repetition-plus-all-110"
+regex = '☃+'
+haystack = "☃☃☃"
+matches = [[0, 3], [3, 6], [0, 6], [6, 9], [3, 9], [0, 9]]
+match-kind = "all"
+search-kind = "overlapping"
+
+[[test]]
+name = "repetition-plus-leftmost-first-200"
+regex = '(abc)+'
+haystack = "zzabcabczzabc"
+matches = [
+ [[2, 5], [2, 5]],
+ [[5, 8], [5, 8]],
+ [[2, 8], [5, 8]],
+]
+match-kind = "leftmost-first"
+search-kind = "overlapping"
+
+[[test]]
+name = "repetition-plus-all-200"
+regex = '(abc)+'
+haystack = "zzabcabczzabc"
+matches = [
+ [[2, 5], [2, 5]],
+ [[5, 8], [5, 8]],
+ [[2, 8], [5, 8]],
+ [[10, 13], [10, 13]],
+]
+match-kind = "all"
+search-kind = "overlapping"
+
+[[test]]
+name = "repetition-star-leftmost-first-100"
+regex = 'a*'
+haystack = "aaa"
+matches = [
+ [0, 0],
+ [1, 1],
+ [0, 1],
+ [2, 2],
+ [1, 2],
+ [0, 2],
+ [3, 3],
+ [2, 3],
+ [1, 3],
+ [0, 3],
+]
+match-kind = "leftmost-first"
+search-kind = "overlapping"
+
+[[test]]
+name = "repetition-star-all-100"
+regex = 'a*'
+haystack = "aaa"
+matches = [
+ [0, 0],
+ [1, 1],
+ [0, 1],
+ [2, 2],
+ [1, 2],
+ [0, 2],
+ [3, 3],
+ [2, 3],
+ [1, 3],
+ [0, 3],
+]
+match-kind = "all"
+search-kind = "overlapping"
+
+[[test]]
+name = "repetition-star-leftmost-first-200"
+regex = '(abc)*'
+haystack = "zzabcabczzabc"
+matches = [
+ [[0, 0], []],
+]
+match-kind = "leftmost-first"
+search-kind = "overlapping"
+
+[[test]]
+name = "repetition-star-all-200"
+regex = '(abc)*'
+haystack = "zzabcabczzabc"
+matches = [
+ [[0, 0], []],
+ [[1, 1], []],
+ [[2, 2], []],
+ [[3, 3], []],
+ [[4, 4], []],
+ [[5, 5], []],
+ [[2, 5], [2, 5]],
+ [[6, 6], []],
+ [[7, 7], []],
+ [[8, 8], []],
+ [[5, 8], [5, 8]],
+ [[2, 8], [5, 8]],
+ [[9, 9], []],
+ [[10, 10], []],
+ [[11, 11], []],
+ [[12, 12], []],
+ [[13, 13], []],
+ [[10, 13], [10, 13]],
+]
+match-kind = "all"
+search-kind = "overlapping"
+
+[[test]]
+name = "start-end-rep-leftmost-first"
+regex = '(^$)*'
+haystack = "abc"
+matches = [
+ [[0, 0], []],
+]
+match-kind = "leftmost-first"
+search-kind = "overlapping"
+
+[[test]]
+name = "start-end-rep-all"
+regex = '(^$)*'
+haystack = "abc"
+matches = [
+ [[0, 0], []],
+ [[1, 1], []],
+ [[2, 2], []],
+ [[3, 3], []],
+]
+match-kind = "all"
+search-kind = "overlapping"
+
+[[test]]
+name = "alt-leftmost-first-100"
+regex = 'abc|a'
+haystack = "zzabcazzaabc"
+matches = [[2, 3], [2, 5]]
+match-kind = "leftmost-first"
+search-kind = "overlapping"
+
+[[test]]
+name = "alt-all-100"
+regex = 'abc|a'
+haystack = "zzabcazzaabc"
+matches = [[2, 3], [2, 5], [5, 6], [8, 9], [9, 10], [9, 12]]
+match-kind = "all"
+search-kind = "overlapping"
+
+[[test]]
+name = "empty-000"
+regex = ""
+haystack = "abc"
+matches = [[0, 0], [1, 1], [2, 2], [3, 3]]
+match-kind = "all"
+search-kind = "overlapping"
+
+[[test]]
+name = "empty-alt-000"
+regex = "|b"
+haystack = "abc"
+matches = [[0, 0], [1, 1], [2, 2], [1, 2], [3, 3]]
+match-kind = "all"
+search-kind = "overlapping"
+
+[[test]]
+name = "empty-alt-010"
+regex = "b|"
+haystack = "abc"
+matches = [[0, 0], [1, 1], [2, 2], [1, 2], [3, 3]]
+match-kind = "all"
+search-kind = "overlapping"
+
+[[test]]
+# See: https://github.com/rust-lang/regex/issues/484
+name = "iter1-bytes"
+regex = ''
+haystack = "☃"
+matches = [[0, 0], [1, 1], [2, 2], [3, 3]]
+utf8 = false
+match-kind = "all"
+search-kind = "overlapping"
+
+[[test]]
+# See: https://github.com/rust-lang/regex/issues/484
+name = "iter1-utf8"
+regex = ''
+haystack = "☃"
+matches = [[0, 0], [3, 3]]
+match-kind = "all"
+search-kind = "overlapping"
+
+[[test]]
+name = "iter1-incomplete-utf8"
+regex = ''
+haystack = '\xE2\x98' # incomplete snowman
+matches = [[0, 0], [1, 1], [2, 2]]
+match-kind = "all"
+search-kind = "overlapping"
+unescape = true
+utf8 = false
+
+[[test]]
+name = "scratch"
+regex = ['sam', 'samwise']
+haystack = "samwise"
+matches = [
+ { id = 0, span = [0, 3] },
+]
+match-kind = "leftmost-first"
+search-kind = "overlapping"