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 |
5 #include "mojo/public/cpp/bindings/string.h" | 7 #include "mojo/public/cpp/bindings/string.h" |
6 #include "testing/gtest/include/gtest/gtest.h" | 8 #include "testing/gtest/include/gtest/gtest.h" |
7 | 9 |
8 namespace mojo { | 10 namespace mojo { |
9 namespace test { | 11 namespace test { |
10 | 12 |
11 TEST(StringTest, DefaultIsNull) { | 13 TEST(StringTest, DefaultIsNull) { |
12 String s; | 14 String s; |
13 EXPECT_TRUE(s.is_null()); | 15 EXPECT_TRUE(s.is_null()); |
14 } | 16 } |
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
109 String null; | 111 String null; |
110 String null2; | 112 String null2; |
111 EXPECT_FALSE(null < null2); | 113 EXPECT_FALSE(null < null2); |
112 EXPECT_FALSE(null2 < null); | 114 EXPECT_FALSE(null2 < null); |
113 | 115 |
114 String real("real"); | 116 String real("real"); |
115 EXPECT_TRUE(null < real); | 117 EXPECT_TRUE(null < real); |
116 EXPECT_FALSE(real < null); | 118 EXPECT_FALSE(real < null); |
117 } | 119 } |
118 | 120 |
| 121 TEST(StringTest, OutputFormatting) { |
| 122 String s("abc"); |
| 123 String null; |
| 124 |
| 125 std::ostringstream so; |
| 126 so << "s=" << s << ", null=" << null; |
| 127 EXPECT_EQ("s=abc, null=", so.str()); |
| 128 } |
| 129 |
119 } // namespace test | 130 } // namespace test |
120 } // namespace mojo | 131 } // namespace mojo |
OLD | NEW |