Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(934)

Unified Diff: base/memory/scoped_ptr_unittest.cc

Issue 935333002: Update from https://crrev.com/316786 (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 5 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « base/memory/scoped_ptr.h ('k') | base/message_loop/message_loop.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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());
+}
« no previous file with comments | « base/memory/scoped_ptr.h ('k') | base/message_loop/message_loop.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698