diff options
author | shiqian <shiqian@861a406c-534a-0410-8894-cb66d6ee9925> | 2009-01-08 01:10:31 +0000 |
---|---|---|
committer | shiqian <shiqian@861a406c-534a-0410-8894-cb66d6ee9925> | 2009-01-08 01:10:31 +0000 |
commit | 53e0dc4041f660b6517b15b08b496e164be614f1 (patch) | |
tree | fc8832cf39d3e67358299901d7474fb9a7b2dfe4 /test/gtest_nc.cc | |
parent | 0efb17dc540ff5fbc9bf2ca370e42347d4d3a6d9 (diff) | |
download | googletest-53e0dc4041f660b6517b15b08b496e164be614f1.tar.gz googletest-53e0dc4041f660b6517b15b08b496e164be614f1.tar.bz2 googletest-53e0dc4041f660b6517b15b08b496e164be614f1.zip |
Implements the --gtest_death_test_use_fork flag and StaticAssertTypeEq.
Diffstat (limited to 'test/gtest_nc.cc')
-rw-r--r-- | test/gtest_nc.cc | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/test/gtest_nc.cc b/test/gtest_nc.cc index 5cbaeefa..73b5db6d 100644 --- a/test/gtest_nc.cc +++ b/test/gtest_nc.cc @@ -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. |