This source file includes following definitions.
- TEST
#include <sstream>
#include "base/strings/string16.h"
#include "base/strings/utf_string_conversions.h"
#include "testing/gtest/include/gtest/gtest.h"
namespace base {
#if defined(WCHAR_T_IS_UTF32)
TEST(String16Test, OutputStream) {
{
std::ostringstream stream;
stream << "Empty '" << string16() << "' standard '"
<< string16(ASCIIToUTF16("Hello, world")) << "'";
EXPECT_STREQ("Empty '' standard 'Hello, world'",
stream.str().c_str());
}
{
string16 initial_surrogate;
initial_surrogate.push_back(0xd800);
string16 final_surrogate;
final_surrogate.push_back(0xdc00);
string16 surrogate_pair;
surrogate_pair.push_back(0xd800);
surrogate_pair.push_back(0xdf00);
surrogate_pair.push_back('z');
string16 unterminated_surrogate;
unterminated_surrogate.push_back(0xd800);
unterminated_surrogate.push_back('s');
std::ostringstream stream;
stream << initial_surrogate << "," << final_surrogate << ","
<< surrogate_pair << "," << unterminated_surrogate;
EXPECT_STREQ("\xef\xbf\xbd,\xef\xbf\xbd,\xf0\x90\x8c\x80z,\xef\xbf\xbds",
stream.str().c_str());
}
}
#endif
}