summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTor Brede Vekterli <vekterli@yahooinc.com>2023-03-20 12:15:56 +0000
committerTor Brede Vekterli <vekterli@yahooinc.com>2023-03-20 12:15:56 +0000
commitb1d0f00b2f019e621cd0adc6e18e54fb331739f3 (patch)
tree650b18a19b1252bb7ac12736e9692d77fee3b41b
parent2488c506b929dd64c7d9463557af9c1603653fae (diff)
Test match range failure case with empty ranges returned
-rw-r--r--vespalib/src/tests/regex/regex.cpp5
1 files changed, 5 insertions, 0 deletions
diff --git a/vespalib/src/tests/regex/regex.cpp b/vespalib/src/tests/regex/regex.cpp
index 28fb6bfffc3..1ab4a24a1b3 100644
--- a/vespalib/src/tests/regex/regex.cpp
+++ b/vespalib/src/tests/regex/regex.cpp
@@ -174,6 +174,11 @@ TEST("Can extract min/max prefix range from anchored regex") {
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(); }