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

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

Issue 1532993002: Add output formatters for more mojom types. (Closed) Base URL: git@github.com:domokit/mojo.git@moz-9
Patch Set: rebase Created 4 years, 11 months 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
Index: mojo/public/cpp/bindings/tests/array_unittest.cc
diff --git a/mojo/public/cpp/bindings/tests/array_unittest.cc b/mojo/public/cpp/bindings/tests/array_unittest.cc
index 38917809ecb45db3c9faa7b28975bdd12d242436..9025e0745399355cb45a7df45f760e61fab7756e 100644
--- a/mojo/public/cpp/bindings/tests/array_unittest.cc
+++ b/mojo/public/cpp/bindings/tests/array_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_internal.h"
#include "mojo/public/cpp/bindings/lib/array_serialization.h"
#include "mojo/public/cpp/bindings/lib/fixed_buffer.h"
@@ -828,6 +829,30 @@ TEST_F(ArrayTest, Serialization_ArrayOfStructPtr) {
}
}
+TEST_F(ArrayTest, OutputFormatting) {
viettrungluu 2016/01/26 18:44:05 Could you move all these tests to a formatting_uni
jeffbrown 2016/01/26 22:57:59 Done.
+ Array<int32_t> null_array;
+ Array<int32_t> empty_array;
+ empty_array.resize(0);
+ Array<int32_t> one_element_array;
+ one_element_array.push_back(123);
+ Array<int32_t> three_element_array;
+ three_element_array.push_back(4);
+ three_element_array.push_back(5);
+ three_element_array.push_back(6);
+
+ std::ostringstream so;
+ so << "null_array=" << null_array << ", empty_array=" << empty_array
+ << ", one_element_array=" << one_element_array
+ << ", three_element_array=" << three_element_array;
+
+ EXPECT_EQ(
+ "null_array=null, "
+ "empty_array=[], "
+ "one_element_array=[123], "
+ "three_element_array=[4, 5, 6]",
+ so.str());
+}
+
} // namespace
} // namespace test
} // namespace mojo

Powered by Google App Engine
This is Rietveld 408576698