| 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..0abb4601803b5f37d29c2e59fc194777658e541a 100644
|
| --- a/third_party/WebKit/Source/wtf/text/CStringTest.cpp
|
| +++ b/third_party/WebKit/Source/wtf/text/CStringTest.cpp
|
| @@ -26,9 +26,22 @@
|
| #include "wtf/text/CString.h"
|
|
|
| #include "testing/gtest/include/gtest/gtest.h"
|
| +#include <sstream>
|
|
|
| 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 +210,12 @@ TEST(CStringTest, Comparison)
|
| EXPECT_TRUE(c != d);
|
| }
|
|
|
| +TEST(CStringTest, Printer)
|
| +{
|
| + EXPECT_STREQ("<null>", printedString(CString()).data());
|
| + EXPECT_STREQ("\"abc\"", printedString("abc").data());
|
| + EXPECT_STREQ("\"\\t\\n\\r\\\"\\\\\"", printedString("\t\n\r\"\\").data());
|
| + EXPECT_STREQ("\"\\xFF\\x00\\x01xyz\"", printedString(CString("\xff\0\x01xyz", 6)).data());
|
| +}
|
| +
|
| } // namespace WTF
|
|
|