From b6fe6899bef6dd90572fc0e7f12912d9ad87a19e Mon Sep 17 00:00:00 2001 From: vladlosev Date: Tue, 17 Nov 2009 23:34:56 +0000 Subject: Implements the element_type typedef in testing::internal::scoped_ptr. This is needed to test gmock's IsNull/NotNull with it. --- include/gtest/internal/gtest-port.h | 2 ++ test/gtest-port_test.cc | 8 ++++++++ 2 files changed, 10 insertions(+) diff --git a/include/gtest/internal/gtest-port.h b/include/gtest/internal/gtest-port.h index 4175fcc..c67fbd3 100644 --- a/include/gtest/internal/gtest-port.h +++ b/include/gtest/internal/gtest-port.h @@ -589,6 +589,8 @@ bool IsTrue(bool condition); template 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 0fbe5c5..a2b0059 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::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; " -- cgit v0.12