about summary refs log tree commit diff
path: root/absl/utility/utility_test.cc
diff options
context:
space:
mode:
Diffstat (limited to 'absl/utility/utility_test.cc')
-rw-r--r--absl/utility/utility_test.cc8
1 files changed, 8 insertions, 0 deletions
diff --git a/absl/utility/utility_test.cc b/absl/utility/utility_test.cc
index 342165ed5240..3c447b20bb04 100644
--- a/absl/utility/utility_test.cc
+++ b/absl/utility/utility_test.cc
@@ -333,5 +333,13 @@ TEST(ApplyTest, FlipFlop) {
   EXPECT_EQ(42, absl::apply(&FlipFlop::member, std::make_tuple(obj)));
 }
 
+TEST(ExchangeTest, MoveOnly) {
+  auto a = Factory(1);
+  EXPECT_EQ(1, *a);
+  auto b = absl::exchange(a, Factory(2));
+  EXPECT_EQ(2, *a);
+  EXPECT_EQ(1, *b);
+}
+
 }  // namespace