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..81375cdeffa9e0e63c3a2f9ab2c9f04429a5cdcf 100644 |
--- a/mojo/public/cpp/bindings/tests/map_unittest.cc |
+++ b/mojo/public/cpp/bindings/tests/map_unittest.cc |
@@ -31,10 +31,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 +433,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 |