Implements the MATCHER* macros.

This commit is contained in:
zhanyong.wan
2009-02-12 01:34:27 +00:00
parent 2f0849fef4
commit ce198ff899
8 changed files with 1479 additions and 1 deletions

View File

@@ -152,6 +152,7 @@ using ::std::tr1::make_tuple;
using ::std::tr1::tuple;
using ::std::vector;
using ::testing::StartsWith;
using ::testing::internal::UniversalPrint;
using ::testing::internal::UniversalPrinter;
using ::testing::internal::string;
@@ -980,5 +981,28 @@ TEST(PrintReferenceTest, HandlesMemberVariablePointer) {
+ " " + Print(sizeof(p)) + "-byte object "));
}
TEST(PrintAsStringTest, WorksForNonReference) {
EXPECT_EQ("123", UniversalPrinter<int>::PrintAsString(123));
}
TEST(PrintAsStringTest, WorksForReference) {
int n = 123;
EXPECT_EQ("@" + PrintPointer(&n) + " 123",
UniversalPrinter<const int&>::PrintAsString(n));
}
TEST(UniversalPrintTest, WorksForNonReference) {
::std::stringstream ss;
UniversalPrint(123, &ss);
EXPECT_EQ("123", ss.str());
}
TEST(UniversalPrintTest, WorksForReference) {
const int& n = 123;
::std::stringstream ss;
UniversalPrint(n, &ss);
EXPECT_EQ("123", ss.str());
}
} // namespace gmock_printers_test
} // namespace testing