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

Unified Diff: mojo/public/cpp/system/tests/macros_unittest.cc

Issue 1535943002: Convert Pass()→std::move() in //mojo/public/ (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Regenerate correctly Created 5 years 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 | « mojo/public/cpp/system/tests/core_unittest.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: mojo/public/cpp/system/tests/macros_unittest.cc
diff --git a/mojo/public/cpp/system/tests/macros_unittest.cc b/mojo/public/cpp/system/tests/macros_unittest.cc
index 72a9b242776e52a385c91f04f7be3625ade4d5a4..e9daf52b0c5192c7865dedb62136cfca528bdd86 100644
--- a/mojo/public/cpp/system/tests/macros_unittest.cc
+++ b/mojo/public/cpp/system/tests/macros_unittest.cc
@@ -15,6 +15,7 @@
#include <assert.h>
#include <stdint.h>
#include <stdlib.h>
+#include <utility>
#include "testing/gtest/include/gtest/gtest.h"
@@ -97,7 +98,7 @@ class MoveOnlyInt {
~MoveOnlyInt() {}
// Move-only constructor and operator=.
- MoveOnlyInt(MoveOnlyInt&& other) { *this = other.Pass(); }
+ MoveOnlyInt(MoveOnlyInt&& other) { *this = std::move(other); }
MoveOnlyInt& operator=(MoveOnlyInt&& other) {
if (&other != this) {
is_set_ = other.is_set_;
@@ -124,17 +125,14 @@ TEST(MacrosCppTest, MoveOnlyType) {
EXPECT_EQ(123, x.value());
MoveOnlyInt y;
EXPECT_FALSE(y.is_set());
- y = x.Pass();
+ y = std::move(x);
EXPECT_FALSE(x.is_set());
EXPECT_TRUE(y.is_set());
EXPECT_EQ(123, y.value());
- MoveOnlyInt z(y.Pass());
+ MoveOnlyInt z(std::move(y));
EXPECT_FALSE(y.is_set());
EXPECT_TRUE(z.is_set());
EXPECT_EQ(123, z.value());
- z = z.Pass();
- EXPECT_TRUE(z.is_set());
- EXPECT_EQ(123, z.value());
}
// Use it, to make sure things get linked in and to avoid any warnings about
« no previous file with comments | « mojo/public/cpp/system/tests/core_unittest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698