Implements the --gtest_death_test_use_fork flag and StaticAssertTypeEq.

This commit is contained in:
shiqian
2009-01-08 01:10:31 +00:00
parent 0efb17dc54
commit 53e0dc4041
13 changed files with 213 additions and 10 deletions

View File

@@ -181,6 +181,47 @@ INSTANTIATE_TYPED_TEST_CASE_P(My, FooTest, testing::Types<int>);
// Wrong name prefix: "My" has been used.
INSTANTIATE_TYPED_TEST_CASE_P(My, FooTest, testing::Types<double>);
#elif defined(TEST_STATIC_ASSERT_TYPE_EQ_IS_NOT_A_TYPE)
#include <gtest/gtest.h>
// Tests that StaticAssertTypeEq<T1, T2> cannot be used as a type.
testing::StaticAssertTypeEq<int, int> dummy;
#elif defined(TEST_STATIC_ASSERT_TYPE_EQ_WORKS_IN_NAMESPACE)
#include <gtest/gtest.h>
// Tests that StaticAssertTypeEq<T1, T2> works in a namespace scope.
static bool dummy = testing::StaticAssertTypeEq<int, const int>();
#elif defined(TEST_STATIC_ASSERT_TYPE_EQ_WORKS_IN_CLASS)
#include <gtest/gtest.h>
template <typename T>
class Helper {
public:
// Tests that StaticAssertTypeEq<T1, T2> works in a class.
Helper() { testing::StaticAssertTypeEq<int, T>(); }
void DoSomething() {}
};
void Test() {
Helper<bool> h;
h.DoSomething(); // To avoid the "unused variable" warning.
}
#elif defined(TEST_STATIC_ASSERT_TYPE_EQ_WORKS_IN_FUNCTION)
#include <gtest/gtest.h>
void Test() {
// Tests that StaticAssertTypeEq<T1, T2> works inside a function.
testing::StaticAssertTypeEq<const int, int>();
}
#else
// A sanity test. This should compile.