Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
yangql
googletest
Commits
92f0d725
Commit
92f0d725
authored
Mar 06, 2023
by
Alexander Nikforov
Browse files
__cpp_char8_t does not cover std::u8string implementation, but __cpp_lib_char8_t does
parent
2d4f2087
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
5 additions
and
3 deletions
+5
-3
googletest/include/gtest/gtest-printers.h
googletest/include/gtest/gtest-printers.h
+1
-1
googletest/src/gtest-printers.cc
googletest/src/gtest-printers.cc
+1
-1
googletest/test/googletest-printers-test.cc
googletest/test/googletest-printers-test.cc
+3
-1
No files found.
googletest/include/gtest/gtest-printers.h
View file @
92f0d725
...
@@ -1003,7 +1003,7 @@ template <>
...
@@ -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:
...
...
googletest/src/gtest-printers.cc
View file @
92f0d725
...
@@ -528,7 +528,7 @@ void PrintStringTo(const ::std::string& s, ostream* os) {
...
@@ -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
);
}
}
...
...
googletest/test/googletest-printers-test.cc
View file @
92f0d725
...
@@ -532,7 +532,9 @@ TEST(PrintU8StringTest, NonConst) {
...
@@ -532,7 +532,9 @@ TEST(PrintU8StringTest, NonConst) {
EXPECT_EQ
(
PrintPointer
(
p
)
+
" pointing to u8
\"\\
xE4
\\
xB8
\\
x96
\"
"
,
EXPECT_EQ
(
PrintPointer
(
p
)
+
" pointing to u8
\"\\
xE4
\\
xB8
\\
x96
\"
"
,
Print
(
static_cast
<
char8_t
*>
(
p
)));
Print
(
static_cast
<
char8_t
*>
(
p
)));
}
}
#endif
#ifdef __cpp_lib_char8_t
// NULL u8 string.
// NULL u8 string.
TEST
(
PrintU8StringTest
,
Null
)
{
TEST
(
PrintU8StringTest
,
Null
)
{
const
char8_t
*
p
=
nullptr
;
const
char8_t
*
p
=
nullptr
;
...
@@ -936,7 +938,7 @@ TEST(PrintWideStringTest, StringAmbiguousHex) {
...
@@ -936,7 +938,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.
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment