summaryrefslogtreecommitdiff
path: root/src/mongo/db/pipeline/document_value_test.cpp
diff options
context:
space:
mode:
authorMarko Vojvodic <marko.vojvodic@mongodb.com>2016-11-02 15:59:53 -0400
committerMarko Vojvodic <marko.vojvodic@mongodb.com>2016-11-04 15:40:04 -0400
commitc1567abb4ace3e042931ae705d5b3afd8fbd750b (patch)
treeb24dc0ec4e697fac25ad591310f8bd89a22d49e2 /src/mongo/db/pipeline/document_value_test.cpp
parenta7f147affcc6fe1a751e71a7bff1ad417ddb3b84 (diff)
downloadmongo-c1567abb4ace3e042931ae705d5b3afd8fbd750b.tar.gz
SERVER-26462 Check if _buffer is allocated in DocumentStorage::clone()
Diffstat (limited to 'src/mongo/db/pipeline/document_value_test.cpp')
-rw-r--r--src/mongo/db/pipeline/document_value_test.cpp8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/mongo/db/pipeline/document_value_test.cpp b/src/mongo/db/pipeline/document_value_test.cpp
index adec442f7b8..f8f451bede1 100644
--- a/src/mongo/db/pipeline/document_value_test.cpp
+++ b/src/mongo/db/pipeline/document_value_test.cpp
@@ -104,6 +104,14 @@ TEST(DocumentConstruction, FromInitializerList) {
ASSERT_EQUALS("q", getNthField(document, 1).second.getString());
}
+TEST(DocumentConstruction, FromEmptyDocumentClone) {
+ Document document;
+ ASSERT_EQUALS(0U, document.size());
+ // Prior to SERVER-26462, cloning an empty document would cause a segmentation fault.
+ Document documentClone = document.clone();
+ ASSERT_DOCUMENT_EQ(document, documentClone);
+}
+
/** Add Document fields. */
class AddField {
public: