diff options
author | Tor Brede Vekterli <vekterli@yahooinc.com> | 2023-03-20 12:15:56 +0000 |
---|---|---|
committer | Tor Brede Vekterli <vekterli@yahooinc.com> | 2023-03-20 12:15:56 +0000 |
commit | b1d0f00b2f019e621cd0adc6e18e54fb331739f3 (patch) | |
tree | 650b18a19b1252bb7ac12736e9692d77fee3b41b | |
parent | 2488c506b929dd64c7d9463557af9c1603653fae (diff) |
Test match range failure case with empty ranges returned
-rw-r--r-- | vespalib/src/tests/regex/regex.cpp | 5 |
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(); } |