aboutsummaryrefslogtreecommitdiffstats
path: root/vespalib/src/tests/regex
diff options
context:
space:
mode:
authorHarald Musum <musum@verizonmedia.com>2023-03-20 15:00:04 +0100
committerGitHub <noreply@github.com>2023-03-20 15:00:04 +0100
commitc95c354230bcff2880d9d22ae2a9041bb068e255 (patch)
tree9c83c10f0a225cdd5828013b56ffee6556d76a62 /vespalib/src/tests/regex
parent3075eced6674caef07fed92b9e311bdda67718a5 (diff)
Revert "Add utility wrapper around RE2 possible regex prefix match range"
Diffstat (limited to 'vespalib/src/tests/regex')
-rw-r--r--vespalib/src/tests/regex/regex.cpp31
1 files changed, 0 insertions, 31 deletions
diff --git a/vespalib/src/tests/regex/regex.cpp b/vespalib/src/tests/regex/regex.cpp
index 1ab4a24a1b3..471ba84a68f 100644
--- a/vespalib/src/tests/regex/regex.cpp
+++ b/vespalib/src/tests/regex/regex.cpp
@@ -150,35 +150,4 @@ TEST("Test that default constructed regex is invalid.") {
ASSERT_FALSE(dummy.valid());
}
-TEST("Can extract min/max prefix range from anchored regex") {
- auto min_max = Regex::from_pattern("^.*").possible_anchored_match_prefix_range();
- EXPECT_EQUAL(min_max.first, "");
- EXPECT_EQUAL(min_max.second, "\xf4\x8f\xbf\xc0"); // Highest possible Unicode char (U+10FFFF) as UTF-8, plus 1
-
- min_max = Regex::from_pattern("^hello").possible_anchored_match_prefix_range();
- EXPECT_EQUAL(min_max.first, "hello");
- EXPECT_EQUAL(min_max.second, "hello");
-
- min_max = Regex::from_pattern("^hello|^world").possible_anchored_match_prefix_range();
- EXPECT_EQUAL(min_max.first, "hello");
- EXPECT_EQUAL(min_max.second, "world");
-
- min_max = Regex::from_pattern("(^hello|^world|^zoidberg)").possible_anchored_match_prefix_range();
- EXPECT_EQUAL(min_max.first, "hello");
- EXPECT_EQUAL(min_max.second, "zoidberg");
-
- min_max = Regex::from_pattern("^hello (foo|bar|zoo)").possible_anchored_match_prefix_range();
- EXPECT_EQUAL(min_max.first, "hello bar");
- EXPECT_EQUAL(min_max.second, "hello zoo");
-
- min_max = Regex::from_pattern("^(hello|world)+").possible_anchored_match_prefix_range();
- EXPECT_EQUAL(min_max.first, "hello");
- EXPECT_EQUAL(min_max.second, "worldwp");
-
- // Bad regex; no range
- min_max = Regex::from_pattern("*hello").possible_anchored_match_prefix_range();
- EXPECT_EQUAL(min_max.first, "");
- EXPECT_EQUAL(min_max.second, "");
-}
-
TEST_MAIN() { TEST_RUN_ALL(); }