Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(205)

Unified Diff: mojo/public/cpp/bindings/tests/map_unittest.cc

Issue 1519673002: Add helpers for logging mojom objects. (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: rebase Created 5 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « mojo/public/cpp/bindings/tests/array_unittest.cc ('k') | mojo/public/cpp/bindings/tests/string_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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
« no previous file with comments | « mojo/public/cpp/bindings/tests/array_unittest.cc ('k') | mojo/public/cpp/bindings/tests/string_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698