File tree Expand file tree Collapse file tree 1 file changed +14
-0
lines changed Expand file tree Collapse file tree 1 file changed +14
-0
lines changed Original file line number Diff line number Diff line change @@ -30,3 +30,17 @@ TEST_CASE("valid json is converted to equivalent BSON") {
3030 REQUIRE (expected_view.length () == actual_view.length ());
3131 REQUIRE (0 == memcmp (expected_view.data (), actual_view.data (), expected_view.length ()));
3232}
33+
34+ TEST_CASE (" empty document is converted correctly to json string" ) {
35+ using namespace bsoncxx ;
36+
37+ REQUIRE (0 == to_json (builder::stream::document{}.view ()).compare (" {\n\n }" ));
38+ }
39+
40+ TEST_CASE (" empty array is converted correctly to json string" ) {
41+ using bsoncxx::to_json;
42+ using namespace bsoncxx ::builder::stream;
43+ auto doc = document{};
44+ doc << " array" << open_array << close_array;
45+ REQUIRE (0 == to_json (doc.view ()[" array" ]).compare (" \" array\" : [\n\n ]" ));
46+ }
You can’t perform that action at this time.
0 commit comments