| Index: mojo/public/cpp/bindings/tests/map_unittest.cc
|
| diff --git a/mojo/public/cpp/bindings/tests/map_unittest.cc b/mojo/public/cpp/bindings/tests/map_unittest.cc
|
| index 3df89d305ce9e0f6054eb588374d118993552aec..2db0d066ff5d5c964f4b16df9d3dc9fd990fd6b9 100644
|
| --- a/mojo/public/cpp/bindings/tests/map_unittest.cc
|
| +++ b/mojo/public/cpp/bindings/tests/map_unittest.cc
|
| @@ -3,6 +3,7 @@
|
| // found in the LICENSE file.
|
|
|
| #include "mojo/public/cpp/bindings/array.h"
|
| +#include "mojo/public/cpp/bindings/formatting.h"
|
| #include "mojo/public/cpp/bindings/lib/array_serialization.h"
|
| #include "mojo/public/cpp/bindings/lib/bindings_internal.h"
|
| #include "mojo/public/cpp/bindings/lib/fixed_buffer.h"
|
| @@ -31,10 +32,10 @@ struct StringIntData {
|
| const char* string_data;
|
| int int_data;
|
| } kStringIntData[] = {
|
| - {"one", 1},
|
| - {"two", 2},
|
| - {"three", 3},
|
| - {"four", 4},
|
| + {"one", 1},
|
| + {"two", 2},
|
| + {"three", 3},
|
| + {"four", 4},
|
| };
|
|
|
| const size_t kStringIntDataSize = 4;
|
| @@ -433,6 +434,30 @@ TEST_F(MapTest, Serialization_MapOfNullableStructs) {
|
| EXPECT_EQ(4, map2[1]->height);
|
| }
|
|
|
| +TEST_F(MapTest, OutputFormatting) {
|
| + Map<int32_t, std::string> null_map;
|
| + Map<int32_t, std::string> empty_map;
|
| + empty_map.mark_non_null();
|
| + Map<int32_t, std::string> one_element_map;
|
| + one_element_map.insert(123, "abc");
|
| + Map<int32_t, std::string> three_element_map;
|
| + three_element_map.insert(4, "d");
|
| + three_element_map.insert(5, "e");
|
| + three_element_map.insert(6, "f");
|
| +
|
| + std::ostringstream so;
|
| + so << "null_map=" << null_map << ", empty_map=" << empty_map
|
| + << ", one_element_map=" << one_element_map
|
| + << ", three_element_map=" << three_element_map;
|
| +
|
| + EXPECT_EQ(
|
| + "null_map=null, "
|
| + "empty_map=[], "
|
| + "one_element_map=[{123: abc}], "
|
| + "three_element_map=[{4: d}, {5: e}, {6: f}]",
|
| + so.str());
|
| +}
|
| +
|
| } // namespace
|
| } // namespace test
|
| } // namespace mojo
|
|
|