diff options
author | David Storch <david.storch@10gen.com> | 2015-11-13 13:28:36 -0500 |
---|---|---|
committer | David Storch <david.storch@10gen.com> | 2015-11-13 16:41:37 -0500 |
commit | 7a99fd808fc4e8960d2981799415617c495a0fda (patch) | |
tree | 89fbd9ea94559b27637e9d3d1a09827981622c19 /src/mongo/bson/bsonobjbuilder_test.cpp | |
parent | bddbae79b4733dbd392215c38beccab5daa0109c (diff) | |
download | mongo-7a99fd808fc4e8960d2981799415617c495a0fda.tar.gz |
SERVER-20853 eliminate copies in find and getMore path
Diffstat (limited to 'src/mongo/bson/bsonobjbuilder_test.cpp')
-rw-r--r-- | src/mongo/bson/bsonobjbuilder_test.cpp | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/src/mongo/bson/bsonobjbuilder_test.cpp b/src/mongo/bson/bsonobjbuilder_test.cpp index d92d48d6098..fdee41b8ba1 100644 --- a/src/mongo/bson/bsonobjbuilder_test.cpp +++ b/src/mongo/bson/bsonobjbuilder_test.cpp @@ -303,4 +303,21 @@ TEST(BSONObjBuilderTest, ResumeBuildingWithNesting) { << "dd")) << "a" << BSON("c" << 3))); } +TEST(BSONObjBuilderTest, ResetToEmptyResultsInEmptyObj) { + BSONObjBuilder bob; + bob.append("a", 3); + bob.resetToEmpty(); + ASSERT_EQ(BSONObj(), bob.obj()); +} + +TEST(BSONObjBuilderTest, ResetToEmptyForNestedBuilderOnlyResetsInnerObj) { + BSONObjBuilder bob; + bob.append("a", 3); + BSONObjBuilder innerObj(bob.subobjStart("nestedObj")); + innerObj.append("b", 4); + innerObj.resetToEmpty(); + innerObj.done(); + ASSERT_EQ(BSON("a" << 3 << "nestedObj" << BSONObj()), bob.obj()); +} + } // unnamed namespace |