summaryrefslogtreecommitdiff
path: root/src/mongo/bson/bson_validate_test.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/mongo/bson/bson_validate_test.cpp')
-rw-r--r--src/mongo/bson/bson_validate_test.cpp14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/mongo/bson/bson_validate_test.cpp b/src/mongo/bson/bson_validate_test.cpp
index 61e67f33c46..a36dbc582d6 100644
--- a/src/mongo/bson/bson_validate_test.cpp
+++ b/src/mongo/bson/bson_validate_test.cpp
@@ -213,4 +213,18 @@ namespace {
ASSERT_NOT_OK(validateBSON(x.objdata(), x.objsize() / 2));
}
+ TEST(BSONValidateFast, StringHasSomething) {
+ BufBuilder bb;
+ BSONObjBuilder ob(bb);
+ bb.appendChar(String);
+ bb.appendStr("x", /*withNUL*/true);
+ bb.appendNum(0);
+ const BSONObj x = ob.done();
+ ASSERT_EQUALS(5 // overhead
+ + 1 // type
+ + 2 // name
+ + 4 // size
+ , x.objsize());
+ ASSERT_NOT_OK(validateBSON(x.objdata(), x.objsize()));
+ }
}