summaryrefslogtreecommitdiffstats
path: root/vendor/regex/tests/regression.rs
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-30 03:57:31 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-30 03:57:31 +0000
commitdc0db358abe19481e475e10c32149b53370f1a1c (patch)
treeab8ce99c4b255ce46f99ef402c27916055b899ee /vendor/regex/tests/regression.rs
parentReleasing progress-linux version 1.71.1+dfsg1-2~progress7.99u1. (diff)
downloadrustc-dc0db358abe19481e475e10c32149b53370f1a1c.tar.xz
rustc-dc0db358abe19481e475e10c32149b53370f1a1c.zip
Merging upstream version 1.72.1+dfsg1.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'vendor/regex/tests/regression.rs')
-rw-r--r--vendor/regex/tests/regression.rs41
1 files changed, 41 insertions, 0 deletions
diff --git a/vendor/regex/tests/regression.rs b/vendor/regex/tests/regression.rs
index e8b252538..291062a77 100644
--- a/vendor/regex/tests/regression.rs
+++ b/vendor/regex/tests/regression.rs
@@ -220,3 +220,44 @@ matiter!(empty_group_find, r"()Ј01", "zЈ01", (1, 5));
// See: https://github.com/rust-lang/regex/issues/862
mat!(non_greedy_question_literal, r"ab??", "ab", Some((0, 1)));
+
+// See: https://github.com/rust-lang/regex/issues/981
+#[cfg(feature = "unicode")]
+#[test]
+fn regression_bad_word_boundary() {
+ let re = regex_new!(r#"(?i:(?:\b|_)win(?:32|64|dows)?(?:\b|_))"#).unwrap();
+ let hay = "ubi-Darwin-x86_64.tar.gz";
+ assert!(!re.is_match(text!(hay)));
+ let hay = "ubi-Windows-x86_64.zip";
+ assert!(re.is_match(text!(hay)));
+}
+
+// See: https://github.com/rust-lang/regex/issues/982
+#[cfg(feature = "unicode-perl")]
+#[test]
+fn regression_unicode_perl_not_enabled() {
+ let pat = r"(\d+\s?(years|year|y))?\s?(\d+\s?(months|month|m))?\s?(\d+\s?(weeks|week|w))?\s?(\d+\s?(days|day|d))?\s?(\d+\s?(hours|hour|h))?";
+ let re = regex_new!(pat);
+ assert!(re.is_ok());
+}
+
+// See: https://github.com/rust-lang/regex/issues/995
+#[test]
+fn regression_big_regex_overflow() {
+ let pat = r" {2147483516}{2147483416}{5}";
+ let re = regex_new!(pat);
+ assert!(re.is_err());
+}
+
+#[test]
+fn regression_complete_literals_suffix_incorrect() {
+ let needles = vec![
+ "aA", "bA", "cA", "dA", "eA", "fA", "gA", "hA", "iA", "jA", "kA",
+ "lA", "mA", "nA", "oA", "pA", "qA", "rA", "sA", "tA", "uA", "vA",
+ "wA", "xA", "yA", "zA",
+ ];
+ let pattern = needles.join("|");
+ let re = regex!(&pattern);
+ let hay = "FUBAR";
+ assert_eq!(0, re.find_iter(text!(hay)).count());
+}