OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
| 5 #include <sstream> |
| 6 |
| 7 #include "mojo/public/cpp/bindings/formatting.h" |
5 #include "mojo/public/cpp/bindings/string.h" | 8 #include "mojo/public/cpp/bindings/string.h" |
6 #include "testing/gtest/include/gtest/gtest.h" | 9 #include "testing/gtest/include/gtest/gtest.h" |
7 | 10 |
8 namespace mojo { | 11 namespace mojo { |
9 namespace test { | 12 namespace test { |
10 | 13 |
11 TEST(StringTest, DefaultIsNull) { | 14 TEST(StringTest, DefaultIsNull) { |
12 String s; | 15 String s; |
13 EXPECT_TRUE(s.is_null()); | 16 EXPECT_TRUE(s.is_null()); |
14 } | 17 } |
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
109 String null; | 112 String null; |
110 String null2; | 113 String null2; |
111 EXPECT_FALSE(null < null2); | 114 EXPECT_FALSE(null < null2); |
112 EXPECT_FALSE(null2 < null); | 115 EXPECT_FALSE(null2 < null); |
113 | 116 |
114 String real("real"); | 117 String real("real"); |
115 EXPECT_TRUE(null < real); | 118 EXPECT_TRUE(null < real); |
116 EXPECT_FALSE(real < null); | 119 EXPECT_FALSE(real < null); |
117 } | 120 } |
118 | 121 |
| 122 TEST(StringText, OutputFormatting) { |
| 123 String s("abc"); |
| 124 String null; |
| 125 |
| 126 std::ostringstream so; |
| 127 so << "s=" << s << ", null=" << null; |
| 128 EXPECT_EQ("s=abc, null=", so.str()); |
| 129 } |
| 130 |
119 } // namespace test | 131 } // namespace test |
120 } // namespace mojo | 132 } // namespace mojo |
OLD | NEW |