Commit b6fe6899 by vladlosev

Implements the element_type typedef in testing::internal::scoped_ptr. This is…

Implements the element_type typedef in testing::internal::scoped_ptr. This is needed to test gmock's IsNull/NotNull with it.
parent bf26ca01
...@@ -589,6 +589,8 @@ bool IsTrue(bool condition); ...@@ -589,6 +589,8 @@ bool IsTrue(bool condition);
template <typename T> template <typename T>
class scoped_ptr { class scoped_ptr {
public: public:
typedef T element_type;
explicit scoped_ptr(T* p = NULL) : ptr_(p) {} explicit scoped_ptr(T* p = NULL) : ptr_(p) {}
~scoped_ptr() { reset(); } ~scoped_ptr() { reset(); }
......
...@@ -53,6 +53,14 @@ ...@@ -53,6 +53,14 @@
namespace testing { namespace testing {
namespace internal { 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) { TEST(GtestCheckSyntaxTest, BehavesLikeASingleStatement) {
if (AlwaysFalse()) if (AlwaysFalse())
GTEST_CHECK_(false) << "This should never be executed; " GTEST_CHECK_(false) << "This should never be executed; "
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment