diff options
author | shiqian <shiqian@861a406c-534a-0410-8894-cb66d6ee9925> | 2008-11-24 20:13:22 +0000 |
---|---|---|
committer | shiqian <shiqian@861a406c-534a-0410-8894-cb66d6ee9925> | 2008-11-24 20:13:22 +0000 |
commit | c440a6923aa65d5be64134a6f430a5867a63df3f (patch) | |
tree | 6d5be5dd4644d4c83cc5e434de31a8a4a59a3865 /src | |
parent | 514265c415e072caf92fb4eed57aacdfea9964f1 (diff) | |
download | googletest-c440a6923aa65d5be64134a6f430a5867a63df3f.tar.gz googletest-c440a6923aa65d5be64134a6f430a5867a63df3f.tar.bz2 googletest-c440a6923aa65d5be64134a6f430a5867a63df3f.zip |
Enables the Python tests to run with 2.3 (necessary for testing on Mac OS X Tiger); also fixes gtest_output_test when built with xcode.
Diffstat (limited to 'src')
-rw-r--r-- | src/gtest-internal-inl.h | 4 | ||||
-rw-r--r-- | src/gtest.cc | 21 |
2 files changed, 23 insertions, 2 deletions
diff --git a/src/gtest-internal-inl.h b/src/gtest-internal-inl.h index 0f2bcfba..faf9464d 100644 --- a/src/gtest-internal-inl.h +++ b/src/gtest-internal-inl.h @@ -76,6 +76,10 @@ GTEST_DECLARE_bool_(show_internal_stack_frames); namespace internal { +// The value of GetTestTypeId() as seen from within the Google Test +// library. This is solely for testing GetTestTypeId(). +extern const TypeId kTestTypeIdInGoogleTest; + // Names of the flags (needed for parsing Google Test flags). const char kBreakOnFailureFlag[] = "break_on_failure"; const char kCatchExceptionsFlag[] = "catch_exceptions"; diff --git a/src/gtest.cc b/src/gtest.cc index 4a67b7a2..968efb22 100644 --- a/src/gtest.cc +++ b/src/gtest.cc @@ -515,6 +515,23 @@ void ScopedFakeTestPartResultReporter::ReportTestPartResult( namespace internal { +// Returns the type ID of ::testing::Test. We should always call this +// instead of GetTypeId< ::testing::Test>() to get the type ID of +// testing::Test. This is to work around a suspected linker bug when +// using Google Test as a framework on Mac OS X. The bug causes +// GetTypeId< ::testing::Test>() to return different values depending +// on whether the call is from the Google Test framework itself or +// from user test code. GetTestTypeId() is guaranteed to always +// return the same value, as it always calls GetTypeId<>() from the +// gtest.cc, which is within the Google Test framework. +TypeId GetTestTypeId() { + return GetTypeId<Test>(); +} + +// The value of GetTestTypeId() as seen from within the Google Test +// library. This is solely for testing GetTestTypeId(). +extern const TypeId kTestTypeIdInGoogleTest = GetTestTypeId(); + // This predicate-formatter checks that 'results' contains a test part // failure of the given type and that the failure message contains the // given substring. @@ -1924,9 +1941,9 @@ bool Test::HasSameFixtureClass() { if (this_fixture_id != first_fixture_id) { // Is the first test defined using TEST? - const bool first_is_TEST = first_fixture_id == internal::GetTypeId<Test>(); + const bool first_is_TEST = first_fixture_id == internal::GetTestTypeId(); // Is this test defined using TEST? - const bool this_is_TEST = this_fixture_id == internal::GetTypeId<Test>(); + const bool this_is_TEST = this_fixture_id == internal::GetTestTypeId(); if (first_is_TEST || this_is_TEST) { // The user mixed TEST and TEST_F in this test case - we'll tell |