Chromium Code Reviews| Index: third_party/WebKit/Source/wtf/text/CStringTest.cpp |
| diff --git a/third_party/WebKit/Source/wtf/text/CStringTest.cpp b/third_party/WebKit/Source/wtf/text/CStringTest.cpp |
| index 6e4956d1be3be43338383ade3766225816396261..e595c4722a0cc443cd9a988f5db5187428766ecb 100644 |
| --- a/third_party/WebKit/Source/wtf/text/CStringTest.cpp |
| +++ b/third_party/WebKit/Source/wtf/text/CStringTest.cpp |
| @@ -29,6 +29,18 @@ |
| namespace WTF { |
| +namespace { |
| + |
| +CString printedString(const CString& string) |
| +{ |
| + std::ostringstream output; |
| + output << string; |
| + const std::string& result = output.str(); |
| + return CString(result.data(), result.length()); |
| +} |
| + |
| +} // anonymous namespace |
| + |
| TEST(CStringTest, NullStringConstructor) |
| { |
| CString string; |
| @@ -197,4 +209,12 @@ TEST(CStringTest, Comparison) |
| EXPECT_TRUE(c != d); |
| } |
| +TEST(CStringTest, Printer) |
| +{ |
| + EXPECT_EQ(CString("<null>"), printedString(CString())); |
| + EXPECT_EQ(CString("\"abc\""), printedString("abc")); |
| + EXPECT_EQ(CString("\"\\t\\n\\r\\\"\\\\\""), printedString("\t\n\r\"\\")); |
| + EXPECT_EQ(CString("\"\\xFF\\x00\\x01\""), printedString(CString("\xff\0\x01", 3))); |
|
tyoshino (SeeGerritForStatus)
2016/08/12 05:57:38
using CString also for the expectation side to che
tkent
2016/08/12 06:34:54
It isn't so meaningful. I thought returning char*
tyoshino (SeeGerritForStatus)
2016/08/12 06:38:30
Acknowledged.
|
| +} |
| + |
| } // namespace WTF |