diff options
author | Andrew Morrow <acm@10gen.com> | 2013-05-21 10:14:27 -0400 |
---|---|---|
committer | Andrew Morrow <acm@10gen.com> | 2013-05-22 16:31:54 -0400 |
commit | 6a7413d9c28534b0f5e507787ed522c95914df9d (patch) | |
tree | bb7307e1d362940edf98b2b501caad8fc8d05e86 /src/mongo/bson/bson_obj_test.cpp | |
parent | 98e9bc926749a7096b19c2e1fea636cd96380597 (diff) | |
download | mongo-6a7413d9c28534b0f5e507787ed522c95914df9d.tar.gz |
SERVER-9750 Fix BSONObj::toString handling of empty arrays
Diffstat (limited to 'src/mongo/bson/bson_obj_test.cpp')
-rw-r--r-- | src/mongo/bson/bson_obj_test.cpp | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/src/mongo/bson/bson_obj_test.cpp b/src/mongo/bson/bson_obj_test.cpp new file mode 100644 index 00000000000..6e4d857ee44 --- /dev/null +++ b/src/mongo/bson/bson_obj_test.cpp @@ -0,0 +1,30 @@ +/* Copyright 2013 10gen Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "mongo/db/jsobj.h" +#include "mongo/db/json.h" + +#include "mongo/unittest/unittest.h" + +namespace { + + TEST(ToString, EmptyArray) { + const char text[] = "{ x: [] }"; + mongo::BSONObj o1 = mongo::fromjson(text); + const std::string o1_str = o1.toString(); + ASSERT_EQUALS(text, o1_str); + } + +} // unnamed namespace |