Googletest export
Deduplicate testing::ReferenceWrapper with std::reference_wrapper. Minor cleanups in matchers_test. PiperOrigin-RevId: 229022872
This commit is contained in:
committed by
Gennadiy Civil
parent
0599a7b841
commit
097407fd3c
@@ -1023,16 +1023,20 @@ TEST(PrintNullptrT, Basic) {
|
||||
|
||||
TEST(PrintReferenceWrapper, Printable) {
|
||||
int x = 5;
|
||||
EXPECT_EQ("5", Print(std::ref(x)));
|
||||
EXPECT_EQ("5", Print(std::cref(x)));
|
||||
EXPECT_EQ("@" + PrintPointer(&x) + " 5", Print(std::ref(x)));
|
||||
EXPECT_EQ("@" + PrintPointer(&x) + " 5", Print(std::cref(x)));
|
||||
}
|
||||
|
||||
TEST(PrintReferenceWrapper, Unprintable) {
|
||||
::foo::UnprintableInFoo up;
|
||||
EXPECT_EQ("16-byte object <EF-12 00-00 34-AB 00-00 00-00 00-00 00-00 00-00>",
|
||||
Print(std::ref(up)));
|
||||
EXPECT_EQ("16-byte object <EF-12 00-00 34-AB 00-00 00-00 00-00 00-00 00-00>",
|
||||
Print(std::cref(up)));
|
||||
EXPECT_EQ(
|
||||
"@" + PrintPointer(&up) +
|
||||
" 16-byte object <EF-12 00-00 34-AB 00-00 00-00 00-00 00-00 00-00>",
|
||||
Print(std::ref(up)));
|
||||
EXPECT_EQ(
|
||||
"@" + PrintPointer(&up) +
|
||||
" 16-byte object <EF-12 00-00 34-AB 00-00 00-00 00-00 00-00 00-00>",
|
||||
Print(std::cref(up)));
|
||||
}
|
||||
|
||||
// Tests printing user-defined unprintable types.
|
||||
|
||||
Reference in New Issue
Block a user