Index: base/memory/scoped_ptr_unittest.cc |
diff --git a/base/memory/scoped_ptr_unittest.cc b/base/memory/scoped_ptr_unittest.cc |
index ca7cfbf0cf02923d5daad193efebd5772760ae03..0887a992d26fd12f8ef309d3edade052a00a8c65 100644 |
--- a/base/memory/scoped_ptr_unittest.cc |
+++ b/base/memory/scoped_ptr_unittest.cc |
@@ -4,9 +4,12 @@ |
#include "base/memory/scoped_ptr.h" |
+#include <sstream> |
+ |
#include "base/basictypes.h" |
#include "base/bind.h" |
#include "base/callback.h" |
+#include "base/strings/stringprintf.h" |
#include "testing/gtest/include/gtest/gtest.h" |
namespace { |
@@ -678,3 +681,13 @@ TEST(ScopedPtrTest, SelfResetWithCustomDeleterOptOut) { |
scoped_ptr<int, NoOpDeleter> x(owner.get()); |
x.reset(x.get()); |
} |
+ |
+// Logging a scoped_ptr<T> to an ostream shouldn't convert it to a boolean |
+// value first. |
+TEST(ScopedPtrTest, LoggingDoesntConvertToBoolean) { |
+ scoped_ptr<int> x(new int); |
+ std::stringstream s; |
+ s << x; |
+ std::string expected = base::StringPrintf("%p", x.get()); |
+ EXPECT_EQ(expected, s.str()); |
+} |