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

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: Remove self-move checks to avoid triggering clang warning. 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
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..8780b0cf33ce2946c607f8b50402ea90f0c815ab 100644
--- a/mojo/public/cpp/system/tests/macros_unittest.cc
+++ b/mojo/public/cpp/system/tests/macros_unittest.cc
@@ -10,12 +10,12 @@
// TODO(vtl): Fix no-compile tests (which are all disabled; crbug.com/105388)
// and write some "negative" tests.
-#include "mojo/public/cpp/system/macros.h"
-
#include <assert.h>
#include <stdint.h>
#include <stdlib.h>
+#include <utility>
+#include "mojo/public/cpp/system/macros.h"
#include "testing/gtest/include/gtest/gtest.h"
namespace mojo {
@@ -97,7 +97,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 +124,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

Powered by Google App Engine
This is Rietveld 408576698