Merge pull request #4182 from venik:venik-char8-lib-fix

PiperOrigin-RevId: 517470997
Change-Id: I12b079dc1536f136dd0514871fe79f9678b1fd6a
This commit is contained in:
Copybara-Service 2023-03-17 11:58:34 -07:00
commit 837f2229a9
3 changed files with 7 additions and 7 deletions

View File

@ -1003,7 +1003,7 @@ template <>
class UniversalTersePrinter<char*> : public UniversalTersePrinter<const char*> { class UniversalTersePrinter<char*> : public UniversalTersePrinter<const char*> {
}; };
#ifdef __cpp_char8_t #ifdef __cpp_lib_char8_t
template <> template <>
class UniversalTersePrinter<const char8_t*> { class UniversalTersePrinter<const char8_t*> {
public: public:

View File

@ -528,7 +528,7 @@ void PrintStringTo(const ::std::string& s, ostream* os) {
} }
} }
#ifdef __cpp_char8_t #ifdef __cpp_lib_char8_t
void PrintU8StringTo(const ::std::u8string& s, ostream* os) { void PrintU8StringTo(const ::std::u8string& s, ostream* os) {
PrintCharsAsStringTo(s.data(), s.size(), os); PrintCharsAsStringTo(s.data(), s.size(), os);
} }

View File

@ -359,7 +359,7 @@ TEST(PrintCharTest, Char16) { EXPECT_EQ("U+0041", Print(u'A')); }
TEST(PrintCharTest, Char32) { EXPECT_EQ("U+0041", Print(U'A')); } TEST(PrintCharTest, Char32) { EXPECT_EQ("U+0041", Print(U'A')); }
#ifdef __cpp_char8_t #ifdef __cpp_lib_char8_t
TEST(PrintCharTest, Char8) { EXPECT_EQ("U+0041", Print(u8'A')); } TEST(PrintCharTest, Char8) { EXPECT_EQ("U+0041", Print(u8'A')); }
#endif #endif
@ -412,7 +412,7 @@ TEST(PrintBuiltInTypeTest, Integer) {
Print(std::numeric_limits<uint64_t>::max())); // uint64 Print(std::numeric_limits<uint64_t>::max())); // uint64
EXPECT_EQ("-9223372036854775808", EXPECT_EQ("-9223372036854775808",
Print(std::numeric_limits<int64_t>::min())); // int64 Print(std::numeric_limits<int64_t>::min())); // int64
#ifdef __cpp_char8_t #ifdef __cpp_lib_char8_t
EXPECT_EQ("U+0000", EXPECT_EQ("U+0000",
Print(std::numeric_limits<char8_t>::min())); // char8_t Print(std::numeric_limits<char8_t>::min())); // char8_t
EXPECT_EQ("U+00FF", EXPECT_EQ("U+00FF",
@ -518,7 +518,7 @@ TEST(PrintCStringTest, EscapesProperly) {
Print(p)); Print(p));
} }
#ifdef __cpp_char8_t #ifdef __cpp_lib_char8_t
// const char8_t*. // const char8_t*.
TEST(PrintU8StringTest, Const) { TEST(PrintU8StringTest, Const) {
const char8_t* p = u8""; const char8_t* p = u8"";
@ -815,7 +815,7 @@ TEST(PrintArrayTest, CharArrayWithTerminatingNul) {
EXPECT_EQ("\"\\0Hi\"", PrintArrayHelper(a)); EXPECT_EQ("\"\\0Hi\"", PrintArrayHelper(a));
} }
#ifdef __cpp_char8_t #ifdef __cpp_lib_char8_t
// char_t array without terminating NUL. // char_t array without terminating NUL.
TEST(PrintArrayTest, Char8ArrayWithNoTerminatingNul) { TEST(PrintArrayTest, Char8ArrayWithNoTerminatingNul) {
// Array a contains '\0' in the middle and doesn't end with '\0'. // Array a contains '\0' in the middle and doesn't end with '\0'.
@ -935,7 +935,7 @@ TEST(PrintWideStringTest, StringAmbiguousHex) {
} }
#endif // GTEST_HAS_STD_WSTRING #endif // GTEST_HAS_STD_WSTRING
#ifdef __cpp_char8_t #ifdef __cpp_lib_char8_t
TEST(PrintStringTest, U8String) { TEST(PrintStringTest, U8String) {
std::u8string str = u8"Hello, 世界"; std::u8string str = u8"Hello, 世界";
EXPECT_EQ(str, str); // Verify EXPECT_EQ compiles with this type. EXPECT_EQ(str, str); // Verify EXPECT_EQ compiles with this type.