summaryrefslogtreecommitdiff
path: root/src/mongo/db/query/collation
diff options
context:
space:
mode:
authorNick Zolnierz <nicholas.zolnierz@mongodb.com>2019-01-04 13:11:14 -0500
committerNick Zolnierz <nicholas.zolnierz@mongodb.com>2019-01-04 16:03:21 -0500
commite3eaddbf01d4c0939370b117a44b60069b68158e (patch)
tree76d0fbb147d4ceeddf7d857d1cfb7407a4007e5b /src/mongo/db/query/collation
parentb83813667df5d783e7f34bea069d8d586946e563 (diff)
downloadmongo-e3eaddbf01d4c0939370b117a44b60069b68158e.tar.gz
SERVER-38840 ICU parsing does not gracefully handle invalid id-prefixed locales
Diffstat (limited to 'src/mongo/db/query/collation')
-rw-r--r--src/mongo/db/query/collation/collator_factory_icu_test.cpp11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/mongo/db/query/collation/collator_factory_icu_test.cpp b/src/mongo/db/query/collation/collator_factory_icu_test.cpp
index bb3f2f92a32..ce1b051df13 100644
--- a/src/mongo/db/query/collation/collator_factory_icu_test.cpp
+++ b/src/mongo/db/query/collation/collator_factory_icu_test.cpp
@@ -1222,4 +1222,15 @@ TEST(CollatorFactoryICUTest, TraditionalSpanishAliasNotSupported) {
.getStatus());
}
+TEST(CollatorFactoryICUTest, InvalidIdPrefixedLocaleFailsGracefully) {
+ CollatorFactoryICU factory;
+ auto collator = factory.makeFromBSON(BSON("locale"
+ << "x_test"));
+ ASSERT_NOT_OK(collator.getStatus());
+
+ collator = factory.makeFromBSON(BSON("locale"
+ << "I-test"));
+ ASSERT_NOT_OK(collator.getStatus());
+}
+
} // namespace