Implements the element_type typedef in testing::internal::scoped_ptr. This is needed to test gmock's IsNull/NotNull with it.

This commit is contained in:
vladlosev 2009-11-17 23:34:56 +00:00
parent bf26ca01f2
commit b6fe6899be
2 changed files with 10 additions and 0 deletions

View File

@ -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(); }

View File

@ -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; "