summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorKyle Suarez <kyle.suarez@mongodb.com>2018-06-19 17:25:41 -0400
committerKyle Suarez <kyle.suarez@mongodb.com>2018-06-20 15:43:44 -0400
commita2ee109e64923e0e569fa8adb0dbc67488a77983 (patch)
tree347b96fa49f7231b0341e294dabffe040733ce6f /src
parente9a6f62b3053733354cabb6d9488d0d4dcc6c424 (diff)
downloadmongo-a2ee109e64923e0e569fa8adb0dbc67488a77983.tar.gz
SERVER-34933 tests for PCRE verbs and Unicode options
Diffstat (limited to 'src')
-rw-r--r--src/mongo/db/matcher/expression_leaf_test.cpp18
1 files changed, 18 insertions, 0 deletions
diff --git a/src/mongo/db/matcher/expression_leaf_test.cpp b/src/mongo/db/matcher/expression_leaf_test.cpp
index 87ac6861f7f..762ffa21279 100644
--- a/src/mongo/db/matcher/expression_leaf_test.cpp
+++ b/src/mongo/db/matcher/expression_leaf_test.cpp
@@ -896,6 +896,24 @@ TEST(RegexMatchExpression, RegexOptionsStringCannotContainEmbeddedNullByte) {
}
}
+TEST(RegexMatchExpression, MalformedRegexAcceptedButMatchesNothing) {
+ RegexMatchExpression regex("a", "[(*ACCEPT)", "");
+ ASSERT_FALSE(regex.matchesBSON(BSON("a"
+ << "")));
+ ASSERT_FALSE(regex.matchesBSON(BSON("a"
+ << "[")));
+}
+
+TEST(RegexMatchExpression, RegexAcceptsUCPOption) {
+ RegexMatchExpression regex("a", "(*UCP)(\\w|\u304C)", "");
+ ASSERT(regex.matchesBSON(BSON("a"
+ << "k")));
+ ASSERT(regex.matchesBSON(BSON("a"
+ << "\u304B")));
+ ASSERT(regex.matchesBSON(BSON("a"
+ << "\u304C")));
+}
+
TEST(ModMatchExpression, MatchesElement) {
BSONObj match = BSON("a" << 1);
BSONObj largerMatch = BSON("a" << 4.0);