about summary refs log tree commit diff
path: root/absl/algorithm/container_test.cc
diff options
context:
space:
mode:
Diffstat (limited to 'absl/algorithm/container_test.cc')
-rw-r--r--absl/algorithm/container_test.cc15
1 files changed, 15 insertions, 0 deletions
diff --git a/absl/algorithm/container_test.cc b/absl/algorithm/container_test.cc
index de66f14680f1..1502b17f8636 100644
--- a/absl/algorithm/container_test.cc
+++ b/absl/algorithm/container_test.cc
@@ -636,6 +636,21 @@ TEST(MutatingTest, Move) {
                                 Pointee(5)));
 }
 
+TEST(MutatingTest, MoveWithRvalue) {
+  auto MakeRValueSrc = [] {
+    std::vector<std::unique_ptr<int>> src;
+    src.emplace_back(absl::make_unique<int>(1));
+    src.emplace_back(absl::make_unique<int>(2));
+    src.emplace_back(absl::make_unique<int>(3));
+    return src;
+  };
+
+  std::vector<std::unique_ptr<int>> dest = MakeRValueSrc();
+  absl::c_move(MakeRValueSrc(), std::back_inserter(dest));
+  EXPECT_THAT(dest, ElementsAre(Pointee(1), Pointee(2), Pointee(3), Pointee(1),
+                                Pointee(2), Pointee(3)));
+}
+
 TEST(MutatingTest, SwapRanges) {
   std::vector<int> odds = {2, 4, 6};
   std::vector<int> evens = {1, 3, 5};