diff options
author | vladlosev <vladlosev@861a406c-534a-0410-8894-cb66d6ee9925> | 2009-11-17 23:34:56 +0000 |
---|---|---|
committer | vladlosev <vladlosev@861a406c-534a-0410-8894-cb66d6ee9925> | 2009-11-17 23:34:56 +0000 |
commit | b6fe6899bef6dd90572fc0e7f12912d9ad87a19e (patch) | |
tree | 6592fa7d6689ab448669d98dcdf4171d853052ce | |
parent | bf26ca01f23e432f8b2355fd700707ba217a7605 (diff) | |
download | googletest-b6fe6899bef6dd90572fc0e7f12912d9ad87a19e.tar.gz googletest-b6fe6899bef6dd90572fc0e7f12912d9ad87a19e.tar.bz2 googletest-b6fe6899bef6dd90572fc0e7f12912d9ad87a19e.zip |
Implements the element_type typedef in testing::internal::scoped_ptr. This is needed to test gmock's IsNull/NotNull with it.
-rw-r--r-- | include/gtest/internal/gtest-port.h | 2 | ||||
-rw-r--r-- | test/gtest-port_test.cc | 8 |
2 files changed, 10 insertions, 0 deletions
diff --git a/include/gtest/internal/gtest-port.h b/include/gtest/internal/gtest-port.h index 4175fcc1..c67fbd3f 100644 --- a/include/gtest/internal/gtest-port.h +++ b/include/gtest/internal/gtest-port.h @@ -589,6 +589,8 @@ bool IsTrue(bool condition); template <typename T> class scoped_ptr { public: + typedef T element_type; + explicit scoped_ptr(T* p = NULL) : ptr_(p) {} ~scoped_ptr() { reset(); } diff --git a/test/gtest-port_test.cc b/test/gtest-port_test.cc index 0fbe5c51..a2b0059e 100644 --- a/test/gtest-port_test.cc +++ b/test/gtest-port_test.cc @@ -53,6 +53,14 @@ namespace testing { namespace internal { +// Tests that the element_type typedef is available in scoped_ptr and refers +// to the parameter type. +TEST(ScopedPtrTest, DefinesElementType) { + StaticAssertTypeEq<int, ::testing::internal::scoped_ptr<int>::element_type>(); +} + +// TODO(vladl@google.com): Implement THE REST of scoped_ptr tests. + TEST(GtestCheckSyntaxTest, BehavesLikeASingleStatement) { if (AlwaysFalse()) GTEST_CHECK_(false) << "This should never be executed; " |