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

Unified Diff: tests/CPlusPlusEleven.cpp

Issue 922043004: C++11 Unit Test for RValue semantics. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: 2015-02-13 (Friday) 17:54:58 EST 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 | « gyp/tests.gypi ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests/CPlusPlusEleven.cpp
diff --git a/tests/CPlusPlusEleven.cpp b/tests/CPlusPlusEleven.cpp
new file mode 100644
index 0000000000000000000000000000000000000000..41821126ad8cd180d6c63a87bd3b27ab6f8751dd
--- /dev/null
+++ b/tests/CPlusPlusEleven.cpp
@@ -0,0 +1,26 @@
+/*
+ * Copyright 2015 Google Inc.
+ *
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+#include "Test.h"
+
+namespace {
+template <class T> T&& Move(T& o) { return static_cast<T&&>(o); }
+
+class Moveable {
+public:
+ Moveable() {}
+ Moveable(Moveable&&) {}
+ Moveable& operator=(Moveable&&) { return *this; }
+private:
+ Moveable(const Moveable&);
+ Moveable& operator=(const Moveable&);
+};
+} // namespace
+
+DEF_TEST(CPlusPlusEleven_RvalueAndMove, r) {
+ Moveable src1; Moveable dst1(Move(src1));
+ Moveable src2, dst2; dst2 = Move(src2);
+}
« no previous file with comments | « gyp/tests.gypi ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698