Fixes Cygwin compatibility (by Vlad Losev); Improves Python tests (by Vlad Losev); Fixes ambiguous call to implicit_cast; Uses gtest's SkipPrefix() instead gmock's own (by Vlad Losev).

This commit is contained in:
zhanyong.wan
2009-12-01 19:42:25 +00:00
parent 19eb9e9e3d
commit f6d6a22b8e
7 changed files with 27 additions and 25 deletions

View File

@@ -443,8 +443,14 @@ TEST(PrintPointerToPointerTest, IntPointerPointer) {
void MyFunction(int n) {}
TEST(PrintPointerTest, NonMemberFunctionPointer) {
EXPECT_EQ(PrintPointer(reinterpret_cast<const void*>(&MyFunction)),
Print(&MyFunction));
// We cannot directly cast &MyFunction to const void* because the
// standard disallows casting between pointers to functions and
// pointers to objects, and some compilers (e.g. GCC 3.4) enforce
// this limitation.
EXPECT_EQ(
PrintPointer(reinterpret_cast<const void*>(
reinterpret_cast<internal::BiggestInt>(&MyFunction))),
Print(&MyFunction));
int (*p)(bool) = NULL; // NOLINT
EXPECT_EQ("NULL", Print(p));
}
@@ -973,7 +979,12 @@ TEST(PrintReferenceTest, HandlesFunctionPointer) {
void (*fp)(int n) = &MyFunction;
const string fp_pointer_string =
PrintPointer(reinterpret_cast<const void*>(&fp));
const string fp_string = PrintPointer(reinterpret_cast<const void*>(fp));
// We cannot directly cast &MyFunction to const void* because the
// standard disallows casting between pointers to functions and
// pointers to objects, and some compilers (e.g. GCC 3.4) enforce
// this limitation.
const string fp_string = PrintPointer(reinterpret_cast<const void*>(
reinterpret_cast<internal::BiggestInt>(fp)));
EXPECT_EQ("@" + fp_pointer_string + " " + fp_string,
PrintByRef(fp));
}